Data List
A key-value pair list for displaying structured metadata. Supports horizontal and vertical layouts, dividers, and staggered entrance animations.
Basic
A semantic key-value pair list for structured metadata display. Supports horizontal (grid) and vertical layouts, dividers, and staggered Framer Motion entrance animations.
- Status
- Active
- Plan
- Pro
- Region
- US East (us-east-1)
- Created
- January 14, 2025
Installation
Install the component via the CLI in one command.
npx @work-rjkashyap/unified-ui add data-listpnpm dlx @work-rjkashyap/unified-ui add data-listnpx @work-rjkashyap/unified-ui add data-listbunx @work-rjkashyap/unified-ui add data-listIf you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.
Or install the full package
Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.
npm install @work-rjkashyap/unified-uipnpm add @work-rjkashyap/unified-uiyarn add @work-rjkashyap/unified-uibun add @work-rjkashyap/unified-uiAnatomy
import {
DataList,
Card,
CardHeader,
CardBody,
} from "@work-rjkashyap/unified-ui";Basic Usage
Pass an items array with term (key) and detail (value) entries. The default orientation is horizontal, which renders a two-column grid aligning all terms and details.
<DataList
items={[
{ term: "Name", detail: "Rajeshwar Kashyap" },
{ term: "Email", detail: "rj@example.com" },
{ term: "Role", detail: "Admin" },
]}
/>Orientations
Horizontal (default)
Terms and details are rendered in a two-column grid. Labels are right-aligned to the first column and values fill the remaining width.
- Full Name
- Rajeshwar Kashyap
- rj@example.com
- Role
- Administrator
- Last Login
- Today at 9:41 AM
- 2FA
- Enabled
Vertical
Terms and details are stacked vertically — the term appears above its detail. Useful for narrow containers or mobile-first layouts.
- Full Name
- Rajeshwar Kashyap
- rj@example.com
- Role
- Administrator
- Plan
- Pro
With Dividers
Set dividers to add horizontal rules between items for visual separation.
- Status
- Active
- Plan
- Pro — $49/month
- Billing Cycle
- Monthly
- Next Invoice
- February 1, 2025
- Payment Method
- Visa ending in 4242
Sizes
Three text size presets for different density contexts.
Small
- Version
- 2.4.1
- License
- MIT
Medium (default)
- Version
- 2.4.1
- License
- MIT
Large
- Version
- 2.4.1
- License
- MIT
| Size | Font Size | Use Case |
|---|---|---|
sm | 12px | Dense metadata panels, table tooltips |
md | 14px | Default — card details, sidebars |
lg | 16px | Prominent info sections |
Rich Detail Values
Both term and detail accept ReactNode, so you can embed badges, links, avatars, or any other component.
Without Animation
Set animated={false} to disable the staggered entrance animation.
<DataList
animated={false}
items={[
{ term: "Name", detail: "Unified UI" },
{ term: "Version", detail: "1.0.0" },
]}
/>In a Card
A common pattern is to place a DataList inside a card for structured detail views.
import { Card, CardHeader, CardBody } from "@work-rjkashyap/unified-ui";
<Card>
<CardHeader>
<h3 className="text-sm font-semibold">Account Details</h3>
</CardHeader>
<CardBody className="p-0">
<DataList
dividers
items={[
{ term: "Account ID", detail: "acct_1Nxyz..." },
{ term: "Plan", detail: "Pro" },
{ term: "Billing Email", detail: "billing@example.com" },
{ term: "Created", detail: "January 14, 2025" },
{ term: "Status", detail: "Active" },
]}
className="px-4 py-2"
/>
</CardBody>
</Card>In a Sidebar Panel
<aside className="w-64 border-l border-border p-4 flex flex-col gap-4">
<h4 className="text-xs font-semibold text-muted-foreground uppercase tracking-wide">
Project Info
</h4>
<DataList
orientation="vertical"
size="sm"
items={[
{ term: "Repository", detail: "unified-ui/design-system" },
{ term: "Branch", detail: "main" },
{ term: "Last commit", detail: "3 hours ago" },
{ term: "CI Status", detail: "Passing" },
]}
/>
</aside>Responsive Layout
Switch between vertical (mobile) and horizontal (desktop) orientations using responsive logic.
import { useMediaQuery } from "@/hooks/use-media-query";
function ResponsiveDataList() {
const isDesktop = useMediaQuery("(min-width: 768px)");
return (
<DataList
orientation={isDesktop ? "horizontal" : "vertical"}
items={profileItems}
/>
);
}Props
DataList
| Prop | Type | Default | Description |
|---|---|---|---|
items | DataListItem[] | — | Required. Array of term/detail pairs to render. |
orientation | "horizontal" | "vertical" | "horizontal" | Layout direction — grid or stacked. |
size | "sm" | "md" | "lg" | "md" | Font size of the list. |
dividers | boolean | false | Whether to render dividing borders between items. |
animated | boolean | true | Whether to enable staggered entrance animation. |
className | string | — | Additional CSS classes on the root <dl> element. |
DataListItem
| Property | Type | Description |
|---|---|---|
term | ReactNode | The key / label (rendered as <dt>). |
detail | ReactNode | The value / content (rendered as <dd>). |
key | string | Optional React key — falls back to the item index if omitted. |
Motion
- Stagger entrance — Items animate in using the
staggerContainer+fadeInpreset combination. Each item fades fromopacity: 0to1with a cascading delay between items. - Reduced motion — Animation is fully disabled when
prefers-reduced-motionis active viauseReducedMotion(). - Set
animated={false}to disable animation globally regardless of user preferences.
Accessibility
- Renders a semantic
<dl>/<dt>/<dd>structure — screen readers announce this as a description list. - Each term (
<dt>) is automatically associated with its detail (<dd>) by DOM proximity. - In horizontal mode,
contentsdisplay is used for CSS Grid layout so the<dt>/<dd>relationship is preserved in the DOM despite visual rearrangement. - Both
termanddetailacceptReactNode— ensure any interactive content within (links, buttons) is keyboard accessible.
Design Tokens
| Token | Usage |
|---|---|
--muted-fg | Term (key) text color |
--foreground | Detail (value) text color |
--border | Divider line color |