Skip to Content
Cristal

Layout

Card

Groups content and its actions.

<cr-card>CrCard

Examples

The header (slot="header") and footer (slot="footer") are only displayed when provided.

Mechanical keyboard

Silent switches, white backlight.

View product

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 s size.

API

Properties

PropertyTypeDefaultDescription

Slots

SlotDescription
defaultContenu 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) { … }

PartDescription
bodyLa zone de contenu.
cardLe conteneur.
footerLa zone de pied.
headerLa zone d'en-tête.

On this page