DesignOverviewDesign SystemMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingAgentsCortexMemoryActiveProvenanceActiveContextActiveServicesInsightsGet in touchSource on GitHub
Foundations
Surfaces and separationSeparate each surface from what is behind it with four things: a fill, an
edge, a lift, and space. A design language leads with one of them. Helix leads
with an edge for surfaces on the page and a lift for surfaces above it. A card
has a hairline border and no shadow. A menu has a shadow and a hairline border,
because a shadow cannot show on a black page. The surface ladder below sets the
ground color for each place a surface can sit.The four ways to separate a surfaceFillA ground color different from what is behind itEdgeA borderLiftA shadowSpaceNothing at all. The gap separates itWhen a design system uses two or three of these without a plan, a card can end
up with a border, a shadow, and a tint, each added by someone solving the same
problem again.Helix sets the choice with two pairs of policy tokens:TokenValueFor--helix-border-surfacevar(--helix-border-thin)The border of a surface in the page flow. Set it to zero to separate surfaces with shadows.--helix-shadow-surfacevar(--helix-shadow-none)The shadow of a surface in the page flow. Set it to none to separate surfaces with borders.--helix-border-floatingvar(--helix-border-thin)The border of a surface that floats over content. Set it to zero to separate floating surfaces by their shadow alone.--helix-shadow-floatingvar(--helix-shadow-sm), var(--helix-shadow-lg)The shadow of a surface that floats over content.A floating surface draws a hairline edge and a shadow by default. A shadow is
ink darker than the ground it falls on, so over a dark page it does not show,
and the edge keeps a menu or a popover apart from what it opened over. The edge
is --helix-color-border-floating: border in light mode, and 10% of white in
dark mode.A Tooltip draws neither. Its fill is surface-inverse, the mode's opposite,
which sets it apart from any ground it opens over. A glass or frosted Tooltip
lets the page show through, so it takes the hairline edge every glass surface
draws, --helix-material-border.To make every component shadow-first, set the border pair to zero and give the
shadow pair a value. Reverse them to go border-first. Every Helix surface reads
both pairs, and this is checked. A surface that reads only one pair is easy to
miss. If it reads the shadow token and sets border: none directly, a theme can
change it in one direction and not in the other.The surface ladderA surface's ground color token names where the surface sits:TokenSampleFor--helix-color-backgroundThe page background. Every other surface sits on it.--helix-color-surfaceA surface on the page, such as a card or a panel. The separation policy sets it apart with a fill, a border, or a shadow.--helix-color-surface-raisedA panel raised inside a surface, such as a card inside a card. Its fill is one step down the ramp.--helix-color-surface-overlayA surface over the page, such as a menu, a popover, or a dialog. Its edge and its shadow set it apart.--helix-color-surface-sunkenA recessed surface, such as a track or a groove. Its fill sets it apart. A field reads well.raised goes one step down the ramp. A panel inside a surface has a surface
on every side. Only its fill separates it, and on a white page a fill has to be a
step darker to be seen. A lit row is different: it takes hover, a wash measured
against whatever it sits on. overlay works the other way. Its edge and its shadow separate it, so on
a white page it is white.In dark mode, overlay is the raised rung, #181818, so a menu, a popover,
and a dialog are as dark as a raised panel and set apart by their edge. A shadow
does not show on a black page, so an elevated Card fills a step above overlay
in dark and reads above a filled card: #1e1e1e against #161616 on the page.
Inside a Dialog,
a Drawer, a Popover, or an elevated Card, the rungs are washes of foreground
over the panel: overlay 12%, raised 9%, surface 3%, and border 12%.
Inside a default Card, overlay is 12% and the filled wash 6%. Inside a
filled Card, the rungs are the same washes as in an elevated Card, laid over
the raised rung, since the filled card's own fill is a wash: on the page, a
default Card inside is #1e1e1e, a filled one #242424, and an elevated one
#353535, on the #161616 card. An elevated Card inside any of these reads above
a filled one. A Menu opened from an
elevated Card stands a step above the card, and a Dialog opened over another
Dialog stands 8% above it. Light mode keeps its rungs, where a shadow sets an
overlay apart. An elevated Card inside another card fills the overlay rung in
light too, white on the card's #fafafa.A sunken region restates the border for what it holds. On
surface-sunken, the page's border measures 1.03:1 in light, so an outlined
Card, a Table rule, a Divider, or a field placed there has no visible edge. Mark
the region with data-surface="sunken". It draws the sunken ground and mixes the
border from foreground into it, so an edge stands as far off the well as it
does off the page: 1.23:1 in light and 1.29:1 in dark.<sectiondata-surface="sunken"><helix-cardseparation="outlined">…</helix-card></section>In dark mode, a surface inside a sunken region steps up a rung. The card
rung, #0c0c0c, is darker than the #121212 well, so a Card there would read as a
hole. Inside the region, surface takes the raised rung, #181818, and the
rungs above it step with it: raised is #212121 and overlay is #272727. An
elevated Card, #2d2d2d, still stands above a default one and above a filled
one, #202020, and a menu opened inside stands above both. Light mode keeps its
rungs, where a card is already lighter than the well. Canvas's board is a sunken region too.Using the page color inside a component--helix-color-background is the page color. Do not use it inside a
component./* Wrong. Claims the component is sitting on the page. */
.marker{background:var(--helix-color-background);}Using the page color inside a component assumes the component sits on the page.
That is right only when the component is placed directly on the page.Timeline's marker had this mistake. It was painted the page color to hide the
rail behind it, so it came out darker than any surface other than the page. On a
card, it showed as a black disc. The sparkline's ring terminus had the same
mistake and looked the same.Both looked correct for months, because components are usually built on the
page. The mistake shows on a card, a drawer, a toast, a panel, or a photograph,
and components are not built on any of those.Put the color behind a hook that defaults to the page color. When the component
sits on another surface, the hook can be set to match. Helix requires this of
its own components, and the same applies to anything you build with it.A tone faded toward the page needs no hook. An outlined chart mark, a
Callout's hairline, or a Badge's tint mixes its tone toward
--helix-color-background to make a quieter color of the same tone. That color
is a mark, and it never has to match the ground under it, so it reads as the
tone on a card as it does on the page. A fill that has to disappear into its
ground, such as a marker that hides a rail or a ring around a point, is the page
color itself, and it takes a hook.ContrastThe theme engine measures each ink against the ground it is actually painted
on. The ladder records which pairs occur. For example, foreground on
surface-overlay is a real pair, and foreground-on-primary on surface is
not. A field's fill, well, is translucent, so the text in a field is measured
against the well over each surface. A lit row's fill, hover, is measured the
same way. See Color.