KeyValueList
The facts of one thing as names and values side by side: the headers of a message, the details of a connection, the properties of a record. A compound component on a description list (<dl>). For a setting a person changes, use a SettingsRow instead.
import { KeyValueList } from '@adecore/ui';import { KeyValueList } from '@adecore/ui';
export default function KeyValueListDemo() {
return (
<KeyValueList.Root className="w-full max-w-sm">
<KeyValueList.Item>
<KeyValueList.Name>Length</KeyValueList.Name>
<KeyValueList.Value>3 min 45 s</KeyValueList.Value>
</KeyValueList.Item>
<KeyValueList.Item>
<KeyValueList.Name>Tempo</KeyValueList.Name>
<KeyValueList.Value>118 BPM</KeyValueList.Value>
</KeyValueList.Item>
<KeyValueList.Item>
<KeyValueList.Name>Mood</KeyValueList.Name>
<KeyValueList.Value>Warm, unhurried, with a lift in the last chorus</KeyValueList.Value>
</KeyValueList.Item>
</KeyValueList.Root>
);
}<KeyValueList.Root>
<KeyValueList.Item>
<KeyValueList.Name>Tempo</KeyValueList.Name>
<KeyValueList.Value>118 BPM</KeyValueList.Value>
</KeyValueList.Item>
</KeyValueList.Root>Parts
| Part | What it is |
|---|---|
KeyValueList.Root | The list, a <dl>. divided puts a hairline between rows. |
KeyValueList.Item | One row, which holds a name and its value. |
KeyValueList.Name | The name, a <dt>, in the faint text color. icon draws a 12 pixel Lucide icon before it. |
KeyValueList.Value | The value, a <dd>. mono sets it in the monospace face. |
Every part takes the props of its element, plus render to draw another one.
Alignment
The names take the width of the widest one, so every value starts on the same line. A very long name wraps instead of squeezing the values. A value wraps too, also inside a long token or URL.
A long list
divided draws a hairline between rows and spaces them out, for a long list. Without it the rows sit close, for a few facts in a card. mono suits a header, an id or a path.
import { KeyValueList } from '@adecore/ui';
const HEADERS: [string, string][] = [
['From', 'Billing <billing@example.com>'],
['To', 'ada@example.com'],
['Subject', 'Your invoice for September'],
['Message-ID', '<20261005134412.4f8a2c91e7b3@mail.example.com>'],
['DKIM-Signature', 'v=1; a=rsa-sha256; c=relaxed/relaxed; d=example.com; s=mail; h=from:to:subject:date; bh=47DEQpj8HBSa+/TImW+5JCeuQeRkm5NMpJWZG3hSuFU='],
['X-Mailer-Campaign-Identifier', 'autumn-billing-2026']
];
export default function KeyValueListDividedDemo() {
return (
<KeyValueList.Root divided className="w-full max-w-xl">
{HEADERS.map(([name, value]) => (
<KeyValueList.Item key={name}>
<KeyValueList.Name>{name}</KeyValueList.Name>
<KeyValueList.Value mono>{value}</KeyValueList.Value>
</KeyValueList.Item>
))}
</KeyValueList.Root>
);
}Rich content
icon on a name puts a small icon before it. A name and a value also take any content: a status icon, or a row of Pills.
import { Icon, KeyValueList, Pill } from '@adecore/ui';
import { CircleCheck, Globe, KeyRound, Server } from 'lucide-react';
export default function KeyValueListRichDemo() {
return (
<KeyValueList.Root divided className="w-full max-w-md">
<KeyValueList.Item>
<KeyValueList.Name icon={Server}>Host</KeyValueList.Name>
<KeyValueList.Value mono>smtp.example.com</KeyValueList.Value>
</KeyValueList.Item>
<KeyValueList.Item>
<KeyValueList.Name icon={Globe}>Port</KeyValueList.Name>
<KeyValueList.Value mono>587</KeyValueList.Value>
</KeyValueList.Item>
<KeyValueList.Item>
<KeyValueList.Name icon={KeyRound}>Security</KeyValueList.Name>
<KeyValueList.Value>
<span className="inline-flex items-center gap-1.5">
<Icon icon={CircleCheck} size={14} className="text-positive" />
STARTTLS
</span>
</KeyValueList.Value>
</KeyValueList.Item>
<KeyValueList.Item>
<KeyValueList.Name>Tags</KeyValueList.Name>
<KeyValueList.Value className="flex flex-wrap gap-1">
<Pill>billing</Pill>
<Pill>autumn</Pill>
</KeyValueList.Value>
</KeyValueList.Item>
</KeyValueList.Root>
);
}Copying
A person can select and copy a value. The names stay out of the selection.
KeyValueListRootProps, KeyValueListItemProps, KeyValueListNameProps and KeyValueListValueProps are exported types.