DesignOverviewDesign SystemMapsGraphIntroductionInstallationDeriving a themeSandboxTheme builderVisual testingAgentsCortexMemoryActiveProvenanceActiveContextActiveServicesInsightsGet in touchSource on GitHub
Foundations
MotionDuration and easing tokensTokenValue--helix-duration-instant0ms--helix-duration-fast120ms--helix-duration-normal200ms--helix-duration-slow320ms--helix-duration-turn0.8s--helix-duration-crawl4s--helix-duration-fade120msTokenValue--helix-easing-standardcubic-bezier(0.2, 0, 0, 1)--helix-easing-emphasizedcubic-bezier(0.3, 0, 0, 1.2)--helix-easing-deceleratecubic-bezier(0, 0, 0, 1)--helix-easing-acceleratecubic-bezier(0.3, 0, 1, 1)--helix-easing-cyclecubic-bezier(0.42, 0, 0.58, 1)--helix-easing-springlinear(0, 0.006, 0.025, 0.101, 0.539, 0.826, 0.976, 1.037, 1.043, 1.026, 1.006, 0.997, 1)Helix has seven durations and six curves. instant, fast, normal, and
slow time a change that answers a hand. fade is the fade a panel keeps
while motion is reduced. turn is one revolution of a spinner, and crawl is
the same revolution while motion is reduced, so a busy ring still turns
slowly.Use each curve for one kind of movement:
standard for most movement
decelerate for something arriving, such as a Dialog, a Drawer, or a Toast
accelerate for something leaving
cycle for a loop that repeats, such as a pulse or a loading sweep
emphasized for a floating panel opening from its trigger, such as a
Popover or a Menu, and for a marker that travels to a new place, such as the
indicator under the selected tab
spring for the few places where overshoot looks responsive and does not
look like a bug
The theme engine takes a motion intent input. Use it to make every component
faster or slower at once.Each component handles reduced motionThe base layer has a global rule that caps animation and transition durations
when a user has asked for reduced motion. The global rule does not apply
inside any component.*,*::before,*::after{… }The * selector does not cross a shadow boundary. The rule applies to your
prose, your layout, and the base layer's own recipes. It does not apply to any
component that draws inside a shadow root, which is almost every Helix
component. A custom property does cross that boundary, so under the setting
Helix takes its duration tokens down to almost nothing, and every transition
written with them stops. A component with an
animation of its own handles prefers-reduced-motion in its stylesheet.The same applies to your own components. If you write a component with a shadow
root, the global rule does not cover it. This comes from how * works in CSS,
so it applies outside Helix too. It is the easiest accessibility regression to
ship without noticing.@media(prefers-reduced-motion:reduce){:host{animation:none;transition:none;}}What reduced motion changesSome transitions show a relationship, such as a panel that slides out of the
control that opened it. Others are decorative, such as a floating effect. With
reduced motion, Helix removes decorative movement. It sets fast, normal,
and slow to 0.01ms, so a panel appears in its final place at once. The
transition still runs that long, so transitionend still fires. A Tooltip, a
Toast, and a panel that opens from a field or a Menu still fade in and out over
fade, 120ms, with no movement.Anything that moves continuously without input stops completely:
The aura shader
Marquees
The pulse loader
The light on a Border Beam, whose edge is then lit steadily
The turning Loader slows to one turn every four seconds. A loader that stops
looks broken, and the turn still shows that work is in progress. The pending
ring on IconButton slows the same way.Pause the page's motionMotion that starts by itself and runs longer than five seconds needs a way to
pause it, under WCAG 2.2.2. Motion Toggle pauses all of it on the page at
once, and a second press lets it run again:<helix-motion-toggle>Pause motion</helix-motion-toggle>While the page's motion is paused:
Carousel stops rotating under autoplay.
Video pauses a video that started itself, and plays it again after.
Aura, Orb, and Strands hold the frame they show.
A graph that connectGraph lays out stops where its notes stand, and its
three.js view stops turning.
A map layer's frames stop on the frame they show.
The 3D charts and Heatmap stand at their readings, and a growth or a move
already running ends where it was heading.
The choice is the page's, held on the document element as
data-helix-motion="paused". Set it in your markup to start the page paused,
or call pauseMotion from @fusion.dev/helix-core, and select on the
attribute to pause motion of your own:import{pauseMotion}from'@fusion.dev/helix-core'pauseMotion()pauseMotion(false)With reduced motion set, Carousel and Video do not start by themselves,
and a graph lays out its notes with the drawing hidden, then shows them where
they settle.A graph layout that runs past five seconds also offers its own button, in the
graph's frame, that stops it where the notes stand.Rows, tags, and items that moveWhen you sort, add, remove, or hide the rows of a List, the tags of a
Tag.Group, the items of a Tree, the rows of Notifications, or the entries
of a Timeline, each one slides from where it was to where it is now. A tree's branch carries its rows with it. A Table or a Data
Table that sorts moves its rows the same way, each row's cells together, and a
Data Table needs row-key to know a row across the change. A row, a tag, or an
item you add fades in. A list you render again with all new elements appears
at once.Each family times the move from two hooks of its own, which the styled tier
sets from the tokens:HookDefault--list-move-duration, --tag-group-move-duration, --tree-move-duration, --table-move-duration, --data-table-move-duration, --notifications-move-duration, --timeline-move-duration--helix-duration-normal--list-move-easing, --tag-group-move-easing, --tree-move-easing, --table-move-easing, --data-table-move-easing, --notifications-move-easing, --timeline-move-easing--helix-easing-standardSet them on the element to change one list, or on a selector to change many:helix-list{--list-move-duration:320ms;--list-move-easing:var(--helix-easing-spring);}0ms turns the move off. The headless tier sets none of the hooks, so its
rows do not move until you set them. With reduced motion set, nothing moves,
even where a hook holds a duration of its own.Toast makes room for a message and closes the gap after one in its own
stylesheet, so its stack has no hooks of this kind.The wash under the pointerIn Navigation, Tabs, and Toggle Group, the hover wash is one shape that
glides from item to item as a mouse or pen moves along the row, and fades out
when the pointer leaves. It takes the place of each item's own wash, in the
same color, from --navigation-item-hover-background-color,
--tabs-tab-hover-background-color, or
--toggle-group-hover-background-color. Arriving from outside the row, it
appears under the pointer without sliding. A touch draws no wash, and under
reduced motion the wash moves at once.In Menu, the wash marks the row with focus, so it glides as the pointer or
the arrow keys move focus, and holds while the pointer crosses a divider. It
reads --menu-item-hover-background-color, and a danger row keeps its own
hue. A submenu that opens beside its row lights its own rows.Focus that travelsIn Toolbar, Tabs, and Toggle Group, the focus ring is one ring that
travels from control to control as the arrow keys move focus, so the eye can
follow it along the strip. It is each control's own ring, with its corners and
its offset, and it shows at full strength in the frame focus arrives. It
follows only focus that shows, so a click draws none. Under reduced motion it
moves at once, and under forced colors each control draws its own system ring.Loading that ends in placeA Skeleton around content crossfades to it when you take loading off. The
placeholder fades out as the content fades in, in the same place, and the
box's height moves from the placeholder's to the content's over the same beat,
so nothing below it jumps. Setting loading again crossfades back. Where the
content is not on the page until it loads, draw the placeholder yourself in
the skeleton's placeholder slot, laid out as the content will be, and put the
skeleton inside the card that holds it so the card's edge moves with the box.
The move takes --skeleton-reveal-duration, --helix-duration-slow by
default, along --skeleton-reveal-easing, --helix-easing-standard by
default, and 0ms turns it off. Under reduced motion the height changes at
once and the two sides crossfade over --helix-duration-fade.Swipes that carry throughA touch or a pen drags a Toast toward the edge its stack sits at, and a
Drawer toward the edge it came from. The surface follows the finger, and past
its open end it gives less and less. On release it keeps the speed it had. A
quick flick dismisses from any distance and carries the surface off the window
at that speed. A slow drag past halfway dismisses too, and the surface gathers
pace as it goes. A shorter drag springs back to rest along
--helix-easing-spring, with its speed carried in. A dismissal goes through
the component's own close, so a page that cancels helix-before-close or
helix-dismiss sends the surface back to rest. While a drag and its release
run, the component has :state(dragging), and a drawer's backdrop fades with
--drawer-drag-progress. Under reduced motion the surface still follows the
finger, and then goes or returns at once. --drawer-release-duration and
--toast-release-duration set the longest a release takes, and 0ms ends it
at once. DragDismissController in @fusion.dev/helix-core gives a component
of your own the same gesture.Figures that countA new value on a Stat or a Trend counts to the new number from the one
before. A screen reader reads only the new number. The count takes
--stat-count-duration or --trend-count-duration, --helix-duration-slow by
default, along --stat-count-easing or --trend-count-easing,
--helix-easing-decelerate by default, so the figure slows as it arrives.
0ms changes the figure at once, as reduced motion does. A figure you put in
the slot changes at once.The number a Progress or a Meter shows under show-value counts the same
way, at the pace of the fill, from --progress-count-duration and
--meter-count-duration, which the styled tier sets from the fill's own
duration. A Badge whose count changes swells and settles over
--badge-bump-duration.Charts that follow their readingsWhen a chart's readings change, its marks move from the old readings to the
new: the bars of a Bar Chart and a Sparkline, the line and area of a
Line Chart, an Area Chart and a Sparkline, the slices of a
Donut Chart, and the points of a Scatter Chart. A Heatmap cell takes its
new color the same way. Every move uses --helix-easing-decelerate, which
never passes the value it is heading for, so no frame draws a reading the data
does not hold. The mark on the end of a line rides with it. Safari does not
transition a path's shape, so lines, areas, points, and the mark on a line's
end there take their new place at once.Set --chart-move-duration and --chart-move-easing on a chart, or on an
element that holds several, to change how long the move takes and its curve.
They default to --helix-duration-normal and --helix-easing-decelerate, and
0s turns the move off. A Line Chart drawing its line on and an
Area Chart fading its wash in take 1.6 times the duration, as they take the
slow token beside the normal one, so 0s stops them too. Under reduced
motion the marks take their new place at once, whatever duration you set.As you move across a chart with the pointer or the arrow keys, what marks the
reading glides from one reading to the next: the guide and the band of a
Line Chart, an Area Chart, and a Bar Chart, the dot and its words on a
Sparkline, and the tooltip of every chart. The glide takes
--chart-glide-duration, --helix-duration-fast by default, along
--helix-easing-decelerate, and 0s places them at once. When the pointer
arrives from outside the chart, or the keys reach it, each is placed on its
reading at once. The tooltip shows the new reading's words as it starts to
move.When a Legend with toggles hides a series, the series fades out where it
stood over --chart-move-duration. A Bar Chart's columns shrink to the
baseline, a stacked segment shrinks to nothing where it stood, an
Area Chart's band closes, and a Donut Chart closes its ring over the slice. The
marks left and the value axis move to fit what is shown: a number that stays on
the axis moves to its new level with its rule, a new number fades in, and a
number the new scale drops fades out. A series shown again fades in and grows
back. The chart's summary and table say what is shown at once. In Safari, a
Line Chart and an Area Chart take the new scale at once with their lines,
and a hidden series still fades. Under reduced motion the reading's marks and a
hidden series take their new place at once.3D charts that grow in and follow their readingsThe 3D charts draw their own marks, in SVG and through three.js, so their
motion runs in script. They are Spatial Bar Chart, Spatial Scatter Chart,
Spatial Ribbon Chart, Spatial Surface Chart, Spatial Treemap, and
Spatial Heatmap. Each mark is known by its name, such as a bar's category
and series, and a new table is matched against the marks drawn:
A mark both tables hold moves from its old reading to its new one, and
slides to its new place.
A mark only the new table holds grows from the floor.
A mark the new table drops shrinks to the floor, and then goes.
The value axis eases to its new range, so a bar does not jump when the scale
changes, and its numbers are the new ones from the start. A surface whose grid
changed shape cannot be matched place for place, and takes its new shape at
once. A three.js drawing draws each frame the chart works out, and holds its
view still while the marks move.A move takes --<family>-move-duration along --<family>-move-easing, such as
--spatial-bar-chart-move-duration. The styled tier sets them to
--helix-duration-normal and --helix-easing-decelerate, as the flat charts
move. The headless tier sets neither, so a new table is drawn at once there.grow grows the marks in the first time the chart comes into view, each
category or column a little after the one before it, and grow-again grows
them again each time the chart comes back into view. The growth keeps its own
timing, a second for each mark, because the page asked for it by name. Under
grow, a later table grows the marks it adds the same way. A Heatmap takes
grow too: each cell starts empty and steps up through the tones to its own,
a column at a time. Its cells already take a new color through the
stylesheet, so it reads no move hooks.Starting styles and view transitionsOverlays use @starting-style to animate in. It sets a starting value and needs
no duration token of its own. The transition that runs from it uses the tokens
above.Helix starts one view transition, when the page changes color mode. A view
transition draws the whole document twice and runs between the two pictures,
so a component that started one for its own sake would cancel the page's own,
or have its own canceled. The color mode belongs to the whole document, so
changing it is the one move that is the document's to make. Theme Toggle and
setColorMode from @fusion.dev/helix-core spread the new mode in a circle
from the button, wipe it across, or fade it, and change it at once under
reduced motion. Any other view transition is yours to start from your own
code, and the next section covers the one most sites want.Moving between pagesA site can move from one page to the next as a fade or a slide. Import the
page transition sheet after helix.css, on every page that takes part:@import'@fusion.dev/helix-styles/helix.css';@import'@fusion.dev/helix-styles/page-transitions.css';A link to another page on the same origin then fades the new page over the
old one, with no script, in browsers with cross-document view transitions.
Other browsers load the new page as before. The sheet stays out of helix.css
because the rule that turns it on speaks for the whole document and cannot be
scoped, so it is a site's choice to make. Under reduced motion the sheet turns
nothing on.For a slide, write data-page-transition="slide" on the html element of the
page being arrived at. The new page comes in from the inline end and the old
one leaves toward the inline start. slide-back travels the other way, for a
step back, and right-to-left pages mirror both. The move takes
--helix-duration-slow.A router that changes the page in place, without loading a new document,
calls changePage from @fusion.dev/helix-core around the change:import{changePage}from'@fusion.dev/helix-core'awaitchangePage(()=>router.show(next),{transition:'slide'})It names the way for the length of the move, changes the page at once under
reduced motion or where the browser has no view transitions, and rejects
where the change does. To keep a header still while the rest of the page
moves, give it a view-transition-name of its own on every page.EffectsThese families exist for their motion. Put your content inside one, or place
it on the page. Each one respects reduced motion, and each that runs by itself
stops while Motion Toggle has paused the page.Light that draws the eye:
Theme Toggle spreads the new color mode
from the button.
Cursor shows another person's pointer on a
shared surface.
Motion on your own elementsSeven functions in @fusion.dev/helix-core give elements you write yourself
the motion Helix's own families have, with no component around them:
moveItems slides the items of a list to their new places.
trackIndicator sends one mark from item to item.
countTo counts a figure to a new number.
followPointer writes where a mouse or pen is over an element.
burstConfetti bursts confetti out of an element once an action is done.
flashChange lights up an element that changed, and fades.
resizeFrom moves an element's height from where it was to where it lays
out next.
Each one works on any element, in any framework, and needs no Helix
stylesheet. Times and curves default to the tokens above, and to the values
those tokens hold where the page does not load them. Under reduced motion
nothing moves, the figure changes at once, the pointer is not followed, and no
confetti is drawn.
moveItems, followPointer, and trackIndicator return the way to stop.Items that movemoveItems watches an element's children. When you or your framework add,
remove, reorder, or hide them, each item slides from its old place to its new
one, and an item you add fades in:import{moveItems}from'@fusion.dev/helix-core'conststop=moveItems(document.querySelector('#tasks'),{leaving:document.querySelector('#tasks-box'),})OptionDefaultitems, a selector or a function returning the itemsthe element's childrenduration, in milliseconds, as a time, or as a custom property--helix-duration-normaleasing, a curve or a custom property--helix-easing-standardleaving, a positioned box around the elementnone, so an item that leaves is gone at oncearriveIntoEmpty, so the first item into an empty list fades infalseA copy of an item that leaves fades out where it was, in the leaving box.
The copy never joins the element's own children, which your framework
manages, so give the box position: relative and put the list inside it.
When every item is new at once, as when a framework draws the whole list
again, the list appears without moving.A mark that travelstrackIndicator places one mark on the item that is marked now, and places it
again whenever an attribute inside the element changes, an item arrives or
leaves, or the element changes size:import{trackIndicator}from'@fusion.dev/helix-core'trackIndicator(document.querySelector('nav'),{active:'[aria-current="page"]',indicator:document.querySelector('nav .mark'),})It writes four custom properties on the mark: --indicator-x,
--indicator-y, --indicator-inline-size, and --indicator-block-size.
Your stylesheet moves the mark with them, so its transition is the move:nav{position:relative;}nav .mark{block-size:var(--indicator-block-size,0);inline-size:var(--indicator-inline-size,0);inset-block-start:0;inset-inline-start:0;opacity:0;position:absolute;transition:translatevar(--helix-duration-normal)var(--helix-easing-emphasized),inline-sizevar(--helix-duration-normal)var(--helix-easing-emphasized),opacityvar(--helix-duration-fast);translate:var(--indicator-x,0)var(--indicator-y,0);}nav .mark[data-placed]{opacity:1;}data-placed is on the mark once it has a place, so it fades in where it
belongs. data-moving is on it while it travels. With nothing marked, the
mark loses data-placed. Call place() on what it returns after a change it
cannot see, such as a new stylesheet, and stop() to end it.A figure that countscountTo counts the number an element shows to a new one, and resolves once
the new figure is written:import{countTo}from'@fusion.dev/helix-core'awaitcountTo(document.querySelector('#revenue'),1284)It counts from the number last counted to, or from the number the element's
text reads. Pass from the first time for a figure written with grouping in
another language. The figure is written in the element's language, or with
format, which takes the number and returns its text. The count takes
--helix-duration-slow along --helix-easing-decelerate, and a new count
started during one carries on from the figure drawn.The element's text changes on every frame, so keep it out of a live region and
tell screen reader users the new number another way.Following the pointerfollowPointer writes --pointer-x and --pointer-y on an element while a
mouse or pen is over it, each from -1 to 1, with 0 and 0 in the middle. A
right-to-left page mirrors --pointer-x. The two go when the pointer leaves,
so give them 0 as the fallback:import{followPointer}from'@fusion.dev/helix-core'followPointer(document.querySelector('.card')).card{rotate:xcalc(var(--pointer-y,0)*-6deg);transition:rotatevar(--helix-duration-normal)var(--helix-easing-standard);}data-following is on the element while the two are written. A touch is not
followed, since a finger is on the element only while it presses. Pass moved
and left to hear the same positions in script.What changedflashChange lights up what changed. Call it on an element after you change
it, such as a cell a live feed updated or a sentence an agent rewrote. A quiet
wash of the info color holds for --helix-duration-slow and fades over twice
that. The wash is drawn over the element's background and under its text, so
nothing moves, and the element looks as it did once the wash is gone. A row is
washed through its cells. A second call on the same element carries on from
the strength drawn. Under reduced motion the wash still shows, since it says
what changed, and it goes over --helix-duration-fade with no rise.import{flashChange}from'@fusion.dev/helix-core'constcell=document.querySelector('#latency')cell.textContent='224 ms'flashChange(cell)Two families do this for you. With flash-changes, a Data Table lights up
each row whose values change when you set rows again, and each row that
arrives, known by row-key, and a Code Editor lights up the lines a new
value or an agent's edit changed, leaving the lines you type alone.
--data-table-flash-color sets a table's wash, and a code editor's follows
the theme's info color.