Design · Components · Display

Definition List

A spec sheet of terms and details, one hairline per row.

commandsRecord<string, string>
Tab label to command line, in display order.
storageKey?string
Persists the selected tab and keeps every instance with the same key in sync.
onValueChange?(value: string) => void
Called when the user picks a tab.

Installation

Copy the source into components/ui/definition-list.tsx. Registry items that depend on it install it automatically.

components/ui/definition-list.tsx

Usage

import {
  Definition,
  DefinitionAnnotation,
  DefinitionDetails,
  DefinitionList,
  DefinitionName,
  DefinitionTerm,
} from "@/components/ui/definition-list";

export function Example() {
  return (
    <DefinitionList>
      <Definition>
        <DefinitionTerm>
          <DefinitionName>storageKey?</DefinitionName>
          <DefinitionAnnotation>string</DefinitionAnnotation>
        </DefinitionTerm>
        <DefinitionDetails>
          Persists the selected tab across reloads.
        </DefinitionDetails>
      </Definition>
    </DefinitionList>
  );
}

The list opens with a hairline and every row closes with one; a term pairs a mono name with quiet mono annotations, and the details sit below in text. Every API reference on this site renders through these parts.

API Reference

Every part renders its native element and accepts that element's props.

PartElementRole
DefinitionListdlThe sheet, opened by a hairline.
DefinitiondivOne row, closed by a hairline.
DefinitionTermdtThe term line; wraps name and annotations.
DefinitionNamecodeThe term itself, in mono ink.
DefinitionAnnotationcodeA quiet mono note: a type, a default.
DefinitionDetailsddThe description below the term.