Skip to content

feat(clay): CommandInputControl for the detached command mode - #41

Merged
maxscharwath merged 3 commits into
mainfrom
feat/command-detached-mode
Jun 24, 2026
Merged

feat(clay): CommandInputControl for the detached command mode#41
maxscharwath merged 3 commits into
mainfrom
feat/command-detached-mode

Conversation

@maxscharwath

Copy link
Copy Markdown
Contributor

Two command modes

The Command component now supports two usages:

1. Palette (unchanged, "comme avant") - Command + CommandInput + CommandList together in one panel. The classic keyboard palette. Untouched.

2. Detached ("déporté") - new CommandInputControl: the bare cmdk text input with no wrapper box, so the command field plugs into an InputGroup (or any container) while the CommandList renders detached as an absolute dropdown. This is the navbar-search pattern used by the Brika store.

<Command shouldFilter={false} className="relative">
  <InputGroup>
    <InputGroupAddon align="inline-start"><Search /></InputGroupAddon>
    <CommandInputControl value={q} onValueChange={setQ} placeholder="Search..." />
  </InputGroup>
  <CommandList className="absolute top-full ...">...</CommandList>
</Command>

CommandInputControl sets data-slot="input-group-control" so the wrapping InputGroup's focus halo fires, and is borderless/transparent (h-full flex-1) to fill the group.

Notes

  • Palette diff vs main is additions-only (reverted an earlier wrong "CommandInput as a box" attempt).
  • New navbar-search demo (auto-registered) shows the detached usage.
  • Token-driven, no em-dash, no any/as.

Checks

bun run typecheck, bun run build, bun test (390 pass), biome check - all green.

https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM

Command keeps its palette mode (Command + CommandInput + CommandList in one panel)
unchanged. Add CommandInputControl: the bare cmdk text input (no wrapper box) so the
command field can be embedded in an InputGroup (or any container) while the CommandList
renders detached as an absolute dropdown - the navbar-search pattern used by the Brika
store. It carries data-slot="input-group-control" so a wrapping InputGroup's focus halo
fires. New navbar-search demo shows the detached usage.

Claude-Session: https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM
Clicking a prefix InputGroupAddon (its label htmlFor) did not focus a CommandInputControl,
unlike InputGroupInput, because the bare cmdk input never picked up the group's control id.
Export InputGroupControlIdContext and have CommandInputControl read it (id = id ?? controlId),
mirroring InputGroupInput, so addon-click-to-focus works in the detached mode too.

Claude-Session: https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM
…mdk)

The previous controlId approach was ineffective: cmdk's CommandPrimitive.Input forces its
own internal id on the <input> (spreads user props first, then sets id), so a label htmlFor
can never match a CommandInputControl. Instead, InputGroupAddon now focuses the sibling
[data-slot=input-group-control] on mousedown (skipping interactive children), which works for
InputGroupInput, InputGroupTextarea, AND the cmdk-backed CommandInputControl. Revert the now-
useless InputGroupControlIdContext export and the id wiring on CommandInputControl.

Claude-Session: https://claude.ai/code/session_014JHaaV1pTZaS5Ft7DYJoxM
@sonarqubecloud

Copy link
Copy Markdown

@maxscharwath
maxscharwath merged commit cdb8cda into main Jun 24, 2026
4 checks passed
@maxscharwath
maxscharwath deleted the feat/command-detached-mode branch June 24, 2026 21:17
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant