Interaction
Transition durations, easing curves, focus ring tokens and opacity — for consistent interaction design.
The Interaction System provides tokens for motion, focus indicators and opacity states. How motion is switched and reduced is on the Motion page.
Token Reference
Tokens
Durations
| Key | ms | CSS variable | Use |
|---|---|---|---|
xfast | 75 | --fp-transition-duration-xfast | Press feedback, tiny toggles. Full stylesheet only. |
fast | 100 | --fp-transition-duration-fast | Hover, focus micro-interactions |
normal | 150 | --fp-transition-duration-normal | Default state changes |
slow | 250 | --fp-transition-duration-slow | Enter/exit animations |
xslow | 400 | --fp-transition-duration-xslow | Large enter/exit (drawer, modal). Full stylesheet only. |
Other
| Token | Value |
|---|---|
--fp-opacity-disabled | 0.5 |
--fp-scale-active | 0.98 |
--fp-focus-ring-width | 2px |
--fp-focus-ring-offset | 2px |
--fp-focus-ring-color | var(--fp-primary-text) |
Shorthand aliases (point to the most common values):
| Alias | Resolves to | Use |
|---|---|---|
--fp-transition-duration | --fp-transition-duration-normal | Default duration for most transitions |
--fp-transition-easing | --fp-transition-easing-ease-out | Default easing for most transitions |
Duration Ramp
Five duration steps span micro-feedback through large enter/exit motion. The default theme.css ships fast, normal and slow; xfast and xslow are in the full stylesheet only (theme-full.css, or output.tokens: "full").
| Token | Default | Use |
|---|---|---|
--fp-transition-duration-xfast | 75ms | Micro-feedback (press, ripple, tiny toggles) |
--fp-transition-duration-fast | 100ms | Hover, focus, small toggles |
--fp-transition-duration-normal | 150ms | Default for most state changes |
--fp-transition-duration-slow | 250ms | Enter/exit animations |
--fp-transition-duration-xslow | 400ms | Large enter/exit (drawer, modal, page) |
Easing Curves
The base curves plus a Material-3-inspired semantic set — standard for most UI motion, emphasized for large/expressive motion, each with -decelerate (enter) and -accelerate (exit) partners. Override any curve via interaction.easings. standard-decelerate, standard-accelerate and emphasized-accelerate are in the full stylesheet only; the default theme.css has the rest.
| Token | Value | Use |
|---|---|---|
--fp-transition-easing-ease-out | cubic-bezier(0, 0, 0.2, 1) | Exit/appear transitions |
--fp-transition-easing-ease-in-out | cubic-bezier(0.4, 0, 0.2, 1) | State changes |
--fp-transition-easing-linear | cubic-bezier(0, 0, 1, 1) | Progress, loading bars |
--fp-transition-easing-standard | cubic-bezier(0.2, 0, 0, 1) | Most UI motion |
--fp-transition-easing-standard-decelerate | cubic-bezier(0, 0, 0, 1) | Elements entering |
--fp-transition-easing-standard-accelerate | cubic-bezier(0.3, 0, 1, 1) | Elements exiting |
--fp-transition-easing-emphasized | cubic-bezier(0.2, 0, 0, 1) | Large/expressive motion |
--fp-transition-easing-emphasized-decelerate | cubic-bezier(0.05, 0.7, 0.1, 1) | Emphasized enter |
--fp-transition-easing-emphasized-accelerate | cubic-bezier(0.3, 0, 0.8, 0.15) | Emphasized exit |
--fp-transition-easing-spring | linear(…) | Sampled spring curve |
--fp-transition-easing-spring is the spring below sampled into a CSS linear() easing; --fp-spring-duration is how long it takes to settle (498ms with the default spring).
Focus Ring
| Token | Default | Use |
|---|---|---|
--fp-focus-ring-width | 2px | Outline width for focus indicators |
--fp-focus-ring-offset | 2px | Gap between element and focus ring |
--fp-focus-ring-color | var(--fp-primary-text) | Focus ring color — the -text colour of the configured focusRing.color role |
The focus ring color is configurable via interaction.focusRing.color in theme-config.json. It accepts any color role — "primary", "secondary", "neutral", "success", "danger", "warning" or "info". Default: "primary". It uses the role’s -text token rather than step 9 because that colour is measured against the page, so the ring stays visible even when the brand colour is pale.
State Tokens
| Token | Default | Use |
|---|---|---|
--fp-opacity-disabled | 0.5 | Disabled-state opacity for any element |
--fp-scale-active | 0.98 | Active-press scale effect |
--fp-touch-target-min | 44px | Minimum hit area on coarse pointers |
--fp-touch-target-comfortable | 48px | A roomier hit area |
State-Layer Opacities
Material-3-style overlay opacities. Composite them as currentColor over any surface (via a pseudo-element or layered background) — because they use the text color, they flip with the color scheme automatically instead of needing separate light/dark values. The default theme.css ships hover and press; drag and selected are in the full stylesheet only, so the sample gives selected a fallback.
| Token | Default | Use |
|---|---|---|
--fp-state-hover | 0.05 | Hover overlay opacity |
--fp-state-press | 0.1 | Pressed/active overlay |
--fp-state-drag | 0.14 | Dragged overlay |
--fp-state-selected | 0.08 | Selected overlay |
.item::after {
content: "";
position: absolute;
inset: 0;
background: currentColor;
opacity: 0;
transition: opacity var(--fp-transition-duration-fast) var(--fp-transition-easing-standard);
}
.item:hover::after {
opacity: var(--fp-state-hover);
}
.item:active::after {
opacity: var(--fp-state-press);
}
.item[aria-selected="true"]::after {
opacity: var(--fp-state-selected, 0.08);
}Spring Physics
The engine samples this spring into --fp-transition-easing-spring and --fp-spring-duration, which fp-drawer uses when it settles. Nothing reads stiffness, damping and mass at runtime: they record the spring the curve came from, and only the full stylesheet carries them. Change the spring in interaction.spring, not with these tokens.
| Token | Default | Use |
|---|---|---|
--fp-spring-stiffness | 220 | Higher = snappier |
--fp-spring-damping | 28 | Higher = less overshoot |
--fp-spring-mass | 1 | Higher = more inertia |
--fp-spring-duration | 498ms | Settle time (computed) |
Stagger Delays
Per-item entrance delays for cascade animations. Multiply by the item’s index to offset each item; the FlexPixels list, grid and stack components read the index from --fp-index.
| Token | Default | Use |
|---|---|---|
--fp-stagger-delay | 50ms | Default per-item cascade |
--fp-stagger-delay-fast | 40ms | Tight cascade |
--fp-stagger-delay-slow | 60ms | Loose cascade |
How to Use
Button with transition
.button {
transition:
background var(--fp-transition-duration) var(--fp-transition-easing),
box-shadow var(--fp-transition-duration) var(--fp-transition-easing),
transform var(--fp-transition-duration-fast) var(--fp-transition-easing);
}
.button:hover {
background: var(--fp-primary-10);
}
.button:active {
transform: scale(var(--fp-scale-active));
}Focus indicator
.button:focus-visible {
outline: var(--fp-focus-ring-width) solid var(--fp-focus-ring-color);
outline-offset: var(--fp-focus-ring-offset);
}Disabled state
.button:disabled,
.button[aria-disabled="true"] {
opacity: var(--fp-opacity-disabled);
pointer-events: none;
}Card hover with elevation transition
.card {
box-shadow: var(--fp-elevation-1);
transition: box-shadow var(--fp-transition-duration) var(--fp-transition-easing);
}
.card:hover {
box-shadow: var(--fp-elevation-2);
}Reduced Motion
There is no reduced-duration token. Motion is controlled by the switches — --fp-transitions, --fp-animations and --fp-motion-scale — and every component folds the OS preference (prefers-reduced-motion: reduce) into them for you: see Motion. The animation durations (--fp-animation-duration-*) are listed there too.
Your own CSS can follow the same switches: generate the mapping for your own scope and multiply your durations by its numbers.
import { generateMotionCSS } from "@flexpixels/cortex";
const css = generateMotionCSS("fp", ".app, .app *");.app .panel {
transition: translate calc(var(--fp-transition-duration-slow) * var(--_motion-time))
var(--fp-transition-easing);
}Common Examples
Smooth dropdown open/close
.dropdown {
opacity: 0;
transform: translateY(-4px);
transition:
opacity var(--fp-transition-duration) var(--fp-transition-easing),
transform var(--fp-transition-duration) var(--fp-transition-easing);
}
.dropdown[aria-expanded="true"] {
opacity: 1;
transform: translateY(0);
}Loading spinner with linear easing
.spinner {
animation: spin 1s var(--fp-transition-easing-linear) infinite;
}Configuration
{
"interaction": {
"opacityDisabled": 0.5,
"durations": {
"xfast": 75,
"fast": 100,
"normal": 150,
"slow": 250,
"xslow": 400
},
"easings": { "standard": [0.2, 0, 0, 1] },
"states": { "hover": 0.05, "press": 0.1, "drag": 0.14, "selected": 0.08 },
"spring": { "stiffness": 220, "damping": 28, "mass": 1 },
"stagger": { "delay": 50, "delayFast": 40, "delaySlow": 60 },
"focusRing": {
"width": 2,
"offset": 2,
"color": "primary"
},
"scaleActive": 0.98
}
}Every field is optional; a block you leave out, or leave partly empty, gets its defaults. animationDurations is covered on the Motion page.
| Property | Default | Description |
|---|---|---|
opacityDisabled | 0.5 | Opacity multiplier for disabled elements (0–1) |
durations.xfast | 75 | Extra-fast in ms. Micro-feedback (press, ripple). |
durations.fast | 100 | Fast transition in ms. Hover states, small toggles. |
durations.normal | 150 | Normal transition in ms. Standard state changes. |
durations.slow | 250 | Slow transition in ms. Complex enter/exit animations. |
durations.xslow | 400 | Extra-slow in ms. Large enter/exit (drawer, modal, page). |
easings | — | Cubic-bezier override map ([x1,y1,x2,y2]) merged over the semantic set. |
states.hover | 0.05 | Hover state-layer overlay opacity → --fp-state-hover. |
states.press | 0.1 | Pressed state-layer opacity → --fp-state-press. |
states.drag | 0.14 | Dragged state-layer opacity → --fp-state-drag. |
states.selected | 0.08 | Selected state-layer opacity → --fp-state-selected. |
spring.stiffness | 220 | Spring stiffness → --fp-spring-stiffness. Higher = snappier. |
spring.damping | 28 | Spring damping → --fp-spring-damping. Higher = less overshoot. |
spring.mass | 1 | Spring mass → --fp-spring-mass. Higher = more inertia. |
stagger.delay | 50 | Per-item cascade delay in ms → --fp-stagger-delay. |
stagger.delayFast | 40 | Tight cascade delay → --fp-stagger-delay-fast. |
stagger.delaySlow | 60 | Loose cascade delay → --fp-stagger-delay-slow. |
focusRing.width | 2 | Focus ring outline width in px. |
focusRing.offset | 2 | Focus ring outline offset in px. |
focusRing.color | "primary" | Color role for --fp-focus-ring-color. Uses that role’s -text colour. |
scaleActive | 0.98 | Scale on :active press (0–1). |
Best Practices
-
Use the shorthand aliases for the default case.
var(--fp-transition-duration)resolves tovar(--fp-transition-duration-normal); use the named steps when you want a different speed. -
Always use duration tokens, never hardcode
150ms. A theme or a user setting can retime every motion at once; multiply by the motion numbers so the switches reach it. -
Use
ease-outfor most transitions. Elements should arrive quickly and settle — this feels natural. Useease-in-outfor things that move both ways (toggles, slides). -
Use
--fp-focus-ring-colorfor focus indicators. It follows the configured colour role and the theme. Don’t hardcode--fp-primary-9. -
Test every level. Set
--fp-transitionsand--fp-animationstoreducedandnoneon:root, and emulateprefers-reduced-motion: reduce(Chrome DevTools: Rendering panel → Emulate CSS media feature). -
Active scale (
0.98) should be subtle. The press effect should feel tactile, not dramatic. Don’t change this to values below0.95. -
Focus rings must be visible on all interactive elements. Use
--fp-focus-ring-width,--fp-focus-ring-offset, and--fp-focus-ring-colorconsistently. Never setoutline: nonewithout a replacement.