command

Fast, composable, unstyled command menu for Angular.

PreviousNext
Use arrow keys to navigate, Enter to select, Escape to clear selection.
Suggestions
Calendar
Search Emoji
Calculator
Settings
Profile⌘P
Billing⌘B
Settings⌘S
import { ChangeDetectionStrategy, Component } from '@angular/core';

import { provideIcons } from '@ng-icons/core';
import {
  lucideCalculator,
  lucideCalendar,
  lucideCreditCard,
  lucideSettings,
  lucideSmile,
  lucideUser,
} from '@ng-icons/lucide';

import { ZardCommandImports } from '@/shared/components/command/command.imports';

@Component({
  selector: 'z-demo-command-preview',
  imports: [ZardCommandImports],
  template: `
    <z-command class="min-w-sm" #cmd="zCommand">
      <z-command-input placeholder="Type a command or search..." />
      <z-command-list>
        @if (cmd.isEmpty()) {
          <div class="py-6 text-center text-sm">No results found.</div>
        }

        <z-command-option-group zLabel="Suggestions">
          <z-command-option zLabel="Calendar" zValue="calendar" zIcon="lucideCalendar" />
          <z-command-option zLabel="Search Emoji" zValue="emoji" zIcon="lucideSmile" />
          <z-command-option zLabel="Calculator" zValue="calculator" zIcon="lucideCalculator" [zDisabled]="true" />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group zLabel="Settings">
          <z-command-option zLabel="Profile" zValue="profile" zIcon="lucideUser" zShortcut="⌘P" />
          <z-command-option zLabel="Billing" zValue="billing" zIcon="lucideCreditCard" zShortcut="⌘B" />
          <z-command-option zLabel="Settings" zValue="settings" zIcon="lucideSettings" zShortcut="⌘S" />
        </z-command-option-group>
      </z-command-list>
    </z-command>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [
    provideIcons({
      lucideCalendar,
      lucideSmile,
      lucideCalculator,
      lucideUser,
      lucideCreditCard,
      lucideSettings,
    }),
  ],
})
export class ZardDemoCommandPreviewComponent {}

Installation

Copy
npx zard-cli@latest add command

Usage

import { ZardCommandImports } from '@/shared/components/command/command.imports';
Copy
<z-command #cmd="zCommand">
  <z-command-input placeholder="Type a command..." />
  <z-command-list>
    @if (cmd.isEmpty()) {
      <div class="py-6 text-center text-sm">No results found.</div>
    }
    <z-command-option-group zLabel="Suggestions">
      <z-command-option zLabel="Calendar" zValue="calendar" />
    </z-command-option-group>
  </z-command-list>
</z-command>
Copy

Examples

basic

z-command has no dialog of its own, so the palette is built by composing it with ZardDialogService: the button opens a dialog whose content is a z-command, with zClosable/zHideFooter/zOkText/zCancelText turned off so only the command menu shows. A document:keydown listener on the trigger opens the same dialog on ⌘K / Ctrl+K, with the hint rendered by z-kbd-group and z-kbd — never a hand-rolled <kbd>.
import { type AfterViewInit, ChangeDetectionStrategy, Component, inject, viewChild } from '@angular/core';

import { ZardButtonComponent } from '@/shared/components/button/button.component';
import { ZardCommandComponent } from '@/shared/components/command/command.component';
import { ZardCommandImports } from '@/shared/components/command/command.imports';
import { ZardDialogService } from '@/shared/components/dialog/dialog.service';
import { ZardKbdImports } from '@/shared/components/kbd/kbd.imports';

@Component({
  selector: 'z-demo-command-basic-dialog',
  imports: [ZardCommandImports],
  template: `
    <z-command #cmd="zCommand">
      <z-command-input placeholder="Type a command or search..." />
      <z-command-list>
        @if (cmd.isEmpty()) {
          <div class="py-6 text-center text-sm">No results found.</div>
        }
        <z-command-option-group zLabel="Suggestions">
          <z-command-option zLabel="Calendar" zValue="calendar" />
          <z-command-option zLabel="Search Emoji" zValue="emoji" />
          <z-command-option zLabel="Calculator" zValue="calculator" />
        </z-command-option-group>
      </z-command-list>
    </z-command>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
class ZardDemoCommandBasicDialogComponent implements AfterViewInit {
  private readonly cmd = viewChild.required(ZardCommandComponent);
  ngAfterViewInit() {
    setTimeout(() => this.cmd().focus(), 0);
  }
}

@Component({
  selector: 'z-demo-command-basic',
  imports: [ZardButtonComponent, ZardKbdImports],
  template: `
    <button type="button" z-button zType="outline" class="gap-4" (click)="open()">
      Open Menu
      <z-kbd-group>
        <z-kbd>⌘</z-kbd>
        <z-kbd>K</z-kbd>
      </z-kbd-group>
    </button>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  host: {
    // A command palette a reader cannot learn to open is half-documented:
    // ⌘K / Ctrl+K opens the same dialog as clicking the button.
    '(document:keydown)': 'onKeydown($event)',
  },
})
export class ZardDemoCommandBasicComponent {
  private readonly dialogService = inject(ZardDialogService);

  onKeydown(event: KeyboardEvent) {
    if ((event.metaKey || event.ctrlKey) && event.key.toLowerCase() === 'k') {
      event.preventDefault();
      this.open();
    }
  }

  open() {
    this.dialogService.create({
      zContent: ZardDemoCommandBasicDialogComponent,
      zClosable: false,
      zHideFooter: true,
      zOkText: null,
      zCancelText: null,
      zMaskClosable: true,
      zWidth: '24rem',
      zCustomClasses: '!p-0 !gap-0 !border-0 !bg-transparent !shadow-none',
    });
  }
}

shortcuts

zShortcut on z-command-option (see preview) renders a plain-text hint. For a styled, per-key hint, project into the [data-slot=command-option-trailing] slot instead — here each option carries a z-kbd-group of z-kbds rather than the zShortcut string.
import { type AfterViewInit, ChangeDetectionStrategy, Component, inject, viewChild } from '@angular/core';

import { provideIcons } from '@ng-icons/core';
import { lucideCreditCard, lucideSettings, lucideUser } from '@ng-icons/lucide';

import { ZardButtonComponent } from '@/shared/components/button/button.component';
import { ZardCommandComponent } from '@/shared/components/command/command.component';
import { ZardCommandImports } from '@/shared/components/command/command.imports';
import { ZardDialogService } from '@/shared/components/dialog/dialog.service';
import { ZardKbdImports } from '@/shared/components/kbd/kbd.imports';

@Component({
  selector: 'z-demo-command-shortcuts-dialog',
  imports: [ZardCommandImports, ZardKbdImports],
  template: `
    <z-command #cmd="zCommand">
      <z-command-input placeholder="Type a command or search..." />
      <z-command-list>
        @if (cmd.isEmpty()) {
          <div class="py-6 text-center text-sm">No results found.</div>
        }
        <z-command-option-group zLabel="Settings">
          <z-command-option zLabel="Profile" zValue="profile" zIcon="lucideUser">
            <span data-slot="command-option-trailing">
              <z-kbd-group>
                <z-kbd>⌘</z-kbd>
                <z-kbd>P</z-kbd>
              </z-kbd-group>
            </span>
          </z-command-option>
          <z-command-option zLabel="Billing" zValue="billing" zIcon="lucideCreditCard">
            <span data-slot="command-option-trailing">
              <z-kbd-group>
                <z-kbd>⌘</z-kbd>
                <z-kbd>B</z-kbd>
              </z-kbd-group>
            </span>
          </z-command-option>
          <z-command-option zLabel="Settings" zValue="settings" zIcon="lucideSettings">
            <span data-slot="command-option-trailing">
              <z-kbd-group>
                <z-kbd>⌘</z-kbd>
                <z-kbd>S</z-kbd>
              </z-kbd-group>
            </span>
          </z-command-option>
        </z-command-option-group>
      </z-command-list>
    </z-command>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [provideIcons({ lucideUser, lucideCreditCard, lucideSettings })],
})
class ZardDemoCommandShortcutsDialogComponent implements AfterViewInit {
  private readonly cmd = viewChild.required(ZardCommandComponent);
  ngAfterViewInit() {
    setTimeout(() => this.cmd().focus(), 0);
  }
}

@Component({
  selector: 'z-demo-command-shortcuts',
  imports: [ZardButtonComponent],
  template: `
    <button type="button" z-button zType="outline" (click)="open()">Open Menu</button>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCommandShortcutsComponent {
  private readonly dialogService = inject(ZardDialogService);

  open() {
    this.dialogService.create({
      zContent: ZardDemoCommandShortcutsDialogComponent,
      zClosable: false,
      zHideFooter: true,
      zOkText: null,
      zCancelText: null,
      zMaskClosable: true,
      zWidth: '24rem',
      zCustomClasses: '!p-0 !gap-0 !border-0 !bg-transparent !shadow-none',
    });
  }
}

groups

Options organised into named sections with z-command-option-group, divided by z-command-divider. Typing in z-command-input filters every group at once; a group hides itself once none of its options match, and a divider hides itself during a search rather than sit next to an empty group.
import { type AfterViewInit, ChangeDetectionStrategy, Component, inject, viewChild } from '@angular/core';

import { provideIcons } from '@ng-icons/core';
import {
  lucideCalculator,
  lucideCalendar,
  lucideCreditCard,
  lucideSettings,
  lucideSmile,
  lucideUser,
} from '@ng-icons/lucide';

import { ZardButtonComponent } from '@/shared/components/button/button.component';
import { ZardCommandComponent } from '@/shared/components/command/command.component';
import { ZardCommandImports } from '@/shared/components/command/command.imports';
import { ZardDialogService } from '@/shared/components/dialog/dialog.service';

@Component({
  selector: 'z-demo-command-groups-dialog',
  imports: [ZardCommandImports],
  template: `
    <z-command #cmd="zCommand">
      <z-command-input placeholder="Type a command or search..." />
      <z-command-list>
        @if (cmd.isEmpty()) {
          <div class="py-6 text-center text-sm">No results found.</div>
        }

        <z-command-option-group zLabel="Suggestions">
          <z-command-option zLabel="Calendar" zValue="calendar" zIcon="lucideCalendar" />
          <z-command-option zLabel="Search Emoji" zValue="emoji" zIcon="lucideSmile" />
          <z-command-option zLabel="Calculator" zValue="calculator" zIcon="lucideCalculator" />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group zLabel="Settings">
          <z-command-option zLabel="Profile" zValue="profile" zIcon="lucideUser" zShortcut="⌘P" />
          <z-command-option zLabel="Billing" zValue="billing" zIcon="lucideCreditCard" zShortcut="⌘B" />
          <z-command-option zLabel="Settings" zValue="settings" zIcon="lucideSettings" zShortcut="⌘S" />
        </z-command-option-group>
      </z-command-list>
    </z-command>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [
    provideIcons({ lucideCalendar, lucideSmile, lucideCalculator, lucideUser, lucideCreditCard, lucideSettings }),
  ],
})
class ZardDemoCommandGroupsDialogComponent implements AfterViewInit {
  private readonly cmd = viewChild.required(ZardCommandComponent);
  ngAfterViewInit() {
    setTimeout(() => this.cmd().focus(), 0);
  }
}

@Component({
  selector: 'z-demo-command-groups',
  imports: [ZardButtonComponent],
  template: `
    <button type="button" z-button zType="outline" (click)="open()">Open Menu</button>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCommandGroupsComponent {
  private readonly dialogService = inject(ZardDialogService);

  open() {
    this.dialogService.create({
      zContent: ZardDemoCommandGroupsDialogComponent,
      zClosable: false,
      zHideFooter: true,
      zOkText: null,
      zCancelText: null,
      zMaskClosable: true,
      zWidth: '24rem',
      zCustomClasses: '!p-0 !gap-0 !border-0 !bg-transparent !shadow-none',
    });
  }
}

scrollable

A z-command-list with more options than fit the max-h-72 viewport scrolls internally. Arrow-key navigation calls scrollIntoView() on the active z-command-option, so the highlighted row stays visible while keyboard focus remains on z-command-input.
import { type AfterViewInit, ChangeDetectionStrategy, Component, inject, viewChild } from '@angular/core';

import { provideIcons } from '@ng-icons/core';
import {
  lucideBell,
  lucideCalculator,
  lucideCalendar,
  lucideCircleHelp,
  lucideClipboardPaste,
  lucideCode,
  lucideCopy,
  lucideCreditCard,
  lucideFileText,
  lucideFolder,
  lucideFolderPlus,
  lucideHouse,
  lucideImage,
  lucideInbox,
  lucideLayoutGrid,
  lucideList,
  lucidePlus,
  lucideScissors,
  lucideSettings,
  lucideTrash2,
  lucideUser,
  lucideZoomIn,
  lucideZoomOut,
} from '@ng-icons/lucide';

import { ZardButtonComponent } from '@/shared/components/button/button.component';
import { ZardCommandComponent } from '@/shared/components/command/command.component';
import { ZardCommandImports } from '@/shared/components/command/command.imports';
import { ZardDialogService } from '@/shared/components/dialog/dialog.service';

@Component({
  selector: 'z-demo-command-scrollable-dialog',
  imports: [ZardCommandImports],
  template: `
    <z-command #cmd="zCommand">
      <z-command-input placeholder="Type a command or search..." />
      <z-command-list>
        @if (cmd.isEmpty()) {
          <div class="py-6 text-center text-sm">No results found.</div>
        }

        <z-command-option-group zLabel="Navigation">
          <z-command-option zLabel="Home" zValue="home" zIcon="lucideHouse" zShortcut="⌘H" />
          <z-command-option zLabel="Inbox" zValue="inbox" zIcon="lucideInbox" zShortcut="⌘I" />
          <z-command-option zLabel="Documents" zValue="documents" zIcon="lucideFileText" zShortcut="⌘D" />
          <z-command-option zLabel="Folders" zValue="folders" zIcon="lucideFolder" zShortcut="⌘F" />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group zLabel="Actions">
          <z-command-option zLabel="New File" zValue="new-file" zIcon="lucidePlus" zShortcut="⌘N" />
          <z-command-option zLabel="New Folder" zValue="new-folder" zIcon="lucideFolderPlus" zShortcut="⇧⌘N" />
          <z-command-option zLabel="Copy" zValue="copy" zIcon="lucideCopy" zShortcut="⌘C" />
          <z-command-option zLabel="Cut" zValue="cut" zIcon="lucideScissors" zShortcut="⌘X" />
          <z-command-option zLabel="Paste" zValue="paste" zIcon="lucideClipboardPaste" zShortcut="⌘V" />
          <z-command-option zLabel="Delete" zValue="delete" zIcon="lucideTrash2" zShortcut="⌫" />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group zLabel="View">
          <z-command-option zLabel="Grid View" zValue="grid" zIcon="lucideLayoutGrid" />
          <z-command-option zLabel="List View" zValue="list" zIcon="lucideList" />
          <z-command-option zLabel="Zoom In" zValue="zoom-in" zIcon="lucideZoomIn" zShortcut="⌘+" />
          <z-command-option zLabel="Zoom Out" zValue="zoom-out" zIcon="lucideZoomOut" zShortcut="⌘-" />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group zLabel="Account">
          <z-command-option zLabel="Profile" zValue="profile" zIcon="lucideUser" zShortcut="⌘P" />
          <z-command-option zLabel="Billing" zValue="billing" zIcon="lucideCreditCard" zShortcut="⌘B" />
          <z-command-option zLabel="Settings" zValue="settings" zIcon="lucideSettings" zShortcut="⌘S" />
          <z-command-option zLabel="Notifications" zValue="notifications" zIcon="lucideBell" />
          <z-command-option zLabel="Help & Support" zValue="help" zIcon="lucideCircleHelp" />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group zLabel="Tools">
          <z-command-option zLabel="Calculator" zValue="calculator" zIcon="lucideCalculator" />
          <z-command-option zLabel="Calendar" zValue="calendar" zIcon="lucideCalendar" />
          <z-command-option zLabel="Image Editor" zValue="image" zIcon="lucideImage" />
          <z-command-option zLabel="Code Editor" zValue="code" zIcon="lucideCode" />
        </z-command-option-group>
      </z-command-list>
    </z-command>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [
    provideIcons({
      lucideHouse,
      lucideInbox,
      lucideFileText,
      lucideFolder,
      lucidePlus,
      lucideFolderPlus,
      lucideCopy,
      lucideScissors,
      lucideClipboardPaste,
      lucideTrash2,
      lucideLayoutGrid,
      lucideList,
      lucideZoomIn,
      lucideZoomOut,
      lucideUser,
      lucideCreditCard,
      lucideSettings,
      lucideBell,
      lucideCircleHelp,
      lucideCalculator,
      lucideCalendar,
      lucideImage,
      lucideCode,
    }),
  ],
})
class ZardDemoCommandScrollableDialogComponent implements AfterViewInit {
  private readonly cmd = viewChild.required(ZardCommandComponent);
  ngAfterViewInit() {
    setTimeout(() => this.cmd().focus(), 0);
  }
}

@Component({
  selector: 'z-demo-command-scrollable',
  imports: [ZardButtonComponent],
  template: `
    <button type="button" z-button zType="outline" (click)="open()">Open Menu</button>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
})
export class ZardDemoCommandScrollableComponent {
  private readonly dialogService = inject(ZardDialogService);

  open() {
    this.dialogService.create({
      zContent: ZardDemoCommandScrollableDialogComponent,
      zClosable: false,
      zHideFooter: true,
      zOkText: null,
      zCancelText: null,
      zMaskClosable: true,
      zWidth: '24rem',
      zCustomClasses: '!p-0 !gap-0 !border-0 !bg-transparent !shadow-none',
    });
  }
}

rtl

To enable RTL support in zard/ui, see the RTL configuration guide.
Use arrow keys to navigate, Enter to select, Escape to clear selection.
اقتراحات
التقويم
البحث عن الرموز التعبيرية
الآلة الحاسبة
الإعدادات
الملف الشخصي⌘P
الفوترة⌘B
الإعدادات⌘S
// You will notice this example is rendered inside a wrapper that sets the dir and data-lang attributes, and
// reads its text from a translations helper. This is because this site is not RTL by default.
// In your application you won't need either: set dir="rtl" on <html> (or use the CDK Dir directive on a subtree)
// and write the text of your own language. See the RTL guide: https://zardui.com/docs/rtl

import { ChangeDetectionStrategy, Component } from '@angular/core';

import { provideIcons } from '@ng-icons/core';
import {
  lucideCalculator,
  lucideCalendar,
  lucideCreditCard,
  lucideSettings,
  lucideSmile,
  lucideUser,
} from '@ng-icons/lucide';

import { ZardCommandImports } from '@/shared/components/command/command.imports';
import { injectRtlTranslation, type ZardRtlTranslations } from '@/shared/demo-utils/rtl-translation';

interface CommandRtlValues {
  placeholder: string;
  empty: string;
  suggestions: string;
  calendar: string;
  searchEmoji: string;
  calculator: string;
  settings: string;
  profile: string;
  billing: string;
}

const translations: ZardRtlTranslations<CommandRtlValues> = {
  en: {
    dir: 'ltr',
    values: {
      placeholder: 'Type a command or search...',
      empty: 'No results found.',
      suggestions: 'Suggestions',
      calendar: 'Calendar',
      searchEmoji: 'Search Emoji',
      calculator: 'Calculator',
      settings: 'Settings',
      profile: 'Profile',
      billing: 'Billing',
    },
  },
  ar: {
    dir: 'rtl',
    values: {
      placeholder: 'اكتب أمرًا أو ابحث...',
      empty: 'لم يتم العثور على نتائج.',
      suggestions: 'اقتراحات',
      calendar: 'التقويم',
      searchEmoji: 'البحث عن الرموز التعبيرية',
      calculator: 'الآلة الحاسبة',
      settings: 'الإعدادات',
      profile: 'الملف الشخصي',
      billing: 'الفوترة',
    },
  },
  he: {
    dir: 'rtl',
    values: {
      placeholder: 'הקלד פקודה או חפש...',
      empty: 'לא נמצאו תוצאות.',
      suggestions: 'הצעות',
      calendar: 'לוח שנה',
      searchEmoji: "חפש אמוג'י",
      calculator: 'מחשבון',
      settings: 'הגדרות',
      profile: 'פרופיל',
      billing: 'חיוב',
    },
  },
};

@Component({
  selector: 'z-demo-command-rtl',
  imports: [ZardCommandImports],
  template: `
    <z-command class="min-w-sm" #cmd="zCommand">
      <z-command-input [placeholder]="i18n.t().placeholder" />
      <z-command-list>
        @if (cmd.isEmpty()) {
          <div class="py-6 text-center text-sm">{{ i18n.t().empty }}</div>
        }

        <z-command-option-group [zLabel]="i18n.t().suggestions">
          <z-command-option [zLabel]="i18n.t().calendar" zValue="calendar" zIcon="lucideCalendar" />
          <z-command-option [zLabel]="i18n.t().searchEmoji" zValue="emoji" zIcon="lucideSmile" />
          <z-command-option
            [zLabel]="i18n.t().calculator"
            zValue="calculator"
            zIcon="lucideCalculator"
            [zDisabled]="true"
          />
        </z-command-option-group>

        <z-command-divider />

        <z-command-option-group [zLabel]="i18n.t().settings">
          <z-command-option [zLabel]="i18n.t().profile" zValue="profile" zIcon="lucideUser" zShortcut="⌘P" />
          <z-command-option [zLabel]="i18n.t().billing" zValue="billing" zIcon="lucideCreditCard" zShortcut="⌘B" />
          <z-command-option [zLabel]="i18n.t().settings" zValue="settings" zIcon="lucideSettings" zShortcut="⌘S" />
        </z-command-option-group>
      </z-command-list>
    </z-command>
  `,
  changeDetection: ChangeDetectionStrategy.OnPush,
  viewProviders: [
    provideIcons({
      lucideCalendar,
      lucideSmile,
      lucideCalculator,
      lucideUser,
      lucideCreditCard,
      lucideSettings,
    }),
  ],
})
export class ZardDemoCommandRtlComponent {
  protected readonly i18n = injectRtlTranslation(translations);
}

API Reference

z-commandComponent

The command palette root. Filters its `z-command-option`s as `z-command-input` is typed, and owns the arrow-key / Enter / Escape navigation. Exported as `zCommand` for a template reference (`#cmd="zCommand"`) — every example on this page uses it to read `isEmpty()` and call `focus()`. Has no trigger or open state of its own; see the `basic` example for opening it from a `⌘K` shortcut inside a `ZardDialogService` dialog.

PropertyDescriptionTypeDefault
[class] Additional CSS classes ClassValue ''
(zCommandChange) Fired when the highlighted/committed option changes. EventEmitter<ZardCommandOption> -
(zCommandSelected) Fired when an option is chosen (click or Enter). EventEmitter<ZardCommandOption> -
isEmpty() Template-reference-only: `true` once a search term is typed and no option matches it. Zard ships no `z-command-empty`; use this to render the empty state yourself, as every example on this page does. Signal<boolean> -
focus() Template-reference-only: focuses `z-command-input`. Called after opening a dialog-hosted command so typing works immediately. () => void -

z-command-inputComponent

The search box. Debounced by the app-wide input event manager, forwards arrow/Enter/Escape to the parent `z-command`, and exposes `focus()` via `exportAs="zCommandInput"`. Declares no `[class]` input of its own — a `class` attribute on the tag lands on its host element (not merged through `mergeClasses()`), which is enough to reach descendants with `**:` arbitrary-variant selectors.

PropertyDescriptionTypeDefault
[placeholder] Placeholder text for the input. string 'Type a command or search...'
(valueChange) Fired on every keystroke, alongside the `ControlValueAccessor` value. EventEmitter<string> -

z-command-listComponent

The `role="listbox"` container for options and groups. Scrolls internally past `max-h-72`.

PropertyDescriptionTypeDefault
[class] Additional CSS classes ClassValue ''

z-command-optionComponent

A single selectable, filterable entry (`role="option"`). Projects `[data-slot=command-option-leading]` before the label and `[data-slot=command-option-trailing]` after it — the `shortcuts` example projects a `z-kbd-group` into the trailing slot instead of using `zShortcut`, for a styled per-key hint.

PropertyDescriptionTypeDefault
[zValue] Value reported on selection (required). unknown -
[zLabel] Label text, and what the search filters against (required). string -
[zIcon] Leading icon name. IconName undefined
[zCommand] Extra text the search also matches against, in addition to `zLabel`. string ''
[zShortcut] Plain-text shortcut hint rendered at the trailing edge. For a styled hint built from `z-kbd`, project into `[data-slot=command-option-trailing]` instead (see `shortcuts`). string ''
[zDisabled] Disables the option: skipped by keyboard navigation and clicks. boolean false
[variant] Visual variant. 'default' | 'destructive' 'default'
[class] Additional CSS classes ClassValue ''

z-command-option-groupComponent

Groups related `z-command-option`s under a heading. Hides itself once every option inside it is filtered out by the current search.

PropertyDescriptionTypeDefault
[zLabel] Group heading (required). string -
[class] Additional CSS classes ClassValue ''

z-command-dividerComponent

A `role="separator"` line between groups. Hides itself while a search is active, rather than sit next to a group that filtered down to nothing.

PropertyDescriptionTypeDefault
[class] Additional CSS classes ClassValue ''
github iconwhatsapp icondiscord iconX icon

Made with ❤ in Brazil. Open source and available on GitHub .