Skip to content
Components / Patterns

Item

A record row for master-detail panes: one stretched target, controls above it, current and selected fills, unread weight.

@fabrials/ui
Loading state

Installation

  1. Import the control from @fabrials/ui, after setting the app up.

    TypeScript
    import { ItemGroup, Item, ItemLink, ItemMedia, ItemContent, ItemTitle, ItemDescription, ItemActions, ItemControl, ItemCheck, ItemUnread, ItemHeader, ItemFooter, ItemSeparator } from "@fabrials/ui";
  2. Or install it under shadcn's name, so code that imports @/components/ui/item gets this control. See shims.

    npx shadcn@latest add @fabrials/item

API reference

Prop / exportTypeDescription
ItemGroup borderedbooleanA ul that is the size container its rows answer to. bordered adds a hairline above the first row; every row carries its own hairline below.
Item currentbooleanThe record open in the detail pane: a soft Stormlight fill and a 2 px bar on the inline-start edge. Give its link current too (aria-current true).
Item selectedbooleanPicked for a bulk action: the fill, no bar. A checked native checkbox inside an ItemCheck does it without this prop.
Item unreadbooleanThe title takes weight 600. Add ItemUnread and a screen-reader word inside the link.
Item stretchbooleanThe link or button of the title covers the whole row and hover paints the row. Controls (ItemActions, ItemControl, ItemCheck) sit above it and stay separate targets. The focus ring is drawn inside the row so a scrolling parent never clips it.
Item variant / sizedefault | outline | muted / default | smoutline and muted are standalone boxed items; default is a row of a list.
ItemLink current / renderboolean | page | true / ReactElementThe stretched target. render={<button />} makes a row that selects instead of navigating (aria-pressed says which); pass the host's router link the same way.
ItemMedia variantdefault | icon | imageLeading visual.

Behavior

The root carries only the row: a 44 px minimum, a hairline below, hover, current and selected. The slots lay themselves out in a row only when they are direct children, so a host that draws its own grid inside the row adds nothing. Below 24rem of the group's width the actions wrap under the text. Never give a slot position, transform or contain: it would become the containing block of the stretched target.

Accessibility

Keyboard and contrast
Keep visible labels, keyboard focus and status announcements when customizing. These components inherit your theme; maintain sufficient contrast in both color modes. The preview is keyboard operable.