mirror of
https://github.com/supabase/supabase.git
synced 2026-10-11 12:25:05 +03:00
Co-authored-by: Francesco Sansalvadore <f.sansalvadore@gmail.com>
43 lines
899 B
TypeScript
43 lines
899 B
TypeScript
import { Button } from '@ui/components/shadcn/ui/button'
|
|
import {
|
|
BadgeExperimental,
|
|
CommandInput,
|
|
CommandList,
|
|
CommandMenu,
|
|
CommandProvider,
|
|
useRegisterCommands,
|
|
useSetCommandMenuOpen,
|
|
} from 'ui-patterns/CommandMenu'
|
|
|
|
function Commands() {
|
|
useRegisterCommands('Commands', [
|
|
{
|
|
id: 'experimental',
|
|
name: 'Experimental',
|
|
action: () => alert('You triggered an experimental command'),
|
|
badge: () => <BadgeExperimental />,
|
|
},
|
|
])
|
|
|
|
return null
|
|
}
|
|
|
|
function CommandMenuTrigger() {
|
|
const setOpen = useSetCommandMenuOpen()
|
|
|
|
return <Button onClick={() => setOpen(true)}>Open command menu</Button>
|
|
}
|
|
|
|
export default function CommandMenuDemo() {
|
|
return (
|
|
<CommandProvider openKey="">
|
|
<CommandMenuTrigger />
|
|
<Commands />
|
|
<CommandMenu>
|
|
<CommandInput />
|
|
<CommandList />
|
|
</CommandMenu>
|
|
</CommandProvider>
|
|
)
|
|
}
|