Skip to Content
NarakUI

List

A card of clickable rows, like recent projects or suggested tasks, with an optional heading, sections and footer.

Basic

List.Root is a card. Inside it, compose List.Header, List.Body and List.Footer yourself, with a List.Divider wherever you want a line. Rows go in List.Items, which renders a ul.

Each row is a ListItem.Root around one ListItem.PrimaryAction. The primary action is a button by default; pass asChild and a link to make the row navigate. ListItem.Content lays out the icon, title, description and trailing metadata inside it. Long titles truncate and show the full text in a tooltip.

Pass keyboardNavigation to let ArrowDown and ArrowUp move focus between rows. Tab still moves through every row and control in order. The list does not label itself: give the header a titleId and point the surrounding section at it with aria-labelledby.

Row actions

Put controls that do something other than open the row, like archiving, in ListItem.Actions. It sits beside the primary action rather than inside it, so the two never nest. Never put links or buttons in ListItem.Content, because everything in it belongs to the primary action.

Use titleBehavior="wrap" when the whole title matters, like a task name. Pass controls for the whole list to actions on List.Header. Show an empty or loading state directly in List.Body, not as a fake row. Archive every task here to see the empty state.

Suggested tasks

Sections

Group rows with List.Section, a List.Subheader and their own List.Items. Give each subheader an id and label its section with aria-labelledby. Put dividers between sections, never inside a List.Items.

The status slot holds a short label such as a Badge. A disabled primary action dims its row, and arrow keys skip it.

Reports

Today

Earlier this week

Action hint

ListItem.Reveal shows its resting content until the row is hovered with a mouse or focused with the keyboard, then swaps in active. Both take the same space, so the row does not shift. Touch screens keep the resting content. Use it for a ListItem.ActionHint that says what clicking the row does; the hint is hidden from screen readers, so the row's own label must already make sense.

Installation

pnpm dlx shadcn@latest add @narakui/list

Add "@narakui": "https://ui.narakcode.dev/r/{name}.json" to components.json, or install directly from https://ui.narakcode.dev/r/list.json.

Usage

import { List, ListItem } from '@/components/ui/list';
<section aria-labelledby="projects-title">
  <List.Root keyboardNavigation>
    <List.Header titleId="projects-title" title="Recent projects" />
    <List.Divider />
    <List.Body>
      <List.Items>
        <ListItem.Root>
          <ListItem.PrimaryAction asChild>
            <a href="/projects/q4">
              <ListItem.Content
                title="Q4 visibility push"
                description="3 suggested tasks"
                trailing="2h ago"
              />
            </a>
          </ListItem.PrimaryAction>
        </ListItem.Root>
      </List.Items>
    </List.Body>
  </List.Root>
</section>

Properties

List.Root

PropTypeDefaultDescription
keyboardNavigationbooleanfalseLets ArrowDown and ArrowUp move focus between enabled rows. Stops at the first and last row.
background'primary' | 'secondary' | 'tertiary' | 'quaternary''primary'Card surface color.
padding'none' | 'sm' | 'md''none'Card padding. Header, Body and Footer already have their own spacing.
onKeyDown(event: React.KeyboardEvent<HTMLDivElement>) => void—Runs before arrow key navigation. Call preventDefault() to stop it.
classNamestring—Additional classes for the card.

List.Header

PropTypeDefaultDescription
titleReact.ReactNode—Heading text, rendered in an h2 and truncated when too long.
titleIdstring—Id of the heading, for aria-labelledby on the surrounding section.
actionsReact.ReactNode—Controls at the end of the header.
childrenReact.ReactNode—Replaces the heading, for example with a collapsible trigger.
classNamestring—Additional classes for the header.

List.Divider

PropTypeDefaultDescription
classNamestring—Additional classes for the line. It is hidden from screen readers.

List.Body

PropTypeDefaultDescription
childrenReact.ReactNode—Rows, sections, or a loading or empty state.
classNamestring—Additional classes for the body.

List.Section

PropTypeDefaultDescription
aria-labelledbystring—Id of the section's List.Subheader.
childrenReact.ReactNode—A subheader and its List.Items.

List.Subheader

PropTypeDefaultDescription
idstring—Id that labels the section.
childrenReact.ReactNode—Section heading, rendered in an h3.
classNamestring—Additional classes for the heading.

List.Items

PropTypeDefaultDescription
childrenReact.ReactNode—ListItem.Root rows or other li elements.
classNamestring—Additional classes for the ul.

List.Footer

PropTypeDefaultDescription
childrenReact.ReactNode—Footer controls, such as a See all link.
classNamestring—Additional classes for the footer.

ListItem.Root

PropTypeDefaultDescription
asChildbooleanfalseRenders onto the child element instead of an li. Wrap it in an li if the child is not one.
childrenReact.ReactNode—One ListItem.PrimaryAction and optional ListItem.Actions.
classNamestring—Additional classes for the row.

ListItem.PrimaryAction

PropTypeDefaultDescription
asChildbooleanfalseRenders onto the child, usually a link with its own href, instead of a button.
onClick(event: React.MouseEvent<HTMLButtonElement>) => void—Called when the row is clicked.
disabledbooleanfalseDims the row and skips it during arrow key navigation.
type'button' | 'submit' | 'reset''button'Button type when asChild is false.
classNamestring—Additional classes for the button or link.

ListItem.Content

PropTypeDefaultDescription
title (Required)React.ReactNode—Row title.
descriptionReact.ReactNode—Secondary line under the title.
leadingReact.ReactNode—Icon or avatar before the title.
leadingAlign'start' | 'center''start'Aligns the leading slot with the title or centers it on the row.
statusReact.ReactNode—Short label after the title, such as a Badge.
trailingReact.ReactNode—Metadata at the end of the row, such as a timestamp or ListItem.Reveal.
titleBehavior'truncate' | 'wrap''truncate'Truncates a long title with a tooltip, or wraps it onto more lines.

ListItem.Actions

PropTypeDefaultDescription
align'start' | 'center''start'Aligns the controls with the title or centers them on the row.
childrenReact.ReactNode—Controls beside the primary action, like an archive button.
classNamestring—Additional classes for the container.

ListItem.Reveal

PropTypeDefaultDescription
resting (Required)React.ReactNode—Content shown until the row is hovered or focused.
active (Required)React.ReactNode—Content shown while the row is hovered with a mouse or focused with the keyboard.

ListItem.ActionHint

PropTypeDefaultDescription
childrenReact.ReactNode—Short text describing the primary action. Hidden from screen readers and not clickable.
classNamestring—Additional classes for the hint.