list

List & List item

Structured list layouts for items.

List / List_item Examples

Copy-ready examples with live previews.

Basic usage

A list with leading, body and trailing content slots.

Live preview

Profile

Account settings

Billing

Payment methods

Security

Password and 2FA

Basic list

import List from "@/packages/ui/src/_components/list/List";
import List_item from "@/packages/ui/src/_components/list/list_item/List_item";
import Icon from "@/packages/ui/src/_components/icon/Icon";

export default function Example() {
  return (
    <List variant="outlined">
      <List_item
        key="profile"
        leadingContent={<Icon name="person" />}
        bodyContent="Profile"
      />
      <List_item
        key="settings"
        leadingContent={<Icon name="settings" />}
        bodyContent="Settings"
        trailingContent={<Icon name="chevron_right" />}
      />
    </List>
  );
}

List variants

Container surface styles: outlined / tonal / elevated.

Live preview

The variant prop belongs to List (container). Items remain the same.
variant="outlined"
A

Outlined list

Container style

Settings

Secondary content

variant="tonal"
B

Tonal list

Softer background

Notifications

Preview layout

variant="elevated"
C

Elevated list

Shadow surface

Help

Trailing button example

variant

import List from "@/_components/list/List";
import List_item from "@/_components/list/list_item/List_item";

export default function Example() {
  return (
    <>
      <List variant="outlined">
        <List_item key="a" bodyContent="Outlined" />
      </List>

      <List variant="tonal">
        <List_item key="b" bodyContent="Tonal" />
      </List>

      <List variant="elevated">
        <List_item key="c" bodyContent="Elevated" />
      </List>
    </>
  );
}

Slots + states

Use leadingContent / bodyContent / trailingContent + selected/disabled styles.

Tip: keep a stable React key per item to ensure predictable drag-and-drop behavior.

Live preview

Basic item

Leading + body + trailing

Checkbox as leading

Just for layout testing

Selected (static)

isSelected=true

Disabled (static)

isDisabled=true

Slots + selected/disabled

import List from "@/_components/list/List";
import List_item from "@/_components/list/list_item/List_item";

export default function Example() {
  return (
    <List variant="outlined">
      <List_item key="1" bodyContent="Normal" />
      <List_item key="2" bodyContent="Selected" isSelected />
      <List_item key="3" bodyContent="Disabled" isDisabled />
    </List>
  );
}

Drag and drop

Enable dragging per row using showDrag (handle-based drag).

Only items with showDrag=true participate in reordering.

Live preview

Drag starts only from the handle. Only items with showDrag participate in reordering.

Fixed item

showDrag=false (stays in place)

1

Draggable item 1

Try dragging me

2

Draggable item 2

Try dragging me

3

Draggable item 3

Try dragging me

4

Draggable item 4

Try dragging me

5

Draggable item 5

Try dragging me

6

Draggable item 6

Try dragging me

7

Draggable item 7

Try dragging me

8

Draggable item 8

Try dragging me

9

Draggable item 9

Try dragging me

0

Draggable item 10

Try dragging me

Fixed item

Still not draggable

showDrag

import List from "@/_components/list/List";
import List_item from "@/_components/list/list_item/List_item";

export default function Example() {
  return (
    <List variant="tonal">
      <List_item key="a" showDrag bodyContent="Draggable A" />
      <List_item key="b" bodyContent="Fixed (not draggable)" />
      <List_item key="c" showDrag bodyContent="Draggable C" />
    </List>
  );
}

Long content

Validate wrapping, spacing and trailing actions on narrow containers.

Live preview

Use this to validate wrapping and spacing inside a constrained live preview.

A longer title that should wrap to the next line on narrow widths

Supporting text can also wrap and should not push trailing actions out of view.

Z

Body can be any ReactNode

For example: multiple lines, inline code, or even a custom layout using Stack.

This helps you stress-test the row height and vertical alignment.

Wrapping stress test

import List from "@/_components/list/List";
import List_item from "@/_components/list/list_item/List_item";

export default function Example() {
  return (
    <List variant="outlined">
      <List_item
        key="x"
        bodyContent="A longer title that should wrap"
        trailingContent="Action"
      />
    </List>
  );
}

Interactive playground

Quick way to validate variant + selected/disabled + drag handle in docs.

Live preview

variant
states

Inbox

key="p-1"

Starred

key="p-2"

Sent

key="p-3"

Trash

key="p-4"

Playground

import { useState } from "react";
import List from "@/packages/ui/src/_components/list/List";
import List_item from "@/packages/ui/src/_components/list/list_item/List_item";

export default function Example() {
  const [selected, setSelected] = useState("b");

  return (
    <List variant="outlined">
      <List_item key="a" showDrag bodyContent="A" onClick={() => setSelected("a")} />
      <List_item key="b" showDrag bodyContent="B" isSelected={selected === "b"} />
      <List_item key="c" bodyContent="C" isDisabled />
    </List>
  );
}

On this page

List Props

List — Props
PropTypeRequiredDefaultDescription
variant"outlined" | "tonal" | "elevated"No"outlined"Visual container style (`cssnt-list--*`).
childrenReact.ReactElement<ILisItemProps, typeof List_item>[]NoundefinedList items to render. The List may clone children to inject internal props used for drag-and-drop.
allowDragAndDropbooleanNoundefinedDeclared in the type, but the current implementation is gated by List_item.showDrag.
minHeightnumberNoundefinedDeclared in the type, but not currently applied to styles.
maxHeightnumberNoundefinedDeclared in the type, but not currently applied to styles.

List_item Props

List_item — Props
PropTypeRequiredDefaultDescription
isSelectedbooleanNofalseAdds `is-selected` class for selected styling.
isDisabledbooleanNofalseAdds `is-disabled` class and prevents dragging.
showDragbooleanNofalseShows the drag handle and enables dragging for this item.
leadingContentReact.ReactNodeNoundefinedRendered in the leading slot (icon/avatar/checkbox).
bodyContentReact.ReactNodeNoundefinedMain content slot (text or any ReactNode).
trailingContentReact.ReactNodeNoundefinedRendered in the trailing slot (chevron/actions/buttons).
div attributesReact.HTMLAttributes<HTMLDivElement>NoList_item also accepts native div attributes (onClick, className, style, role, aria-*, tabIndex, etc.).