DataCards
The same records as DataList, as cards in a grid: when each one has a picture or reads better as a whole. One column on phones.
import { DataCards, DataCardsSkeleton } from '@sypnia/ui/react'
Team members
- ARAna Ruizana@laespiga.co
- Role
- Owner
- Projects
- 4
- Member since
- Mar 2026
- BCBo Chenbo@laespiga.co
- Role
- Developer
- Projects
- 3
- Member since
- May 2026
- LGLucía Gómezlucia@laespiga.co
- Role
- Viewer
- Projects
- 1
- Member since
- Oct 2026
- DMDiego Moradiego@laespiga.co
- Role
- Developer
- Projects
- 2
- Member since
- Nov 2026
Code
import { Avatar, Badge, DataCards, RowActions } from '@sypnia/ui/react';
// The same records as DataList, as cards: each person reads better as a whole, with a picture.
const people = [
{ id: 1, name: 'Ana Ruiz', email: 'ana@laespiga.co', role: 'Owner', projects: 4, since: 'Mar 2026' },
{ id: 2, name: 'Bo Chen', email: 'bo@laespiga.co', role: 'Developer', projects: 3, since: 'May 2026' },
{ id: 3, name: 'Lucía Gómez', email: 'lucia@laespiga.co', role: 'Viewer', projects: 1, since: 'Oct 2026' },
{ id: 4, name: 'Diego Mora', email: 'diego@laespiga.co', role: 'Developer', projects: 2, since: 'Nov 2026' },
];
export default function Members() {
return (
<DataCards label="Team members" rows={people} rowKey={(p) => p.id} min="14rem"
media={(p) => <Avatar name={p.name} size="lg" />} title={(p) => p.name} description={(p) => p.email}
fields={[
{ id: 'role', label: 'Role', value: (p) => <Badge tone={p.role === 'Owner' ? 'light' : 'neutral'}>{p.role}</Badge> },
{ id: 'projects', label: 'Projects', numeric: true, value: (p) => p.projects },
{ id: 'since', label: 'Member since', value: (p) => p.since },
]}
actions={(p) => <RowActions label={`Actions for ${p.name}`} actions={[{ id: 'role', label: 'Change role', icon: 'role', onAction: () => {} }, { id: 'remove', label: 'Remove from the team', icon: 'user-minus', danger: true, onAction: () => {} }]} />} />
);
} Skeleton
Code
import { DataCardsSkeleton } from '@sypnia/ui/react';
// The cards while they load: the same grid, the same fields.
export default function Skeleton() {
return <DataCardsSkeleton items={3} fields={3} media min="14rem" />;
} When to use it
Use it when
- People, products, projects with an image.
- Set
minto the narrowest a card reads well.
Do not use it when
- Records compared column by column: use Table.
For everyone
- It is a list of records; each fact is a term and its value.
- One action stays in the corner of the card; several go under it.
Props
| DataCards | Type | Default |
|---|---|---|
fieldsrequiredThe facts of each record, by name. | DataField<Row>[] | |
labelrequiredA name for screen readers. | string | |
rowKeyrequired | (row: Row) => string | number | |
rowsrequired | Row[] | undefined | |
titlerequiredThe name of each record: the first thing read. | (row: Row) => ReactNode | |
actionsWhat can be done to each record (RowActions). | ((row: Row) => ReactNode) | |
descriptionA second line under the name. | ((row: Row) => ReactNode) | |
emptyWhat to say when there are none. | ReactNode | |
hrefWith it each record is a link. | ((row: Row) => string) | |
loadingThe records are on their way: skeletons of the same shape. | boolean | |
mediaSomething at the start of each record: an Avatar, an icon. | ((row: Row) => ReactNode) | |
minThe narrowest a card gets before the grid has one column fewer. | string | 16rem |
pageSize | number | 12 |
| DataCardsSkeleton | Type | Default |
|---|---|---|
description | boolean | true |
fields | number | 3 |
items | number | 3 |
media | boolean | |
min | string | 16rem |