List Item
@astryxdesign/core v0.7.1 · ListItem
Props
| Prop | Type | Default | Description |
|---|---|---|---|
label | string | number | — | Primary text of the row. A string or a number truncates to one line; use the label slot for rich content. |
description | string | number | — | Secondary text below the label, also truncated to one line. Use the description slot for several lines or rich content. |
density | ItemDensity ('compact' | 'balanced' | 'spacious') | inherited from the list | Overrides 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. |
interactiveRef | MaybeRefOrGetter<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. |
href | string | — | 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. |
rel | string | — | Link relationship tokens, merged with the ones added automatically. |
isDisabled | boolean | false | Disabled state. The row becomes inert, its content dims, and aria-disabled="true" is written. |
isSelected | boolean | false | Selected 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. |
swipeActions | ItemSwipeActions | — | 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 thelabelprop.description: rich content replacing thedescriptionprop.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.