Detail list
Label and value rows for a resource summary.
import { DetailList, DetailRow } from "@unkey/ui";
export default function BasicDetailList() {
return (
<DetailList>
<DetailRow label="Name">orders</DetailRow>
<DetailRow label="Region">us-east-1</DetailRow>
<DetailRow label="Branch">main</DetailRow>
</DetailList>
);
}
Densities
defaulthas a border and dividers. Use it on a page.compacthas a border and tight rows without dividers. Use it for a short summary in a card.flushhas no frame and no horizontal padding. Use it inside a container that already sets the padding.insetis for full-bleed rows in a panel. See Inset in a panel section. The demo below leaves it out.
import { DetailList, DetailRow } from "@unkey/ui";
const densities = ["default", "compact", "flush"] as const;
export default function DetailListDensities() {
return (
<div className="flex flex-col gap-6">
{densities.map((density) => (
<div key={density} className="flex flex-col gap-2">
<span className="font-mono text-gray-11 text-xs">{density}</span>
<DetailList density={density}>
<DetailRow label="Name">orders</DetailRow>
<DetailRow label="Region">us-east-1</DetailRow>
</DetailList>
</div>
))}
</div>
);
}
Examples
Inset in a panel section
inset has no frame and spans the full width of its container. Rows have the same horizontal padding as a slide panel, so dividers reach both edges. Use it inside a slide panel or a dialog body that has no horizontal padding.
The list has dividers between rows but no top border. If the list follows a heading, add border-t to the list, as this example does.
import { DetailList, DetailRow } from "@unkey/ui";
export default function InsetDetailList() {
return (
<div className="flex flex-col gap-1 rounded-lg border py-4">
<h3 className="px-6 font-medium text-base text-gray-12">Credentials</h3>
<DetailList density="inset" className="border-t">
<DetailRow label="Branch">main</DetailRow>
<DetailRow label="Read-write URL">DATABASE_URL</DetailRow>
</DetailList>
</div>
);
}