Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: add ability to disable kbar #324

Merged
merged 1 commit into from
Jul 17, 2023
Merged

feat: add ability to disable kbar #324

merged 1 commit into from
Jul 17, 2023

Conversation

timc1
Copy link
Owner

@timc1 timc1 commented Jul 17, 2023

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
Copy link

vercel bot commented Jul 17, 2023

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

@timc1 timc1 mentioned this pull request Jul 17, 2023
@timc1 timc1 merged commit 3141961 into main Jul 17, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant