Skip to content

TkxDescriptions

A read-only key/value detail list — the “view record” screen every admin/CRUD app hand-rolls. Feed it an items array and it lays labels and values out on a column grid, as either a semantic <dl> (default) or a bordered <table> with proper <th scope="row"> label cells.

import { TkxDescriptions } from 'tekivex-ui';
<TkxDescriptions
title="User Info"
extra={<TkxButton size="sm">Edit</TkxButton>}
items={[
{ key: 'name', label: 'Name', children: 'Ada Lovelace' },
{ key: 'email', label: 'Email', children: 'ada@example.com' },
{ key: 'role', label: 'Role', children: 'Admin' },
{ key: 'bio', label: 'Bio', children: 'First programmer.', span: 3 },
]}
/>

Each entry in items:

FieldTypeDescription
labelReactNodeThe key / field name. Strings are sanitized.
childrenReactNodeThe value. Strings are sanitized; nodes render as-is.
keystringOptional stable React key (falls back to index).
spannumberColumns this item stretches across. Default 1.

The default renders a <dl>/<dt>/<dd> list on a CSS grid — light, no lines, labels in textMuted:

<TkxDescriptions items={items} column={2} />

bordered switches to a real <table>: label cells are <th scope="row"> with a surfaceAlt background, value cells are <td>, and everything sits on a border-token grid. When title is set, the table also gets a visually-hidden <caption> for assistive tech.

<TkxDescriptions items={items} bordered size="small" />

layout="horizontal" (default) puts the label beside the value and appends a : after each label in the plain variant; colon={false} removes it. layout="vertical" stacks the label above the value (never shows a colon).

<TkxDescriptions items={items} layout="vertical" bordered />

column takes a number (default 3) or a breakpoint map:

<TkxDescriptions items={items} column={{ xs: 1, sm: 2, lg: 4 }} />

The map resolves via window.matchMedia (sm ≥ 576px, md ≥ 768px, lg ≥ 992px); during SSR the largest defined breakpoint value is used, then the client corrects after mount.

PropTypeDefaultDescription
itemsTkxDescriptionsItem[][]The key/value entries.
titleReactNodeHeader title above the list.
extraReactNodeRight-aligned header slot (e.g. an Edit button).
columnnumber | { xs?, sm?, md?, lg? }3Columns per row, fixed or responsive.
borderedbooleanfalseRender as a bordered <table> grid.
layout'horizontal' | 'vertical''horizontal'Label beside vs above the value.
size'small' | 'middle' | 'large''middle'Cell padding scale.
colonbooleantrueAppend : to labels (horizontal, non-bordered).
labelStyleCSSPropertiesExtra styles for every label cell.
contentStyleCSSPropertiesExtra styles for every value cell.
className / styleApplied to the root element.

The component forwards its ref to the root <div>.