Menu

List item

Rows for lists & settings. 4 types.

Orders
Express deliveryDhaka, within 3 hours
Nusrat JahanOrdered 3 times
Low-stock alertsEmail when under 10

Installation

$ npx uix-ui@latest add list-item

This copies the file into components/ui/list-item.tsx in your project. npx shadcn@latest add @uix/list-item works too.

Usage

list-item.tsx
import { ListItem } from "@/components/ui/list-item";

<div style={{ width: 380, display: "grid", gap: 4 }}>
  <ListItem type="one-line" leading={<Inbox />} title="Orders" />
  <ListItem type="two-line" leading={<Zap />} title="Express delivery" subtitle="Dhaka, within 3 hours" />
  <ListItem type="avatar" initials="NJ" title="Nusrat Jahan" subtitle="Ordered 3 times" />
  <ListItem type="toggle" title="Low-stock alerts" subtitle="Email when under 10" checked={on} onCheckedChange={setOn} />
</div>

Props

PropTypeDefaultDescription
typeone-line | two-line | avatar | toggle"one-line"
titleReact.ReactNode–
subtitleReact.ReactNode–Second line; used by every type except "one-line".
leadingReact.ReactNode–Icon or image in the leading box.
initialsstring–Initials for the "avatar" type.
trailingReact.ReactNode–Replaces the trailing chevron.
checkedbooleanfalseState of the switch in the "toggle" type.
onCheckedChange(checked: boolean) => void–
leadingCheckboxReact.ReactNode–Checkbox before the content (for example <Checkbox aria-label="Select" />).
trailingBadgeReact.ReactNode–Badge before the chevron or switch (for example a count).

Everything else is passed to the root element, so className, aria-* and event handlers work as usual.

Dependencies

Installed for you by the CLI.

  • class-variance-authority
  • clsx
  • tailwind-merge
  • lib/utils.ts
  • components/ui/icons.tsx
esc

↑↓ to navigate · ↵ to select · esc to close