Data display
Card
Bordered tiles with a 2px radius, as in the jsonresume.org theme gallery.
import { Card, CardHeader, CardTitle, CardDescription, CardContent, CardFooter, CardMedia } from '@jsonresume/ui'Source(opens in a new tab)
Examples
outline
tone="outline"
Cards hold one idea each.
subtle
tone="subtle"
Cards hold one idea each.
raised
tone="raised"
Cards hold one idea each.
card/tones.tsx
import {
Card,
CardContent,
CardDescription,
CardHeader,
CardTitle,
Grid,
} from '@jsonresume/ui';
export default function CardTones() {
return (
<Grid minColumnWidth="12rem" gap={4}>
{(['outline', 'subtle', 'raised'] as const).map((tone) => (
<Card key={tone} tone={tone}>
<CardHeader>
<CardTitle>{tone}</CardTitle>
<CardDescription>tone="{tone}"</CardDescription>
</CardHeader>
<CardContent>Cards hold one idea each.</CardContent>
</Card>
))}
</Grid>
);
}
Pro
Show code
card/theme.tsx
import {
Button,
Card,
CardContent,
CardFooter,
CardMedia,
CardTitle,
Link,
Text,
} from '@jsonresume/ui';
import * as styles from './theme.css';
export default function ThemeCard() {
return (
<Card interactive className={styles.root}>
<CardMedia>
<img
src="/examples/theme-pro.png"
alt="Pro theme preview"
width={480}
height={360}
/>
</CardMedia>
<CardContent>
<CardTitle>Pro</CardTitle>
<Text size="xs" tone="muted">
by <Link href="https://jsonresume.org">JSON Resume Team</Link>
</Text>
</CardContent>
<CardFooter>
<Button size="sm" fullWidth>
Preview theme
</Button>
</CardFooter>
</Card>
);
}card/theme.css.ts
import { style } from '@vanilla-extract/css';
export const root = style({ width: '15rem' });Accessibility
- CardTitle renders a real heading; set level for the outline (3 by default).
Props
<Card>
| Prop | Type | Default | Description |
|---|---|---|---|
| asChild | boolean | false | |
| interactive | boolean | – | Style variant. |
| tone | outlinesubtleraised | outline | Style variant. |
<CardHeader>
No props of its own; accepts the attributes of the element it renders.
<CardTitle>
| Prop | Type | Default | Description |
|---|---|---|---|
| level | 234 | 3 |
<CardDescription>
No props of its own; accepts the attributes of the element it renders.
<CardContent>
No props of its own; accepts the attributes of the element it renders.
<CardFooter>
No props of its own; accepts the attributes of the element it renders.
<CardMedia>
No props of its own; accepts the attributes of the element it renders.