CardGrid
Tarjetas lado a lado que forman filas: tantas columnas como quepan, una en celulares. Lleva Card, NewCard, ActionCard o PlanCard.
import { CardGrid, CardGridSkeleton } from '@sypnia/ui/react'
En esta página
Proyectos
Código
import { Badge, Card, CardGrid, NewCard } from '@sypnia/ui/react';
// As many columns as fit; one on phones. With a label the grid is a list of projects.
export default function Projects() {
return (
<CardGrid label="Projects" min="14rem">
<Card title="Shop" href="#shop" meta={<><Badge tone="ok" dot>Live</Badge><span>14 tables</span></>}>Orders, products and customers.</Card>
<Card title="Blog" href="#blog" meta={<span>3 tables</span>}>Posts and comments.</Card>
<Card title="Operations" href="#ops" meta={<><Badge tone="warn" dot>Paused</Badge><span>8 tables</span></>}>Stock and suppliers.</Card>
<NewCard onClick={() => {}}>New project</NewCard>
</CardGrid>
);
} En Astro
Código
---
// The Astro twin: with `label` it is a list, so each card goes in an <li>.
import CardGrid from '@sypnia/ui/astro/CardGrid.astro';
import Card from '@sypnia/ui/astro/Card.astro';
---
<CardGrid label="Guides" min="14rem">
<li><Card title="Quick start" href="#q">Your first error, in five minutes.</Card></li>
<li><Card title="Self-hosting" href="#s">Run it on your own servers.</Card></li>
<li><Card title="The agent" href="#a">How fixes are written.</Card></li>
</CardGrid> Skeleton
Código
import { CardGridSkeleton } from '@sypnia/ui/react';
// The grid while its cards load: the same columns, each card with its lines.
export default function Skeleton() {
return <CardGridSkeleton items={3} lines={1} min="14rem" />;
} Cuándo usarlo
Úsalo cuando
- Proyectos, guías, planes.
- Dale un
labelcuando las tarjetas sean una lista de cosas.
No lo uses cuando
- Registros con campos: DataCards los dibuja por ti.
Para todos
- Con un label es una lista, así que los lectores de pantalla dicen cuántas hay.
Props
| CardGrid | Tipo | Por defecto |
|---|---|---|
labelA name for screen readers, when the grid is a list of things. | string | |
minThe narrowest a card gets before the grid has one column fewer. | string | 16rem |
| CardGridSkeleton | Tipo | Por defecto |
|---|---|---|
items | number | 3 |
lines | number | 2 |
min | string | 16rem |