@hanzo/ui

CommandMenu

import { CommandMenu, COMMAND } from '@hanzo/ui/product'

No examples yet.

Types

export type CommandMenuItem = {
  id: string
  label: string
  icon?: ReactNode
  /** Dimmed text after the label: where it lives, a count. */
  contextual?: string
  /** More words the query matches it by. */
  keywords?: string[]
  /** The keys that run it outside the menu, drawn as keycaps: `['Mod', 'K']`, or `[['G'], ['P']]` for G then P. */
  shortcut?: ShortcutKeys
  /** It opens a page rather than acting: a chevron at its end. */
  submenu?: boolean
  disabled?: boolean
  onSelect: () => void
}
export type CommandMenuGroup = {
  id: string
  label: string
  items: CommandMenuItem[]
}
export type CommandMenuProps = {
  groups: CommandMenuGroup[]
  placeholder?: string
  /** What a query that matches nothing says. */
  empty?: ReactNode
  /** The listbox's accessible name. */
  label?: string
  /** The query, controlled; uncontrolled when absent. */
  query?: string
  onQueryChange?: (query: string) => void
  /** Backspace on an empty query. Default: the pane's `back`, when there is a page under this one. */
  onBack?: () => void
  /** Escape, or a press on `esc`, outside a pane (inside one, the pane closes itself). */
  onClose?: () => void
  autoFocus?: boolean
}

Exports

CommandMenuCOMMANDtype CommandMenuItemtype CommandMenuGrouptype CommandMenuProps