Home

Figures

Usage

Start with these tokens when customizing figures:

  • --figure-spacing-top and --figure-spacing-bottom for vertical rhythm

  • --figure-max-width (plus mobile/print variants) for breakout width

  • --figure-background, --figure-border-width, and --figure-border-radius for containers

  • --figure-caption-* and --figure-label-* for caption typography

Figure captions and labels use the --figure-caption-* and --figure-label-* tokens, which align with the shared caption/label system for consistent typography.

Tokens

Spacing Tokens

Control vertical separation and layout spacing for figures.

TokenDescriptionDefault Value
--figure-spacing-topTop margin (automatic responsive scaling)var(--content-spacing)
--figure-spacing-bottomBottom margin (automatic responsive scaling)var(--content-spacing)

Layout Tokens

Controls the breakout width behavior for figure containers.

TokenDescriptionDefault Value
--figure-max-widthMaximum width for figure containervar(--content-breakout-width)
--figure-max-width-mobileMax width for figure on mobilevar(--content-breakout-width-mobile)
--figure-max-width-printMax width for figure in print100%

Container Styling Tokens

Optional visual isolation through backgrounds and borders (defaults to minimal appearance).

TokenDescriptionDefault Value
--figure-backgroundBackground colortransparent
--figure-background-darkBackground color for dark modetransparent
--figure-background-printBackground color for printtransparent
--figure-border-widthBorder thickness0
--figure-border-colorBorder colorvar(--border-color-subtle)
--figure-border-color-darkBorder color for dark modevar(--border-color-subtle-dark)
--figure-border-color-printBorder color for printvar(--border-color-default-print)
--figure-border-radiusCorner roundingvar(--border-radius-default)
--figure-paddingInternal padding around figure content0

Content Layout Tokens

Control figure content positioning and width constraints.

TokenDescriptionDefault Value
--figure-content-displayDisplay type for figure contentblock
--figure-content-max-widthMaximum width for figure content100%
--figure-content-margin-horizontalHorizontal margins for centeringauto

Caption Layout and Typography Tokens

Layout and typography styling for figure captions (inherits from caption and label tokens).

TokenDescriptionDefault Value
--figure-caption-font-familyFont family for captionsvar(--caption-font-family)
--figure-caption-font-sizeFont size for captionsvar(--caption-font-size)
--figure-caption-colorText color (automatic dark mode)var(--caption-color)
--figure-caption-spacing-topGap between image and captionvar(--caption-spacing)
--figure-caption-line-heightLine height for caption textvar(--caption-line-height)
--figure-caption-alignText alignment (left, center, right, justify)var(--caption-align)
--figure-caption-max-widthMaximum width for caption textvar(--caption-max-width)
--figure-label-font-weightFont weight for figure labelsvar(--label-font-weight)
--figure-label-font-styleFont style for figure labelsvar(--label-font-style)
--figure-label-colorText color for figure labelsvar(--label-color)

Examples

Default Figures

Standard figure styling with automatic responsive spacing and dark mode support:

:root {
  /* No design token overrides */
}

Figure 1: An example figure demonstrating default styling with a placeholder image and caption.

Isolated Figures

Figures with background and border for enhanced visual separation:

:root {
  --figure-background: var(--surface-sunken);
  --figure-border-width: 1px;
  --figure-border-color: var(--border-color-default);
  --figure-padding: var(--space-4);
  --figure-border-radius: var(--radius-lg);
}

Figure 2: A figure with background, border, and padding to create a distinct visual container.

Scholarly Article Figures

Enhanced spacing and typography for scholarly documents:

:root {
  --figure-spacing-top: calc(var(--content-spacing) * 2);
  --figure-spacing-bottom: calc(var(--content-spacing) * 2);
  --figure-caption-spacing-top: var(--content-spacing);
  --figure-caption-font-size: var(--font-size-xs);
  --figure-caption-line-height: var(--line-height-md);
  --figure-caption-align: justify;
}

Figure 3: Scholarly figures benefit from increased vertical spacing, larger gaps between image and caption, smaller caption font sizes, and justified text alignment for a formal academic appearance.

Centered Captions

Symmetrical layout with centered caption text:

:root {
  --figure-caption-align: center;
  --figure-caption-spacing-top: var(--space-3);
}

Figure 4: Centered captions work well for symmetrical images and formal layouts where the caption should be balanced visually beneath the figure content.

Compact Figures

Reduced spacing for documentation or high-density layouts:

:root {
  --figure-spacing-top: var(--space-4);
  --figure-spacing-bottom: var(--space-4);
  --figure-caption-spacing-top: var(--space-2);
  --figure-caption-font-family: var(--font-family-sans);
  --figure-caption-font-size: var(--font-size-xs);
  --figure-caption-line-height: var(--line-height-xs);
}

Figure 5: Compact figures with minimal spacing, smaller sans-serif captions for technical documentation.

Multi-Paragraph Captions

Captions can contain multiple paragraphs with proper spacing. Using background and borders makes it clear that all paragraphs belong to the figure:

:root {
  --figure-background: var(--surface-sunken);
  --figure-border-width: 1px;
  --figure-border-color: var(--border-color-default);
  --figure-padding: var(--space-4);
  --figure-caption-line-height: var(--line-height-md);
  --figure-caption-spacing-top: var(--space-4);
}

Figure 6: This figure demonstrates multi-paragraph captions. The first paragraph introduces the figure content and provides context.

Subsequent paragraphs maintain consistent spacing through the --figure-caption-spacing-top token, ensuring proper visual hierarchy within the caption while remaining distinct from the image above. The background and border make it clear that both paragraphs are part of the figure.

Tips

Isolation: Use --figure-background and --figure-border-* to add containers; leave them transparent for minimal layouts.

Captions: Use --figure-caption-align and --figure-caption-max-width to control caption readability independently of figure width.

Labels: Figure labels inherit shared label tokens; override --figure-label-* only when you need to break that alignment.

Print overrides: Use --figure-background-print and --figure-border-color-print for print-specific adjustments.

© 2026 Stencila