Skip to content
Haze UI

Item

List row with optional media, a truncating title and description, optional actions and an optional whole-row link.

pnpm dlx shadcn@latest add @haze/item
Open preview in a new tab
Liveno JavaScript

When to use

  • Rows of files, people, repositories or settings, each with an icon or avatar and a short description
  • A row where the whole area opens a page; add a tag or plain text on the right if needed
  • A row with a button on the right and no link
  • A bordered row that stands alone, using the outline variant

When not to use

  • Comparing many fields across rows; table aligns columns
  • A big content box with a header and footer; use card

Installation

Add the Haze registry to components.json once, then install Item with the shadcn CLI. Works in any Astro project with Tailwind CSS v4.

pnpm dlx shadcn@latest add @haze/item
First time? Registry and theme setup

1. Add to components.json:

{
  "registries": {
    "@haze": "http://localhost:4329/r/{name}.json"
  }
}

2. Install the theme once: npx shadcn@latest add @haze/theme, then import it after Tailwind in your global CSS:@import "./haze.css";

API reference

PropTypeDefaultDescription
title*string–Row title, cut off with an ellipsis when too long. A link when href is set.
descriptionstring–Muted line under the title, cut off with an ellipsis when too long.
hrefstring–Makes the title a link whose click area stretches over the whole row through an after: pseudo-element, and adds a hover fill and a trailing chevron. A linked row should not contain a button.
variant"default" | "outline""default"default has no border; outline draws a bordered panel.
classstring–Extra classes on the row.
media slotslot–Avatar, icon or thumbnail at the left edge. For an icon, wrap it in a 36 px chip: size-9 rounded-lg bg-foreground/5 inset-ring inset-ring-border.
actions slotslot–A tag or text at the right edge of a linked row, or buttons in a row with no link. It sits above the link overlay.

Keyboard interactions

Tab, Enter
Focus the row link and follow it; buttons in the right slot of an unlinked row are separate tab stops

Accessibility

  • The title and description truncate with an ellipsis instead of wrapping; a linked row shows a chevron that nudges on hover.
  • Renders a <div>. To make a list, wrap several items yourself in <ul role="list"> with an <li> each, so the count is announced.
  • Only the title is a link, so a screen reader hears one link per row with the title as its name instead of the whole row text.
  • A row is either a link or holds buttons, never both: a button inside a link is nested interactive content. The actions slot sits above the stretched link (z-10), which suits non-interactive content such as a tag.
  • The chevron is decorative and aria-hidden.

Notes for AI

Copy into Claude Code, Cursor, Codex or any coding agent. Agents can also read the Markdown version of this page.

  • Install and use

    Install the Haze UI component "Item" with `npx shadcn@latest add @haze/item`. If components.json has no "@haze" registry yet, add "registries": { "@haze": "http://localhost:4329/r/{name}.json" }. If src/styles/haze.css does not exist yet, run `npx shadcn@latest add @haze/theme` once and import it from the global stylesheet after Tailwind. The CLI stops at an overwrite question when a Haze file already exists and differs, even with --yes, and then installs nothing after it: read its output. If the user has not edited their Haze files, re-run with --overwrite to take the registry versions; if they have, ask them before overwriting. Then import Item from "@/components/haze/ui/item.astro" (or the relative path) and render it where it fits the page. Keep Haze token classes (bg-background, text-muted-foreground, border-border...) and never hardcode colors. Docs: http://localhost:4329/ui/item.md

  • Customize with real content

    Adapt the Haze item ui for our product. Replace the demo values of these props with our real content: title, description, href, variant, class, media slot, actions slot. Keep the layout, the heading level rules and these accessibility details: The title and description truncate with an ellipsis instead of wrapping; a linked row shows a chevron that nudges on hover. Renders a <div>. To make a list, wrap several items yourself in <ul role="list"> with an <li> each, so the count is announced. Only the title is a link, so a screen reader hears one link per row with the title as its name instead of the whole row text. A row is either a link or holds buttons, never both: a button inside a link is nested interactive content. The actions slot sits above the stretched link (z-10), which suits non-interactive content such as a tag. The chevron is decorative and aria-hidden. Do not add raw color classes; use the Haze tokens.

  • Choose the right block

    Before using item, check it fits: use it when rows of files, people, repositories or settings, each with an icon or avatar and a short description; a row where the whole area opens a page; add a tag or plain text on the right if needed; a row with a button on the right and no link; a bordered row that stands alone, using the outline variant. Avoid it when comparing many fields across rows; table aligns columns; a big content box with a header and footer; use card. Alternatives: @haze/card, @haze/table, @haze/avatar.

Dependencies

  • npm: @lucide/astro
  • @haze/utils
  • @haze/theme (one-time setup)

Source · Original Haze UI work.

Catalog

↑↓ moveEnter openEsc close

Keyboard shortcuts

CtrlK
Command palette
/
Focus search
←↑→↓
Move between cards
jk
Next / previous card
ci
Copy code / install command (detail page)
[]
Previous / next entry
?
This help
Esc
Close dialog