Skip to content

Styling Reference

Cratis Arc React story components use CSS variables and utility classes for theming, spacing, and layout.

Everything on this page is defined in a single stylesheet that ships inside @cratis/arc.react. Import it once, in your Storybook preview:

.storybook/preview.ts
import '@cratis/arc.react/stories/styles.css';

The components do not import the stylesheet themselves. Import it before your own styles, then override the variables and classes below in your CSS.

The color variables switch between the dark and light palettes when the page’s data-theme attribute changes; see theme support. Spacing, radius, and shadow variables are shared by both palettes.

  • --color-text: Primary text color
  • --color-text-secondary: Secondary text color for less important content
  • --color-text-muted: Muted text color for hints and labels
  • --color-background: Main background color
  • --color-background-secondary: Secondary background (cards, inputs)
  • --color-background-tertiary: Tertiary background (hover states)
  • --color-border: Standard border color
  • --color-border-light: Lighter border color for subtle divisions
  • --color-primary: Primary brand color
  • --color-primary-hover: Primary color hover state
  • --color-success: Success state color (typically green)
  • --color-warning: Warning state color (amber)
  • --color-error: Error state color (typically red)
  • --color-info: Info state color (cyan)

Consistent spacing values for padding and margins:

  • --space-xs: 0.25rem (4px)
  • --space-sm: 0.5rem (8px)
  • --space-md: 1rem (16px)
  • --space-lg: 1.5rem (24px)
  • --space-xl: 2rem (32px)
  • --space-2xl: 3rem (48px)
  • --radius-sm: Small border radius
  • --radius-md: Medium border radius
  • --radius-lg: Large border radius
  • --shadow-sm: Subtle shadow for slight elevation
  • --shadow-md: Medium shadow for cards and modals
  • --shadow-lg: Large shadow for prominent elements
  • --font-sans: Sans-serif font family for UI text
  • --font-mono: Monospace font family for code

Pre-built CSS classes you can use directly in your stories.

  • .story-container: Standard container with medium width
  • .story-container-sm: Small container (600px max width)
  • .story-container-lg: Large container (1400px max width)
  • .story-section: Section wrapper with consistent vertical spacing
  • .story-grid: Responsive grid layout
  • .story-card: Card styling with background, border, and shadow
  • .story-divider: Horizontal divider line
  • .story-badge: Base badge style
  • .story-badge-success: Green success badge
  • .story-badge-warning: Amber warning badge
  • .story-badge-error: Red error badge
  • .story-badge-info: Cyan info badge
<div
style={{
padding: 'var(--space-lg)',
backgroundColor: 'var(--color-background-secondary)',
borderRadius: 'var(--radius-md)',
boxShadow: 'var(--shadow-sm)',
}}
>
Custom styled content
</div>
<div className='story-container'>
<div className='story-card'>
<h2>Card Title</h2>
<p>Card content</p>
</div>
</div>
<div className='story-grid'>
<div className='story-card' style={{ borderColor: 'var(--color-primary)' }}>
Custom card with primary border
</div>
</div>
  1. Prefer CSS Variables: Use variables instead of hard-coded colors for theme compatibility
  2. Use utility classes: Reuse the shared classes for common spacing and layout patterns
  3. Semantic Colors: Use semantic color variables (--color-success, etc.) for meaningful states
  4. Consistent Spacing: Stick to the spacing scale (--space-*) for consistent rhythm
  5. Theme Testing: Always test your stories in both dark and light modes