List Item

Presentational row with leading, secondary, trailing, density, and muted or accent variants. Includes ListItemLabel for menu and nav section headings, and ListItemNest for indented child groups with an optional guide line. Option List and Contents Nav compose these for selectable options and outlines.

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 github:itsvigneshv/default-file-ui#main df-ui add list-item

States

Default, highlighted, selected, and disabled rows.

Default row
Highlighted
Selected
Disabled

Sizes

Density steps sm, md, and lg. md matches Option List rows. Override further with chrome padding and fontSize props.

Small
Medium
Large
Small selected
Medium selected
Large selected

Slots

Leading, secondary, trailing, and stacked layout.

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

Muted

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

Chrome overrides

Padding, gap, type size, radius, and fills via chrome props. Values write --df-list-item-* on the row. Prefer kit tokens. List Item paints fills only; use radius to shape the fill.

Custom density
Custom selected
Soft corners
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

Presentational row for menus, pickers, and 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 and Contents Nav wrap List Item for selection and outlines. Use asChild to paint the row onto your own link. Chrome props set --df-list-item-* variables so padding, gap, type size, radius, and fills can be overridden per row.

ListItem

Row chrome, density, and presentational state.

PropTypeDefaultNotes
size"sm" | "md" | "lg""md"Density and type size. md matches Option List rows. sm is compact for nested nav. lg is roomier. 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. Override fills with background, hoverBackground, and selectedBackground.
selectedbooleanfalseSelected or current row appearance.
highlightedbooleanfalseHover or keyboard highlight without selecting.
disabledbooleanfalseNon-interactive row. Sets aria-disabled.
openbooleanfalseOpen state for submenu-style rows.
leading"checkbox" | "check" | ReactNode | false-Leading slot. Pass an icon, "checkbox" or "check" for selection marks, or false to omit.
secondaryReactNode-Supporting copy beside or under the label.
layout"inline" | "stacked""inline"inline places secondary beside the label. stacked places it underneath.
trailingReactNode-End slot for badges, chevrons, or actions.
indicatorbooleanfalseShow a trailing check when selected.
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. 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) or calc(2 * var(--spacing-unit)). Size and variant still supply defaults when a prop is omitted. OptionListItem and SelectItem forward the same props.

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-Space between leading, label, and trailing 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.
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.
selectedBackgroundstring-Selected fill. Also updates the selected hover fill. Sets --df-list-item-selected-bg and --df-list-item-selected-hover-bg.
radiusstring-Corner radius of the row fill. Prefer radius tokens such as var(--radius-md) or var(--radius-2xl). List Item has no border chrome. Sets --df-list-item-radius.

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.

ListItemNest

Indented group for nested rows. Optional guide line via line. Chrome props write --df-list-item-nest-* on the host. Contents Nav uses this for toc children.

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-Slot gap. Set by the gap prop.
--df-list-item-font-sizeCSS length-Label type size. Set by the fontSize 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-selected-bgCSS color-Selected fill. Set by the selectedBackground 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.