Can't open Kbar programmatically, cannot read properties of undefined (reading 'toggle')
saadee opened this issue · 5 comments
Hi, I need to open the Kbar programmatically. on an onClick function
I saw previous Closed issues it was mentioned to use useKbar
hook , but it doesn't work like that
here's my code. I am using the kbar version ^0.1.0-beta.39
const { query } = useKBar();
using it like this
<button onClick={() => query.toggle()}>Toggle</button>
Can somebody guide me if I am doing anything wrong?
here's screenshot of error in console
Are you using useKbar
within a component nested in a KBarProvider
?
I've got the same issue and it is nested in a KBarProvider
I got the issue worked out by wrapping the KBarProvider around my entire app. Thanks @timc1 — I
Hey! This issue has been automatically marked as stale because it has not had recent activity. It will be closed if no further activity occurs. Thank you for your contributions.