Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions apps/v4/registry/new-york-v4/ui/command.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -64,13 +64,24 @@ function CommandInput({
className,
...props
}: React.ComponentProps<typeof CommandPrimitive.Input>) {
const inputRef = React.useRef<HTMLInputElement>(null)

React.useEffect(() => {
if (props.autoFocus && inputRef.current) {
requestAnimationFrame(() => {
inputRef.current?.focus()
})
}
}, [props.autoFocus])

return (
<div
data-slot="command-input-wrapper"
className="flex h-9 items-center gap-2 border-b px-3"
>
<SearchIcon className="size-4 shrink-0 opacity-50" />
<CommandPrimitive.Input
ref={inputRef}
data-slot="command-input"
className={cn(
"placeholder:text-muted-foreground flex h-10 w-full rounded-md bg-transparent py-3 text-sm outline-hidden disabled:cursor-not-allowed disabled:opacity-50",
Expand Down