Skip to content

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