List Item
ListItem provides a composable row for menus and selection controls.
import { RiFolderLine } from '@remixicon/react';
import { ListItem } from '@/components/ui/wideset/list-item/ListItem';
<ListItem>
<ListItem.Prefix>
<RiFolderLine className="size-ws-9" />
</ListItem.Prefix>
<ListItem.Content>
<ListItem.Label>Marketing assets</ListItem.Label>
<ListItem.Description>24 files, edited today</ListItem.Description>
</ListItem.Content>
</ListItem>Installation
pnpm dlx wideset add list-item
Copies the component and any Wideset components it uses into your project.
Examples
Variants
danger marks a row whose action destroys something, such as Delete or Leave team, and keeps it apart from the rest of the menu. Everything else is primary.
import { RiDeleteBinLine, RiFileCopyLine } from '@remixicon/react';
import { ListItem } from '@/components/ui/wideset/list-item/ListItem';
export default function ListItemVariants() {
return (
<div className="gap-ws-2 flex w-[20rem] max-w-full flex-col">
<ListItem variant="primary">
<ListItem.Prefix>
<RiFileCopyLine className="size-ws-9" />
</ListItem.Prefix>
<ListItem.Label>Duplicate</ListItem.Label>
</ListItem>
<ListItem variant="danger">
<ListItem.Prefix>
<RiDeleteBinLine className="size-ws-9" />
</ListItem.Prefix>
<ListItem.Label>Delete project</ListItem.Label>
</ListItem>
</div>
);
}Affixes
A prefix identifies the row (an icon, an avatar, a checkbox); a suffix adds a fact or a control (a size, a shortcut, a switch, a chevron for a submenu). The label truncates first, so both affixes always stay whole.
import { RiArrowRightSLine, RiFolderLine } from '@remixicon/react';
import { Avatar } from '@/components/ui/wideset/avatar/Avatar';
import { Checkbox } from '@/components/ui/wideset/checkbox/Checkbox';
import { ListItem } from '@/components/ui/wideset/list-item/ListItem';
import { Switch } from '@/components/ui/wideset/switch/Switch';
export default function ListItemAffixes() {
return (
<div className="gap-ws-2 flex w-[20rem] max-w-full flex-col">
<ListItem>
<ListItem.Prefix>
<RiFolderLine className="size-ws-9" />
</ListItem.Prefix>
<ListItem.Content>
<ListItem.Label>Marketing assets</ListItem.Label>
<ListItem.Description>24 files, edited today</ListItem.Description>
</ListItem.Content>
<ListItem.Suffix>2.4 MB</ListItem.Suffix>
</ListItem>
<ListItem>
<ListItem.Prefix>
<Avatar size="xs" />
</ListItem.Prefix>
<ListItem.Content>
<ListItem.Label>Anna Kowalska</ListItem.Label>
<ListItem.Description>Product designer</ListItem.Description>
</ListItem.Content>
<ListItem.Suffix>
<RiArrowRightSLine className="size-ws-9" />
</ListItem.Suffix>
</ListItem>
<ListItem>
<ListItem.Prefix>
<Checkbox aria-label="Email digest" />
</ListItem.Prefix>
<ListItem.Label>Email digest</ListItem.Label>
<ListItem.Suffix>
<Switch aria-label="Weekly" />
</ListItem.Suffix>
</ListItem>
</div>
);
}States
Hover, press and keyboard highlight are live; the menu that wraps the row sets data-state="checked" and the highlight for you. Disabled sets aria-disabled, so the row stays readable to screen readers but ignores hover and press.
import { ListItem } from '@/components/ui/wideset/list-item/ListItem';
export default function ListItemStates() {
return (
<div className="gap-x-ws-7 gap-y-ws-3 grid w-[26rem] max-w-full grid-cols-[4.5rem_1fr] items-center">
<span className="typography-caption-md text-ws-static-subtle">Default</span>
<ListItem>
<ListItem.Label>Weekly</ListItem.Label>
</ListItem>
<span className="typography-caption-md text-ws-static-subtle">Selected</span>
<ListItem data-state="checked">
<ListItem.Label>Monthly</ListItem.Label>
</ListItem>
<span className="typography-caption-md text-ws-static-subtle">Disabled</span>
<ListItem disabled>
<ListItem.Label>Daily</ListItem.Label>
</ListItem>
</div>
);
}API reference
ListItem
| Name | Description | Default |
|---|---|---|
data-disabled | Applies disabled styling for consumers such as Radix menu items. boolean | — |
data-state | Selection state. The checked state displays a checkmark when enabled. 'checked''unchecked' | — |
defaultMotion | Turns the component's built-in animations on or off. When omitted, inherits the value from the nearest `MotionProvider`. boolean | true |
disabled | Disables the item and applies disabled styling. boolean | — |
shouldDisplayCheckmark | Allows a checkmark to appear for checked items. Defaults to `true`. boolean | true |
variant | 'primary''danger' | 'primary' |
<div> is passed through to it. See MDN: <div>.ListItem.Content
<div> is passed through to it. See MDN: <div>.ListItem.Description
<div> is passed through to it. See MDN: <div>.ListItem.Label
<div> is passed through to it. See MDN: <div>.ListItem.Prefix
<div> is passed through to it. See MDN: <div>.ListItem.Suffix
<div> is passed through to it. See MDN: <div>.Accessibility
- ListItem is a
divwith no role. Inside Wideset menus the menu supplies roles and keyboard handling. Standalone, give the list semantics yourself (ul>li>ListItem) and, if a row acts on click, a role,tabIndex={0}and Enter/Space handling — or useActionTile, which renders a real<a>or<button>. - A
CheckboxorSwitchin a slot needs its ownaria-label. - Icons in
Prefixare decorative; the label names the row.
| Part | Renders | Description |
|---|---|---|
| ListItemRenders no element | <div> | A composable row used within menus and selection controls. |
| ListItem.ContentRenders no element | <div> | The content surface rendered within `ListItem`. |
| ListItem.DescriptionRenders no element | <div> | Supporting descriptive text. |
| ListItem.LabelRenders no element | <div> | The text label associated with `ListItem`. |
| ListItem.PrefixRenders no element | <div> | Leading slot of the list item, such as an icon, avatar or checkbox. |
| ListItem.SuffixRenders no element | <div> | Trailing slot of the list item, such as a badge, shortcut or chevron. |
import { RiFolderLine } from '@remixicon/react';
import { ListItem } from '@/components/ui/wideset/list-item/ListItem';
<ListItem>
<ListItem.Prefix>
<RiFolderLine className="size-ws-9" />
</ListItem.Prefix>
<ListItem.Content>
<ListItem.Label>Marketing assets</ListItem.Label>
<ListItem.Description>24 files, edited today</ListItem.Description>
</ListItem.Content>
</ListItem>