Layout
Card
Groups content and its actions.
Examples
The header (slot="header") and footer (slot="footer") are only displayed when provided.
Mechanical keyboard
Silent switches, white backlight.
A card can hold content only, with no header or footer.
import { CrButton, CrCard } from '@cristal-ui/react';
export default function CardBasic() {
return (
<div style={{ display: 'grid', gridTemplateColumns: 'repeat(auto-fill, minmax(220px, 1fr))', gap: 'var(--cr-spacing-lg)', width: '100%' }}>
<CrCard>
<h3 slot="header">Mechanical keyboard</h3>
<p>Silent switches, white backlight.</p>
<CrButton slot="footer" size="s" variant="outline">
View product
</CrButton>
</CrCard>
<CrCard>
<p>A card can hold content only, with no header or footer.</p>
</CrCard>
</div>
);
}Accessibility
- The card is a plain container: choose the heading level of the header according to your page hierarchy.
- Inside a card, buttons use the
ssize.
API
Properties
| Property | Type | Default | Description |
|---|
Slots
| Slot | Description |
|---|---|
| default | Contenu de la carte. |
slot="footer" | Pied, affiché seulement s'il est fourni. |
slot="header" | En-tête, affiché seulement s'il est fourni. |
CSS parts
To style it from outside: cr-card::part(name) { … }
| Part | Description |
|---|---|
body | La zone de contenu. |
card | Le conteneur. |
footer | La zone de pied. |
header | La zone d'en-tête. |