This page as markdown: /entity.md · Index for agents: /llms.txt · Everything in one file: /llms-full.txt
Entity
Status: stable
A list-row record: leading visual + title/subtitle column + trailing action, with truncating text. Presentational by default (no hover); interactive rows gain the hover highlight, focus ring, and keyboard activation, and selected marks the current one. Compact/comfortable density.
Keywords: entity, identity, object, avatar row
Usage
Use Entity to show a compact identity block for a person, organization, file, project, or other object.
Best practices
- Do: Use a clear title and one or two useful metadata lines.
- Do: Pair with Avatar or Badge (dot for a status) when identity needs state or type.
- Do: For a list, stack Entity rows directly in a column; each row owns its padding. For a list in a card, put the rows in CardList, which insets them to the card's own padding and divides them, so the rows line up with the card's header instead of being tuned by hand with px-* classes.
- Don't: Do not use Entity for long descriptions, editable fields, or full card content.
- Don't: Do not wrap an Entity in your own or router Link to make it navigate. The trailing action would nest inside the link, which is invalid and unreachable by keyboard. Pass interactive with render={} instead: the row's target becomes the link and the action stays outside it.
Props
| Name | Type | Default | Description |
|---|---|---|---|
| leading | ReactNode | — | Leading visual — typically an Avatar or an Icon. |
| title | ReactNode | — | Primary line (text-title-sm, truncated). Required. |
| subtitle | ReactNode | — | Secondary line (text-body-sm muted, truncated). |
| subtitleWrap | boolean | false | Let the subtitle wrap instead of truncating, when it is a description rather than a label. |
| action | ReactNode | — | Trailing slot — typically a ghost icon Button or a StatusDot. |
| interactive | boolean | false | Make the whole row a target: the leading visual and text become a native |
| onSelect | () => void | — | Activation handler for an interactive row (fired on click and Enter/Space). Optional when render makes the row a link. |
| render | useRender.RenderProp | — | Interactive rows only: render the row's target as another element, typically the router's link (render={}) so a list–detail row navigates. Defaults to a |
| selected | boolean | false | Interactive rows only: the current row of a selectable list (the record open in a list–detail view). Sets aria-current on the row's target ("page" when render makes it a link, "true" for a button) and paints the selected fill, a step off the surface the row sits on, which holds on hover. |
| density | "compact" | "comfortable" | "compact" | Row padding: compact (12px × 10px, the default) or comfortable (16px × 12px), on the spacing scale. The insets read --entity-px / --entity-py first, which CardList sets from the card's own padding so rows in a card line up with its header. |
Variants
- density: compact, comfortable
Tokens used
accent, accent-foreground, foreground, muted-foreground, ring
Motion
- arrival · Root · no motion — Rows arrive with the list they belong to. Entering one at a time is a stagger, and a stagger on a list someone opened to scan is a delay.
- response · Root ·
motion-interactive— Only the interactive row reacts: its hover fill, a step off the surface it sits on, eases in. A static row never fakes clickability, and an interactive one answers the pointer without flicker as it moves down a list. - transition · Root ·
motion-interactive—selectedeases the fill onto the current row of a list–detail view, so opening another record reads as the selection moving rather than two rows flashing. - activity · Root · no motion — A record row has nothing of its own to wait for. A row whose action is pending puts a loading Button in
action.
Accessibility
- Default rows are presentational layout; semantics come from the content you place in title/subtitle/action.
- interactive rows render a real
- Give any interactive action an accessible label (e.g. aria-label on a ghost icon Button).
- A selected row announces aria-current on its target ("true" on a button, "page" on a link, detected from an or a render element with href or to), so the current record is spoken, not only shown by its fill.
Related
- Components: Avatar, Badge
Examples
Person row
import { Avatar, Button, Entity, Icon } from "@sableui/react"
<Entity leading={<Avatar fallback="AM" />} title="Alex Morgan" subtitle="@alex" action={<Button variant="ghost" size="icon" aria-label="More"><Icon name="ellipsis" /></Button>} />
Row that navigates
import { Avatar, Button, Entity, Icon } from "@sableui/react"
<Entity interactive selected={active} render={<a href="/people/alex" />} leading={<Avatar fallback="AM" />} title="Alex Morgan" subtitle="@alex" action={<Button variant="ghost" size="icon" aria-label="More"><Icon name="ellipsis" /></Button>} />
Interactive (selectable) row
import { Avatar, Entity } from "@sableui/react"
<Entity interactive onSelect={() => selectUser(user)} leading={<Avatar fallback="AM" />} title="Alex Morgan" subtitle="@alex" />