Skip to main content

Chart

A picture of numbers: comparison, trend, share or spread.

In Brand expressive

See it live​

Start Storybook to see it live: npm run storybook

When to use it​

In Brand expressive: A relationship in numbers that is part of the campaign story. Not as decoration, or for a single number.

  • Use it when: The story is a relationship in a set of numbers, not a single number.
  • Not when: A table is clearer, the set is too small, or the chart is decoration.

Instead:

  • Table: The numbers as rows; often needed beside the chart.

How Brand expressive uses it​

A number in a table
Use type.body
Not A mono font
Tables are rare and never compared column by column, so mono digits add nothing. The brand font keeps the voice.

Words​

  • Headlines are short and bold. Three to six words.
  • Verbs that move: Join, Try, Go.
  • Playful in headlines, plain in errors.
  • Use: Join, Drop, Go, Love. Avoid: Synergy, Leverage, Kindly.

The labels components use, from the voice tokens:

  • content.action.commit: Go
  • content.action.cancel: Not now
  • content.action.destroy: Remove
  • content.action.retry: Try again
  • content.action.empty-action: Explore the drop

See Voice and tone for the whole voice.

Accessibility and keyboard​

Test before you ship:

  • The same numbers are available as a table or text; color is not the only key. undefined

Use it in code​

npx open-ds add chart

The component reads only component keys and semantic tokens, so it follows the brand and mode on <html>.

Tokens it reads​

Chart reads 18 tokens of its own, each an alias of a semantic token. Each row is one part: its own token, the semantic it aliases, and the value it ends at. Change a semantic and every component that reads it follows; override one of Chart's tokens to change Chart alone.

Changes with theme

Brand expressive decides what changes when you switch theme. Here a switch changes colors only, so the marked rows differ between light and dark; everything else holds steady.

PartIts token and the semantic it aliasesValue
Chart
Text sizecomponent.chart.font-sizetype.caption.font-sizevar(--chart-font-size)font.size.14:0.875rem
Icon
Changes with theme
component.chart.iconcolor.text.mutedvar(--chart-icon)Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A
Icon 2
Changes with theme
component.chart.icon-2color.border.defaultvar(--chart-icon-2)Lighttaupe.light.200:#F2DCCFDarktaupe.dark.100:#33241F
Icon 3
Changes with theme
component.chart.icon-3color.surface.sunkenvar(--chart-icon-3)Lighttaupe.light.100:#FCEFE6Darktaupe.dark.100:#33241F
Weightcomponent.chart.font-weighttype.label.font-weightvar(--chart-font-weight)font.weight.700:700
Gapcomponent.chart.gapcomponent-spacing-map.x2var(--chart-gap)space.8:0.5rem
Cornercomponent.chart.radiusradius.containervar(--chart-radius)radius.24:1.5rem
Border
Changes with theme
component.chart.bordercolor.border.defaultvar(--chart-border)Lighttaupe.light.200:#F2DCCFDarktaupe.dark.100:#33241F
Fill
Changes with theme
component.chart.backgroundcolor.surface.canvasvar(--chart-background)Lighttaupe.light.50:#FFF8F3Darktaupe.dark.0:#120B09
Padding, left and rightcomponent.chart.padding-xcomponent-spacing-map.x3var(--chart-padding-x)space.24:1.5rem
Padding, top and bottomcomponent.chart.padding-ycomponent-spacing-map.x2var(--chart-padding-y)space.8:0.5rem
Shadow
Changes with theme
component.chart.shadowelevation.overlayvar(--chart-shadow)Lightshadow.overlayDarkshadow.overlay-dark
Gap 2component.chart.gap-2space.gap.defaultvar(--chart-gap-2)space.16:1rem
Text
Changes with theme
component.chart.labelcolor.text.mutedvar(--chart-label)Lighttaupe.light.600:#6B544ADarktaupe.dark.400:#B5988A
Label 2
Changes with theme
component.chart.label-2color.text.primaryvar(--chart-label-2)Lighttaupe.light.900:#1F1411Darktaupe.dark.900:#FFF8F3
Gap 3component.chart.gap-3space.gap.groupvar(--chart-gap-3)space.40:2.5rem
Padding, bottomcomponent.chart.padding-bottomcomponent-spacing-map.x3var(--chart-padding-bottom)space.24:1.5rem
Padding, topcomponent.chart.padding-topcomponent-spacing-map.x3var(--chart-padding-top)space.24:1.5rem
From the system
Edge
Changes with theme
color.border.default
straight from the system, through --border
Lighttaupe.light.200 · #F2DCCFDarktaupe.dark.100 · #33241F