Skip to content

Item

hc-item is a generic row primitive: a media slot (icon / avatar), a content column (title + description), and trailing actions. Use it for plain lists, option rows, and as the shared building block that command and menu items can adopt for a consistent look. It is pure CSS — render it as a <div>, <li>, <a>, or <button>.

Quarterly reportUpdated 2 days ago

The media slot and actions are optional; an item can be just a title, or a title + description.

Render the item as an <a> or <button> (or add data-selectable) to get the hover highlight and focus ring. Mark selection with aria-selected (or data-selected).

For a real selectable list use the listbox roles — aria-selected belongs on a role="option" inside role="listbox", not on a bare button:

<ul role="listbox" aria-label="Pick one">
<li class="hc-item" role="option" aria-selected="true" tabindex="-1"></li>
</ul>

In a navigation list, the current page’s link takes aria-current="page" and gets the same selected treatment — see Shell → Sidebar navigation items:

<a class="hc-item" href="/studio" aria-current="page"></a>

data-variant="error" tints the title and media for a destructive row.

  • hc-item carries no role of its own — choose the element for the context: a <button> for an action, an <a> for navigation, an <li> (inside a <ul>/<ol>) for a plain list, or a [role] row inside a composite widget.
  • A decorative media glyph should be aria-hidden="true"; the title is the accessible name.
  • For a selectable list, use aria-selected on items inside an element with the appropriate container role (e.g. role="listbox" + role="option"), not on a bare <div>.
  • Don’t rely on the error tint alone — keep the wording explicit (“Delete project”, “This cannot be undone”).

This primitive is introduced standalone. The following could later be refactored onto it for a consistent row look — as separate changes, not here: hc-menu items, hc-command result rows, and ad-hoc list rows in app code.

Token pathPurpose
item.gapGap between media / content / actions.
item.padding-x / -yRow padding.
item.radiusRow corner radius.
item.fgRow text color.
item.hover-bgHover background (interactive).
item.selected-bg / -fgSelected row colors.
item.media-size / -fgMedia slot size / color.
item.title-fg / -font-weightTitle type.
item.description-fg / -font-sizeDescription type.
Show the generated CSS variables
--hc-item-gap | -padding-x | -padding-y | -radius | -fg
--hc-item-hover-bg | -selected-bg | -selected-fg
--hc-item-media-size | -media-fg
--hc-item-title-fg | -title-font-weight | -description-fg | -description-font-size
  • Menu — dropdown items (a future adopter of this row).
  • Command — command palette rows (a future adopter).
  • Avatar — a common media slot.