Skip to content

Commit 2bce8d4

Browse files
feat: Update command.svelte to expose bits-ui imperative API (#2337)
Co-authored-by: Hunter Johnston <[email protected]>
1 parent afe282f commit 2bce8d4

File tree

1 file changed

+8
-2
lines changed

1 file changed

+8
-2
lines changed

docs/src/lib/registry/ui/command/command.svelte

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,16 +1,22 @@
11
<script lang="ts">
2-
import { Command as CommandPrimitive } from "bits-ui";
32
import { cn } from "$lib/utils.js";
3+
import { Command as CommandPrimitive } from "bits-ui";
4+
5+
export type CommandRootApi = CommandPrimitive.Root;
46
57
let {
8+
api = $bindable(null),
69
ref = $bindable(null),
710
value = $bindable(""),
811
class: className,
912
...restProps
10-
}: CommandPrimitive.RootProps = $props();
13+
}: CommandPrimitive.RootProps & {
14+
api?: CommandRootApi | null;
15+
} = $props();
1116
</script>
1217

1318
<CommandPrimitive.Root
19+
bind:this={api}
1420
bind:value
1521
bind:ref
1622
data-slot="command"

0 commit comments

Comments
 (0)