@hanzo/ui

MenuRow

import { MenuRowContent, MenuRow, MenuLabel, MenuRule, MENU_ROW } from '@hanzo/ui/product'

No examples yet.

Types

export type DotColor = '$green10' | '$yellow10' | '$soft' | '$faint' | '$dim'
export type MenuRowShortcut = ReactNode | string | ShortcutKeys
export type MenuRowContentProps = {
  label: ReactNode
  /** A second, muted line under the label. */
  sub?: ReactNode
  /** Dimmed text beside the label — a count, a type, an id. */
  contextual?: ReactNode
  /** `left` sits right after the label; `right` is pushed to the trailing end. */
  contextualPosition?: 'left' | 'right'
  /** A tier dot in place of an icon. */
  dot?: DotColor
  /** The leading slot: an icon, an Avatar, a logo. */
  icon?: ReactNode
  /** Seat the icon in its tinted well (4px padding, 4px corner). */
  iconContainer?: boolean
  /** A drag grip: `always` in place of the icon, `onHover` swapping with it. */
  grip?: 'never' | 'always' | 'onHover'
  /** Keys: a ReactNode, one key, or a list read as one chord. */
  shortcut?: MenuRowShortcut
  /** The trailing check of the chosen row. */
  check?: boolean
  /** A submenu chevron; `open` turns it a quarter. */
  submenu?: boolean | 'open'
  /** `danger` for a destructive row, `placeholder` for a row that offers rather than does. */
  tone?: 'default' | 'danger' | 'placeholder'
  /** The record row reads in the secondary ink; the sheet row in full ink. */
  quiet?: boolean
  /** Whether the row is under the pointer, for the hover-only grip. */
  hovered?: boolean
  /** The second line's rung: the sheet's softer one or a menu's quiet one. */
  subColor?: '$soft' | '$hint'
}
export type MenuRowProps = Omit<MenuRowContentProps, 'check' | 'tone' | 'quiet' | 'hovered' | 'subColor' | 'label' | 'sub'> & {
  label: string
  /** A second, muted line under the label. */
  sub?: string
  /** Whether this row is the chosen one — see the note above on what it decides. */
  active?: boolean
  /** The destructive register — sign out, delete, revoke. */
  danger?: boolean
  /** A row that offers rather than does: "Add a field", "No value". */
  placeholder?: boolean
  /** Keyboard-highlighted from outside (a list whose cursor is not focus). */
  focused?: boolean
  disabled?: boolean
  /** Trailing actions: shown on hover or focus on a pointer, always on touch. */
  actions?: ReactNode
  actionsVisibility?: 'hover' | 'always'
  /**
   * `suggestion` is a typeahead row (an @-mention, a variable): its selection
   * follows a caret, not the pointer, so the selected row is a rung stronger
   * than hover.
   */
  variant?: 'default' | 'suggestion'
  /** With `variant="suggestion"`, the row the caret is on. */
  selected?: boolean
  /** `row` is the record geometry; the default is the identity sheet's. */
  size?: 'default' | 'row'
  onPress?: () => void
}

Exports

MenuRowContentMenuRowMenuLabelMenuRuleMENU_ROWtype DotColortype MenuRowShortcuttype MenuRowContentPropstype MenuRowProps