timc1 / kbar

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

[question] Is it possible trigger useKBar hooks using AstroJS? #336

Closed robsongajunior closed 8 months ago

robsongajunior commented 1 year ago

Hi, awesome library!

I'm implementing kbar on my personal website https://robsonjunior.dev/. The keyboard shortcut cmd+k it is working perfectly.

Now, i'm trying to open using another button click in the interface to be used on mobile! I have an example: https://github.com/robsongajunior/robsonjunior.dev/blob/kbar-hook/src/components/react/Kbar/Kbar.jsx#L94C1-L94C1

import { useKBar } from 'kbar';

export function KbarButtonHook() {
    let { query } = useKBar();
    return <button onClick={query.toggle}>toogle</button>
}

but when i go to the dev server to look the results on browser, i have the following error on console.

Screenshot 2023-10-15 at 23 32 52

But I don't know what is wrong, i used the example from: https://github.com/zenorocha/zenorocha.com/blob/59e4a572866e1653597aa1ee1777c3e212c3c363/components/ShortcutHome.js#L25C36-L25C58

Do you know how to direction me to the right way?

stale[bot] commented 8 months ago

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.