Command
Filterable, keyboard-navigable command palette list.
Preview
Controls
Device view renders in an isolated frame so real responsive breakpoints apply. Switch to Full for overflowing popovers.
Installation
php artisan ui:add command
Behavior layer (Alpine)
This component installs a self-registering Alpine module to
resources/js/ui/command.js. Import the behavior layer once
from your bundle so it loads (it hooks alpine:init):
import './command.js';
Registry contract
Install confidence
php artisan ui:add command
writes only the generated targets below. The CLI validates each file hash before writing and
prompts before replacing local changes unless --force is used.
- Version
- 1.2.0
- License
- open
- Stability
- stable
- Contract
- v2
- Foundation
- ≥ 1.0.0
| Type | Generated target |
|---|---|
| blade | resources/views/components/ui/command.blade.php |
| blade | resources/views/components/ui/command/input.blade.php |
| blade | resources/views/components/ui/command/list.blade.php |
| blade | resources/views/components/ui/command/item.blade.php |
| blade | resources/views/components/ui/command/empty.blade.php |
| blade | resources/views/components/ui/command/group.blade.php |
| blade | resources/views/components/ui/command/shortcut.blade.php |
| js | resources/js/ui/command.js |
Registry dependencies
None.
Package dependencies
composer: jml/brok:^1.0
npm: alpinejs
Guidance
Navigation and orientationOrient users and move between destinations.
Use when
- Use to orient users and help them move across pages, sections, or commands. Do not hide primary wayfinding in novelty interactions or deep nested structures if straightforward navigation would be clearer.
- Users need to search and invoke actions from a keyboard-friendly palette.
- A long action or navigation list benefits from client-side filtering and grouping.
Avoid when
- Avoid using command as a default simply because it is available in the library. Choose it only when its interaction cost, visibility, and behavior match the job to be done.
- The user is choosing a form value; use combobox or select-advanced.
- There are only a few always-visible actions; use buttons or a menu.
- Task length
- micro
- Interaction cost
- low
- Interruptiveness
- none
- Input precision
- none
- Mobile / touch risk
- low
- Accessibility risk
- medium
- Needs background context
- No
- Comparison needed
- No
Preferred alternatives
- Visible links and local navigation
Anti-patterns
- Hiding primary wayfinding in novelty interactions
Anatomy
root
input
list
group
item
shortcut
empty
Theming hooks
command input
command item
active command item
Canonical examples
defaultgroupeddialogloading
API
manifest knowledge + registry-derived coverageProps
| Prop | Type / values | Default | Description |
|---|---|---|---|
| placeholder | string | Type a command or search… | Declared by @props in the registry Blade source. |
| value | mixed | required | Declared by @props in the registry Blade source. |
| keywords | mixed|null | null | Declared by @props in the registry Blade source. |
| heading | mixed|null | null | Declared by @props in the registry Blade source. |
| separator | bool | false | Declared by @props in the registry Blade source. |
| keys | array | [] | Declared by @props in the registry Blade source. |
Slots
default— Compose command.input, command.list, command.item, and command.empty children.x-ui.command.input— Installed subcomponent from the registry item.x-ui.command.list— Installed subcomponent from the registry item.x-ui.command.item— Installed subcomponent from the registry item.x-ui.command.empty— Installed subcomponent from the registry item.x-ui.command.group— Installed subcomponent from the registry item.x-ui.command.shortcut— Installed subcomponent from the registry item.
Data slots
command
command-empty
command-group
command-group-heading
command-input
command-input-wrapper
command-item
command-list
command-separator
command-shortcut
Capabilities
Behavior
- Filters items as the user types and maintains an active descendant for arrow-key navigation.
- Enter activates the current item; grouped headings remain non-interactive.
- Filters registered items as the user types.
- Arrow keys move the active option, Home/End jump to boundaries, and Enter activates the selected item.
- Installs a JavaScript behavior module when the registry item includes resources/js/ui files.
- Declares registry capability flags: a11y, interactive, responsive, rtl, darkMode, localized.
Usage
<x-ui.command class="w-full max-w-md">
<x-ui.command.input :placeholder="__('Type a command or search…')" />
<x-ui.command.list>
<x-ui.command.empty>{{ __('No results found.') }}</x-ui.command.empty>
<x-ui.command.item value="calendar">{{ __('Calendar') }}</x-ui.command.item>
<x-ui.command.item value="search-emoji">{{ __('Search Emoji') }}</x-ui.command.item>
<x-ui.command.item value="calculator">{{ __('Calculator') }}</x-ui.command.item>
<x-ui.command.item value="profile">{{ __('Profile') }}</x-ui.command.item>
<x-ui.command.item value="settings">{{ __('Settings') }}</x-ui.command.item>
</x-ui.command.list>
</x-ui.command>
Accessibility & localization
data-slot
Keyboard focus-visible
Localized labels
- Each action needs a unique accessible label.
- Keep keyboard shortcuts supplemental rather than the only visible label.
- Uses semantic HTML and a stable
data-slotattribute for styling/scripting hooks. - Focus-visible rings use the
ringtoken so keyboard focus is always visible. - Disabled and invalid states are conveyed to assistive tech, not by color alone.
- Targets WCAG 2.2 AA; verify contrast in light, dark, admin and customer surfaces above.
- Labels go through
__()and the component uses logical properties (ms-*,text-start,start-*) so it mirrors correctly — flip the preview to RTL to confirm.
Source
The exact, editable file ui:add writes
into your app — copy it or own the whole thing. Previews
render this same code; there are no preview-only components.
Changelog
Current version: v1.2.0. See the site changelog for the full release history.