feat(fuselage): Add the `Item` family
Merged
JU
8d ago+8476+8476+0123456789012345678901234567890123456789-4-4-0123456789
Proposed changes
Adds the Item family to @rocket.chat/fuselage. It's one set of composable parts for any list row made of leading media, a title and description, and trailing actions. This is the Fuselage half of the Item family proposal. Migrating Rocket.Chat to it is a separate PR.
Parts: ItemGroup, ItemGroupHeader, ItemGroupTitle, Item, ItemMedia, ItemIcon, ItemContent, ItemRow, ItemTitle, ItemDescription, ItemMeta, ItemActions, ItemLink, ItemDivider, ItemSkeleton.
- No
sizeprop. A row's height comes from its content: the taller of the media and the text lines, plus padding. With two text lines, the gap widens from 4px to 8px through:has(). inset(sm/md/lg) adds space at the start and end only, so the row lines up with its container's gutter. It never changes the height.- No implied semantics. Every part renders a
divand sets no role. Consumers passis/rolefor the pattern they need: a list (ul/li), a listbox (option) or a menu. The exception isItemLink, which renders anawith a requiredhref; withis="button"thehrefisn't needed. It stretches over the whole row, so actions sit beside it and aren't nested inside the link. ItemActionsas a direct child ofItemspans every line. Inside anItemRow, it only takes space from that line.reveal="hover"shows it on hover or focus, and it's always visible on touch devices.ItemIcon: its label is added to the row link's description, so a screen reader announces "Kenji Takahashi, Away".- States:
selected,highlighted,focused,disabled, plusvariant="danger". normalize.scsskeeps the global link style off.rcx-itemand.rcx-item__link.
Changes after review
- Removed
sizefromItemandItemSkeleton. Height now comes from content.ItemSkeletontakesmediaSizeanddescriptioninstead. ItemActionscan now be placed inside anItemRow.inseton all sides was tried and then reverted. It would make every row that uses it as a gutter 16 to 40px taller.
Testing
- 17 Storybook stories under
Navigation/Item, covering the parts, states, headers, dividers, skeletons and real compositions: sidebar, search results, members, files, menu sections and select options. - Unit tests and snapshots in
Item.spec.tsx. Visual regression snapshots updated. fuselage.api.mdupdated. The changeset is aminorbump.
Further comments
Nothing existing is deprecated or removed here. Replacing SidebarItem, the option and menu item parts, and the old headers and dividers comes in follow-up PRs, as the migration tracker in the proposal lists.
š¤ Generated with Claude Code