List Item

Configurable row with leading, secondary, trailing, density, muted or accent variants, readOnly presentational rows, and as="button" or asChild link hosts. Includes ListItemLabel for menu and nav section headings, and ListItemNest for indented child groups with an optional guide line. Option List, Select, Combobox, Tag Input, Contents Nav, Sidebar, and Dropdown Menu compose these for selectable options, outlines, and app nav.

Also known as: list row, menu item, nav item, option row, line item

Installation

Install with the CLI, or copy the component source into your project.

Add list-item (npm)

npx --yes -p @default-file/ui df-ui add list-item

States

Default, highlighted, selected, and disabled rows.

Default row
Highlighted
Selected
Disabled

Sizes

Density steps xs, sm, md, and lg. xs is nest and TOC child. sm is TOC parent. md matches Option List and the left index. Override further with chrome padding and fontSize props.

Extra small
Small
Medium
Large
Extra small selected
Small selected
Medium selected
Large selected
Nest child
TOC parent
Index row

Slots

Leading, secondary, trailing, and stacked layout. Icons use the default icon track. Avatar and other non-icon marks use leadingFit content.

Leading icon
Checkbox leadingMulti-select mark
Inline secondaryBeside the label3
Stacked secondaryUnder the title

Nested menu

OptionListItem is List Item. Wrap a parent row in OptionListSubmenu so hover opens OptionListSubContent. Nest again for deeper levels. Badge plus chevron marks parents. Prefer this over inventing a separate hover menu on bare List Item.

Columns

Three-column text row for scales and metrics. Leading and trailing hug the edges; the main specimen stays centered in the row. Row height follows the specimen. Use chrome props for padding, fill, stroke, and type.

Muted

Same pattern as the catalogue On this page rail. Muted rows with asChild links, sm for TOC parents, xs for nested entries, and ListItemNest for the child group guide line. Prefer Contents Nav for a ready outline.

Chrome overrides

Padding, gap, type (size, family, weight, color), radius, fills, and stroke via chrome props. Values write --df-list-item-* on the row. Prefer kit tokens. The same props forward through Option List, Select, and Contents Nav itemChrome.

Custom density
Fill and stroke
Mono type
Custom muted

Link as the row

asChild paints the List Item look onto your own link. The <a> (or Next.js Link) is the clickable row, so navigation stays native.

Section labels

ListItemLabel headings for groups. menu matches Option List. nav matches catalogue sidebar sections.

Sans family
Sans, geometric
Grotesk, neo
Foundations
Introduction
Colors

Properties

Configurable row for menus, pickers, TOC, and app navigation. Compose leading, secondary, and trailing slots. Pair with ListItemLabel for section headings and ListItemNest for indented child groups with an optional guide line. Option List, Select, Combobox, Tag Input, Contents Nav, Sidebar, and Dropdown Menu compose List Item. Use as="button" for in-page actions. Use asChild to paint the row onto a link. Pass itemChrome on composer roots for shared defaults, or set chrome props on each row. Chrome props set --df-list-item-* variables so padding, gap, type (size, family, weight, color), radius, fills, and stroke can be overridden per row.

ListItem

Row chrome, density, host element, and presentational state.

PropTypeDefaultNotes
size"xs" | "sm" | "md" | "lg""md"Density and type size. xs is nest and TOC child (text-11). sm is TOC parent (text-13). md matches Option List and the left index (text-sm). lg is roomier. For muted, each size has its own density recipe. Override further with padding and fontSize props.
variant"accent" | "muted""accent"accent uses picker hover and selected fills. muted uses quiet nav fills for catalogue and TOC rows. Density for muted is per size. Override fills with background, hoverBackground, and selectedBackground.
selectedbooleanfalseSelected or current row appearance.
highlightedbooleanfalseHover or keyboard highlight without selecting.
disabledbooleanfalseNon-interactive row. Sets aria-disabled and dims the row. On as="button", also sets the native disabled attribute.
readOnlybooleanfalsePresentational row for reading only. Keeps size, variant, and selected appearance with no hover, press, focus, or activation. Distinct from disabled, which dims the row. Option List, Select, Dropdown Menu, Contents Nav, and Combobox options skip or forward readOnly through the same contract.
openbooleanfalseOpen state for submenu-style rows. Sets data-open. Independent of selected, which sets data-state.
leading"checkbox" | "check" | ReactNode | false-Leading slot. Pass an icon, "checkbox" or "check" for selection marks, or false to omit. Icons use the icon track by default. For Avatar or other non-icon marks, set leadingFit to content. In columns layout, pass text; the slot hugs content. Set aria-hidden on decorative icons.
leadingFit"icon" | "content""icon"Track size for custom leading nodes. icon keeps the mark box used by row icons. content sizes the track to the node. Use content for Avatar, media, or text marks. Ignored for checkbox and check. Stacked rows with content center the leading, label stack, and trailing as one group.
secondaryReactNode-Supporting copy beside or under the label. Long title and secondary text truncate with an ellipsis when the row is narrower than the copy.
layout"inline" | "stacked" | "columns""inline"inline places secondary beside the label. stacked places it underneath. columns is a three-column text row: leading, main label, and trailing. The main label stays horizontally centered in the row. Leading and trailing hug their tracks. Height follows content. columns does not require secondary.
trailingReactNode-End slot for badges, chevrons, measures, or actions. Stays end-aligned with margin-inline-start auto when the row spans its parent. For nested menu affordances, pass ListItemSubmenuChevron so size matches the indicator slot. When List Item is an OptionListTrigger render host, set OptionList width fill (or a fixed length) so the row has width to push against. In columns layout, use for end-aligned text such as a size value.
indicatorbooleanfalseReserve an end check slot. The check shows when selected. The slot stays end-aligned with auto space before it; --df-list-item-gap is the minimum space from the label. Long labels truncate.
as"div" | "button""div"Native host when asChild is false. Use button for clickable rows without navigation. Ignored when asChild is true.
asChildbooleanfalseWhen true, List Item does not render its own wrapper. Pass one child element (usually a link). That element becomes the clickable row and keeps its own href or routing. Prefer this over wrapping List Item in a separate link. The child text is the label.
childrenReactNode-Label text by default. With asChild, pass a single element such as <a> or <Link> instead.
classNamestring-Additional styles on the host.

Chrome overrides

String props write --df-list-item-* on the host. Prefer token expressions such as var(--muted), var(--border-width-hairline), or calc(2 * var(--spacing-unit)). Size and variant still supply defaults when a prop is omitted. OptionListItem, SelectItem, Combobox, Tag Input, and ContentsNavItem forward the same props. Root itemChrome sets defaults for every row; per-item props win.

PropTypeDefaultNotes
paddingstring-Padding on all sides. Sets each --df-list-item-padding-* side.
paddingXstring-Horizontal padding. Sets --df-list-item-padding-left and --df-list-item-padding-right. Overrides padding on those sides.
paddingYstring-Vertical padding. Sets --df-list-item-padding-top and --df-list-item-padding-bottom. Overrides padding on those sides.
paddingTopstring-Top padding. Sets --df-list-item-padding-top and wins over paddingY and padding.
paddingRightstring-Right padding. Sets --df-list-item-padding-right and wins over paddingX and padding.
paddingBottomstring-Bottom padding. Sets --df-list-item-padding-bottom and wins over paddingY and padding.
paddingLeftstring-Left padding. Sets --df-list-item-padding-left and wins over paddingX and padding.
gapstring-Minimum space between leading, label, trailing, and indicator slots. Sets --df-list-item-gap.
fontSizestring-Label type size. Prefer type tokens such as var(--df-text-11). Sets --df-list-item-font-size.
fontFamilystring-Label font family. Prefer family tokens such as var(--df-font-sans) or var(--df-font-mono). Sets --df-list-item-font-family.
fontWeightstring-Label font weight. Prefer weight tokens such as var(--df-font-weight-semibold). Sets --df-list-item-font-weight. Accent titles default to medium when omitted; muted defaults to normal.
backgroundstring-Resting fill. Sets --df-list-item-bg.
foregroundstring-Resting label color. Sets --df-list-item-fg.
hoverBackgroundstring-Hover, highlight, and focus fill. Sets --df-list-item-hover-bg.
hoverForegroundstring-Hover, highlight, and focus label color. Sets --df-list-item-hover-fg.
selectedBackgroundstring-Selected fill. Also sets selected hover fill unless selectedHoverBackground is passed. Sets --df-list-item-selected-bg and --df-list-item-selected-hover-bg.
selectedForegroundstring-Selected label color. Sets --df-list-item-selected-fg.
selectedHoverBackgroundstring-Selected row hover fill. Sets --df-list-item-selected-hover-bg.
activeBackgroundstring-Pressed fill. Sets --df-list-item-active-bg.
radiusstring-Corner radius of the row fill and stroke. Prefer radius tokens such as var(--radius-md) or var(--radius-2xl). Sets --df-list-item-radius.
borderWidthstring-Stroke width. Prefer border tokens such as var(--border-width-hairline). Default 0 (no stroke). Sets --df-list-item-border-width.
borderColorstring-Stroke color. Prefer var(--border) or other color tokens. Sets --df-list-item-border-color.
borderStylestring-Stroke style such as solid or dashed. Default solid. Sets --df-list-item-border-style.

ListItemLabel

Section heading above a group of rows (data-df list-item-section). OptionListLabel and SelectLabel use the menu variant.

PropTypeDefaultNotes
variant"menu" | "nav""menu"menu is the quiet picker group title (Option List). nav is the uppercase mono catalogue section title.
childrenReactNode-Section title text.
classNamestring-Additional styles.

ListItemSubmenuChevron

Nested menu affordance for the trailing slot. Uses the same size box as the indicator check and muted foreground. Dropdown Menu injects it when a submenu trigger has no custom trailing. Pass it from Option List and Sidebar rows that open nested panels.

PropTypeDefaultNotes
classNamestring-Additional styles on the chevron host.

ListItemNest

Indented group for nested rows. Optional guide line via line. Chrome props write --df-list-item-nest-* on the host. Provides nest scope so ContentsNavItem defaults to nestItemSize inside the group.

PropTypeDefaultNotes
linebooleantrueWhen true, paints the nest guide line. When false, keeps indent without a line.
indentstring-Outer inset before the nest group. Prefer spacing tokens. Sets --df-list-item-nest-indent.
padstring-Inner pad after the guide line. Prefer spacing tokens. Sets --df-list-item-nest-pad.
gapstring-Gap between nested rows. Sets --df-list-item-nest-gap.
lineWidthstring-Guide line thickness. Prefer var(--border-width-hairline). Sets --df-list-item-nest-line-width.
lineColorstring-Guide line color. Prefer var(--border). Sets --df-list-item-nest-line-color.
childrenReactNode-Nested List Item rows.
classNamestring-Additional styles.

Tokens

Theme defaults live on :root. Override these globally or on a local host.

TokenTypeDefaultNotes
--df-list-item-padding-topCSS length-Top padding. Set by padding, paddingY, or paddingTop.
--df-list-item-padding-rightCSS length-Right padding. Set by padding, paddingX, or paddingRight.
--df-list-item-padding-bottomCSS length-Bottom padding. Set by padding, paddingY, or paddingBottom.
--df-list-item-padding-leftCSS length-Left padding. Set by padding, paddingX, or paddingLeft.
--df-list-item-gapCSS length-Minimum space between leading, label, trailing, and indicator slots. Set by the gap prop.
--df-list-item-indicator-sizeCSS length-Width and height of the end check slot when indicator is on.
--df-list-item-font-sizeCSS length-Label type size. Set by data-size recipes, or by the fontSize chrome prop.
--df-list-item-radiusCSS length-Row corner radius. Set by the radius prop.
--df-list-item-bgCSS color-Resting fill. Set by the background prop.
--df-list-item-fgCSS color-Resting label color. Set by the foreground prop.
--df-list-item-hover-bgCSS color-Hover and highlight fill. Set by the hoverBackground prop.
--df-list-item-hover-fgCSS color-Hover and highlight label color. Set by the hoverForeground prop.
--df-list-item-selected-bgCSS color-Selected fill. Set by the selectedBackground prop.
--df-list-item-selected-fgCSS color-Selected label color. Set by the selectedForeground prop.
--df-list-item-selected-hover-bgCSS color-Selected hover fill. Set by selectedHoverBackground or selectedBackground.
--df-list-item-active-bgCSS color-Pressed fill. Set by the activeBackground prop.
--accentCSS color-Default accent hover and selected recipe.
--mutedCSS color-Default muted selected and hover recipe.
--muted-foregroundCSS color-Default muted resting label color.
--df-list-item-nest-indentCSS length-Outer nest inset. Set by ListItemNest indent.
--df-list-item-nest-padCSS length-Inner nest pad. Set by ListItemNest pad.
--df-list-item-nest-gapCSS length-Gap between nested rows. Set by ListItemNest gap.
--df-list-item-nest-line-widthCSS length-Nest guide thickness. Set by ListItemNest lineWidth.
--df-list-item-nest-line-colorCSS color-Nest guide color. Set by ListItemNest lineColor.