AuroraUI. Components. DataDisplay
(Aurora UI v0.1.1)
View Source
DataDisplay family — card, badge, avatar (+ group), stat, description list.
The read-only surface of the kit: containers and primitives for presenting
data rather than collecting it. The recurring theme is picking the correct
semantic element instead of a pile of <div>s, so structure survives with CSS
off and reads correctly to assistive technology.
Semantics
card/1is an<article>(or<section>when it has no self-contained heading). Itsinteractivevariant makes the whole card a single link by stretching one real<a>over the surface — there are never nested interactive elements inside a linked card (that is a WCAG 2.2 name/role trap), so any footer actions must live outside an interactive card.badge/1is a small inline pill. Whenremovable, the remove control is a real<button>with an accessible name — not a clickable<span>.avatar/1renders an<img>with requiredaltwhen asrcis given, and falls back to text initials (marked up so AT still gets the name) when it is not.avatar_group/1stacks avatars and can summarise the overflow as "+N" with an accessible label.stat/1is a KPI. Its delta never relies on color alone: the direction is also stated in visually-hidden text ("increased" / "decreased") and shown with a caret, so "up 12%" is unambiguous in grayscale and forced-colors.description_list/1is a real<dl>with<dt>/<dd>pairs from:itemslots, laid out as a responsive two-column grid that collapses to stacked rows on narrow viewports.
States
Every surface here covers default, hover, and — for the interactive card —
focus-visible and selected. A loading flag renders a skeleton placeholder
(safe to show before data arrives) and components degrade gracefully to an
empty state. All of it is light/dark, reduced-motion, forced-colors, and RTL
safe; the interactive card uses the shared .aui-focusable ring.
Summary
Functions
An avatar image with an initials fallback. When src is set, alt is the
accessible name; without src the component shows initials derived from
name (or alt) while keeping that name available to AT. An optional
status adds a ring, a dot, and visually-hidden status text.
Stacks avatars into an overlapping cluster. Pair with a manual "+N" badge,
or set max-aware markup upstream; the group carries an accessible name.
A small status/label pill. Supports variant, size, an optional leading
dot, and a removable mode whose remove control is a real, labelled button.
A surface container with optional header, media, body, and footer slots.
A semantic description list: a real <dl> with <dt>/<dd> pairs, laid out
as a responsive two-column grid that stacks on narrow screens.
A KPI block: label, big value, an optional delta with an accessible direction, and a description. The trend is conveyed with a caret and hidden "increased/decreased" text so it never depends on color alone.
Functions
An avatar image with an initials fallback. When src is set, alt is the
accessible name; without src the component shows initials derived from
name (or alt) while keeping that name available to AT. An optional
status adds a ring, a dot, and visually-hidden status text.
Examples
<.avatar src="/u/ada.jpg" alt="Ada Lovelace" status="online" />
<.avatar name="Grace Hopper" size="lg" />Attributes
src(:string) - image URL; when absent, initials are shown. Defaults tonil.alt(:string) - accessible name. Required withsrc; used to derive initials without one. Defaults tonil.name(:string) - full name; used to compute fallback initials. Defaults tonil.size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".shape(:string) - Defaults to"circle". Must be one of"circle", or"square".status(:string) - Adds a status ring + dot with an accessible label. Defaults tonil. Must be one ofnil,"online","away","busy", or"offline".- Global attributes are accepted.
Stacks avatars into an overlapping cluster. Pair with a manual "+N" badge,
or set max-aware markup upstream; the group carries an accessible name.
Examples
<.avatar_group label="Project members">
<.avatar name="Ada Lovelace" />
<.avatar name="Grace Hopper" />
<span class="aui-avatar-group__overflow" aria-hidden="true">+3</span>
</.avatar_group>Attributes
max(:integer) - Cap the visible avatars; the rest become a +N pill. Defaults tonil.label(:string) - accessible name for the whole group (role=group). Defaults tonil.- Global attributes are accepted.
Slots
inner_block(required) - theavatar/1items.
A small status/label pill. Supports variant, size, an optional leading
dot, and a removable mode whose remove control is a real, labelled button.
Examples
<.badge variant="success" dot>Live</.badge>
<.badge removable on_remove={JS.push("drop", value: %{id: 7})}>Tag</.badge>Attributes
variant(:string) - Defaults to"neutral". Must be one of"neutral","info","success","warning","danger", or"accent".size(:string) - Defaults to"md". Must be one of"sm","md", or"lg".dot(:boolean) - Show a leading status dot. Defaults tofalse.removable(:boolean) - Render a real remove button; wire it withon_remove. Defaults tofalse.on_remove(:any) - phx-click event/JS for the remove button. Defaults tonil.remove_label(:string) - Defaults to"Remove".- Global attributes are accepted.
Slots
inner_block(required)
A surface container with optional header, media, body, and footer slots.
With interactive and a destination, the entire card becomes one clickable
link via a stretched anchor — do not place other interactive controls inside
it. elevation sets the resting shadow; selected marks the current card.
When not to use
If the card needs several independent actions (buttons, links), keep it non-interactive and let those controls be the interactive elements.
Examples
<.card>
<:header><h3>Weekly report</h3></:header>
<:body>Everything nominal.</:body>
</.card>
<.card interactive navigate={~p"/reports/42"} link_label="Open report 42">
<:header><h3>Report #42</h3></:header>
</.card>Attributes
elevation(:string) - resting shadow depth. Defaults to"sm". Must be one of"flat","sm", or"md".interactive(:boolean) - Make the whole card a single link. Requiresnavigate/patch/href. Defaults tofalse.selected(:boolean) - Marks a chosen card (aria-current). Defaults tofalse.loading(:boolean) - Render a skeleton placeholder. Defaults tofalse.navigate(:string) - Defaults tonil.patch(:string) - Defaults tonil.href(:string) - Defaults tonil.link_label(:string) - accessible name for the stretched link when the header text is not enough. Defaults tonil.- Global attributes are accepted.
Slots
header- title area; rendered in a <header>.media- edge-to-edge media (image/video) above the body.body- main content.footer- actions or metadata; omit inside an interactive card.inner_block- shorthand body when the :body slot is not used.
A semantic description list: a real <dl> with <dt>/<dd> pairs, laid out
as a responsive two-column grid that stacks on narrow screens.
Examples
<.description_list>
<:item term="Plan">Pro</:item>
<:item term="Renews">March 1, 2026</:item>
</.description_list>Attributes
- Global attributes are accepted.
Slots
item- one term/description pair. Accepts attributes:term(:string) (required) - the <dt> text.
A KPI block: label, big value, an optional delta with an accessible direction, and a description. The trend is conveyed with a caret and hidden "increased/decreased" text so it never depends on color alone.
Examples
<.stat label="Monthly revenue" value="$48,120" delta="12%" trend="up"
description="vs. last month" />Attributes
label(:string) (required) - what the number measures.value(:string) (required) - the headline value (pre-formatted).delta(:string) - change magnitude, e.g. "12%". Pair withtrendfor direction. Defaults tonil.trend(:string) - direction ofdelta; also emitted as visually-hidden text, not color alone. Defaults to"flat". Must be one of"up","down", or"flat".description(:string) - supporting context under the value. Defaults tonil.loading(:boolean) - Render a skeleton placeholder. Defaults tofalse.- Global attributes are accepted.