timc1 / kbar

fast, portable, and extensible cmd+k interface for your site
https://kbar.vercel.app
MIT License
4.87k stars 184 forks source link

feat: add ability to disable kbar #324

Closed timc1 closed 1 year ago

timc1 commented 1 year ago

Ref #323.

Dynamically enable/disable kbar; useful for controlling when command k should exist within your site:

import { useKbar } from "kbar";

function MyApp() {
  const { query, disabled } = useKbar(state => ({
    disabled: state.disabled
  }));

  return <button onClick={() => query.disable(!disabled)}>{disabled ? "Disabled" : "Disable"}</button>
}
vercel[bot] commented 1 year ago

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Updated (UTC)
kbar ✅ Ready (Inspect) Visit Preview Jul 17, 2023 2:33pm