Files
supabase/apps/design-system/registry/default/example/commandmenu-force.tsx
Ivan Vasilov 02cf09212e chore: Remove tsconfig paths (#49770)
This PR removes all `paths` in `tsconfig.json` for all apps and
packages. They were added previosly because some of the components had a
`_Shadcn` suffix because of an ongoing migration. How that the migration
is done, the paths can be removed.

<!-- This is an auto-generated comment: release notes by coderabbit.ai
-->
## Summary by CodeRabbit

* **Refactor**
* Standardized shared UI component, utility, and icon imports across
design-system examples and application screens.
  * Simplified shared component access and project configuration.
  * Added shared access to anchor-link helpers and animation styles.

* **Compatibility**
* Updated component exports and imports without changing existing
behavior.
  * No changes to user-facing workflows, screens, or functionality.
<!-- end of auto-generated comment: release notes by coderabbit.ai -->
2026-09-01 13:13:30 +02:00

61 lines
1.3 KiB
TypeScript

import { Button } from 'ui'
import {
CommandMenu,
CommandMenuInput,
CommandMenuList,
CommandMenuTrigger as CommandMenuTriggerPrimitive,
CommandProvider,
useRegisterCommands,
} from 'ui-patterns/CommandMenu'
function Commands() {
useRegisterCommands('Commands', [
{
id: 'forced',
name: 'Force-mounted',
action: () => alert("This command always shows even if it doesn't match the search query"),
forceMount: true,
},
{
id: 'not-forced',
name: 'Not force-mounted',
action: () => alert("This command will disappear if it doesn't match the search query"),
},
])
useRegisterCommands(
'Force-mounted section',
[
{
id: 'example',
name: 'An example',
action: () => alert('This entire section is force-mounted'),
},
],
{
forceMountSection: true,
}
)
return null
}
function CommandMenuTrigger() {
return (
<CommandMenuTriggerPrimitive>
<Button>Open command menu</Button>
</CommandMenuTriggerPrimitive>
)
}
export default function CommandMenuDemo() {
return (
<CommandProvider openKey="">
<Commands />
<CommandMenu trigger={<CommandMenuTrigger />}>
<CommandMenuInput />
<CommandMenuList />
</CommandMenu>
</CommandProvider>
)
}