Skip to content

List Item

@astryxdesign/core v0.7.1 · ListItem

Props ​

PropTypeDefaultDescription
labelstring | number—Primary text of the row. A string or a number truncates to one line; use the label slot for rich content.
descriptionstring | number—Secondary text below the label, also truncated to one line. Use the description slot for several lines or rich content.
densityItemDensity ('compact' | 'balanced' | 'spacious')inherited from the listOverrides the density of the surrounding List. Outside a list the default is 'balanced'.
onClick(event: MouseEvent) => void—Click handler. It renders a button that fills the row's content area and turns on the hover and pressed states. Write @click in a template.
interactiveRefMaybeRefOrGetter<HTMLElement | null | undefined>—A ref to a control inside the row that already carries its keyboard access and action, such as a checkbox in startContent. The row becomes an enlarged click target that forwards surface clicks to that control and renders no button of its own, so it adds no second tab stop. Mutually exclusive with onClick and href, which are ignored while it is set.
hrefstring—Link URL. A link element is rendered inside the row.
target'_blank' | '_self'—Where the link opens, only used with href. _blank adds noopener and noreferrer automatically.
relstring—Link relationship tokens, merged with the ones added automatically.
isDisabledbooleanfalseDisabled state. The row becomes inert, its content dims, and aria-disabled="true" is written.
isSelectedbooleanfalseSelected state. Written as aria-selected="true" when the row's role permits it, and as aria-current="true" otherwise. An aria-current you pass yourself wins.
swipeActionsItemSwipeActions—Verbs a sideways touch drag uncovers, per side, each { label, icon?, onActivate, isDisabled?, variant?, hasRemoval? }. A mouse never starts the drag. Give every verb a second home inside the row, or it is unreachable by keyboard and by mouse.
swipeBehavior'reveal' | 'commit''reveal'reveal rests the row open and fires the outermost verb on a long drag; commit slides the row out and fires on release, with nothing left open.

Slots ​

  • startContent: content before the label area, such as an icon or an avatar.
  • label: rich content replacing the label prop.
  • description: rich content replacing the description prop.
  • endContent: content after the label area, such as a badge, a count, or a timestamp.

Exposed ​

element (the root element), focus(), and blur(). Focusing lands on the control inside the row that can actually take focus.