VisorVisor
ComponentsData Display

Key-Value List

Definition-list display primitive for one record's attributes — label/value pairs in a responsive grid. Values accept any node.

Basic

Plan
Enterprise
Members
142total

Four-up facts panel

The canonical "key facts" row atop a detail page. Each value is an arbitrary node — drop in a Badge, AvatarStack, StatHero, or ScoreIndicator.

Plan
Enterprise
Members
142total
Monthly revenue
$48,200
Health score
98/ 100

Horizontal inspector

orientation="horizontal" places the label beside the value — ideal for a tighter inspector or sidebar.

Slug
atlas-collective
Created
May 11, 2024
Owner
Alma Reyes

Panel Surface

surface="panel" draws the theme's card surface and border around the list, for a facts panel that stands on its own. Inside data-glass="on" (see Glass) the panel turns to glass: the glass layer's fill, lift and blur, with its edge cleared. The label and value keep the theme's ink. A list with no surface never blurs, so it can sit inside a glass tile without a nested blur.

Role
Stage Manager
Stage
The Barn

Inside a Button

as="span" renders spans throughout (root, rows, labels and values), so the list is valid phrasing content inside a <button>, such as a tappable tile. It carries no definition-list semantics; the button's accessible name reads the pairs in order.

<button type="button" onClick={edit}>
  <KeyValueList
    as="span"
    orientation="horizontal"
    items={[
      { label: 'Food', value: 'Three meals a day' },
      { label: 'Access', value: 'All areas' },
    ]}
  />
</button>

Skin and Glass

A theme reshapes the list through the key-value-list hooks: label and value type and ink, the horizontal columns, item gap and alignment, row spacing, padding and divider, and the panel's fill, edge colour, corners and inset. Each falls back to the look above, so a theme that binds none of them draws KeyValueList unchanged. The full list is on Component Tokens.

components:
  key-value-list:
    # FormDeck's Facts panel
    panel-padding: "6px 24px"
    panel-radius: "24px"
    row-gap: "0"
    columns: "minmax(96px, 1fr) 3fr"
    item-gap: "4px 20px"
    item-align: "normal"
    item-padding: "14px 0"
    divider: "1px solid var(--border-default)"
    label-font-size: "13px"
    label-line-height: "24px"
    label-font-weight: "560"
    label-letter-spacing: "0.02em"
    label-text-transform: "none"
    value-font-size: "17px"
    value-line-height: "1.45"
    value-font-weight: "480"
    value-text-wrap: "pretty"

In Five Looks

The Facts panel (surface="panel") and the Backstage itinerary's pairs (as="span", inside a glass tile), each skinned with the Honcho kit's numbers, in each look on the theme picked in the docs. The Photo looks turn glass on over a photo: the panel turns to glass and the bare list inside the tile stays unblurred.

Today
Dark
Dark + Photo
Light
Light + Photo

Installation

npx visor add key-value-list

This copies two files into your project:

  • components/ui/key-value-list/key-value-list.tsx — the component
  • components/ui/key-value-list/key-value-list.module.css — the styles

Usage

import { KeyValueList } from '@/components/ui/key-value-list/key-value-list';
import { Badge } from '@/components/ui/badge';

export default function OrgFacts({ org, members }) {
  return (
    <KeyValueList
      columns={4}
      items={[
        { label: 'Plan', value: <Badge tone="info">{org.plan}</Badge> },
        { label: 'Members', value: members.length, hint: 'total' },
        { label: 'Monthly revenue', value: formatCurrency(org.monthlyRevenue) },
        { label: 'Health score', value: org.healthScore, hint: '/ 100' },
      ]}
    />
  );
}

API Reference

KeyValueListProps

No props data available for “key-value-list”.

Each entry in items is a KeyValueItem: { label: ReactNode; value: ReactNode; hint?: ReactNode }. The component also accepts all standard HTML attributes for the root element (defaults to <dl>).

Accessibility

KeyValueList renders a semantic <dl> with <dt>/<dd> pairs by default, so assistive technology announces each label with its value. Set as="div" only when the surrounding markup already supplies the term/description semantics, and as="span" only inside phrasing content such as a <button>. When a value is itself a graphical or interactive element (a score ring, an avatar stack), give it an aria-label so the pairing stays meaningful without sight.

When to Use

  • The "key facts" panel atop a detail or inspector page (org detail, user detail, billing summary)
  • Rendering a single record's attributes as label/value pairs
  • A 4-up editorial facts row with rich value nodes

When Not to Use

  • Many records in rows and columns — use DataTable
  • A single large KPI figure with delta / trend — use StatCard
  • Editable form fields — use the Field family