Fusion UI LogoFusion UI Logo
Fusion UI LogoFusion UI Logo
/
Getting Started
Concepts
Components
Example Apps
Getting Started
Concepts
Components
Example Apps
Fusion UI LogoFusion UI Logo
Getting Started
Concepts
Components
Example Apps
Overview
Foundations
Color
Typography
Spacing & Radius
Core Concepts
Surfaces & Elevation
States
Nesting
Views & Offsets
Animations
Touch & Mobile

States

Hover, focus, pressed, selected, activated, disabled and loading.

Overview

States tell people how an element reacts and what it currently is. They are expressed with overlays of different opacity, focus rings, colors, font weights or the opacity of the element — depending on the state and on the color below it.

The ending of a name tells the kind of state: -ing states are transitional and last only during the interaction (hovering, focusing, pressing, dragging); -ed states are static and stay after it (selected, activated, disabled).

StateKindSet by
RestingDefault—
HoveringTransitionalThe pointer, only on devices that can hover
FocusingTransitionalThe keyboard focus
PressingTransitionalMouse button or finger down
DraggingTransitionalDrag and drop
SelectedStatic, publicA choice of the user, e.g. in a dropdown
ActivatedStatic, publicThe current destination, e.g. the active menu item
DisabledStatic, publicThe application, when an element can’t be used
LoadingStatic, publicThe application, while an action runs

Try it

Hover, focus with the Tab key, press and toggle these components.

Combinations

States combine: an element can be selected, hovered and pressed at the same time, and shows all of it at once. The static states (rows) get their overlay first, the interactions (columns) lay theirs on top. Disabled elements don’t react at all.

The checkerboard behind the tiles shows where states change the opacity of the element.

RestingHoverFocusResting
Resting
Hover
Focus
Selected
Selected
Selected + Hover
Selected + Focus
Activated
Activated
Activated + Hover
Activated + Focus
Pressed
Pressed
Pressed + Hover
Pressed + Focus
Selected + pressed
Selected + pressed
Selected + pressed + Hover
Selected + pressed + Focus
Activated + pressed
Activated + pressed
Activated + pressed + Hover
Activated + pressed + Focus
Disabled
Disabled
Disabled
Disabled

Hover & focus overlays

Hover and focus lay an overlay of the current text color over the element. On surfaces the default strength is enough; colored elements like primary buttons, checkboxes and switches need a stronger overlay, which makes them lighter. Form elements may show a 1px primary border instead.

DefaultStrongExtra strongHover on surface
Default4% currentColor
Strong8% currentColor
Extra strong12% currentColor
Focus on surface
Default8% currentColor
Strong12% currentColor
Extra strong24% currentColor
Hover on primary
Default4% currentColor
Strong8% currentColor
Extra strong12% currentColor
Focus on primary
Default8% currentColor
Strong12% currentColor
Extra strong24% currentColor

Focus ring

The keyboard focus gets a focus ring, always in primary — also for neutral elements — unless the element itself is primary, then it uses its own color. Form fields use a focus outline in a light shade together with a 1px border in the state color. The ring only shows for keyboard focus (:focus-visible), not after a click.

Focus can also add an overlay. When an element is focused and hovered at the same time, the focus overlay is used.

Focus ring2px primary-500
Focus ring offset2px outline, 2px offset

Pressed & dragging

Pressing scales the element down slightly and lowers its opacity, so it reacts right under the finger. Dragged elements are lifted to elevation 2.

DraggingElevation 2

Selected & activated

Selected communicates a choice of the user, e.g. in a dropdown or a table row. Activated highlights the current destination, chosen by the user or by default, e.g. the menu item of the current page. Both use a 6% primary overlay; activated also colors the text primary (see the combinations above). Navigation items may use text color and font weight instead, as long as the difference is clear.

Disabled & loading

Disabled elements can’t be interacted with in any way. They get a neutral-300 background with neutral-400 text, or 35% opacity with pointer-events: none — the latter suits form elements and contextual information like “No results”.

Loading elements keep their size and show a spinner instead of their content, e.g. buttons while their action runs. They ignore further clicks.

Disabledneutral-300 / neutral-400
DisabledOpacity 35%

Using states

The state mixin of fusion-css renders the overlays of any combination of states. Use hover instead of :hover, it only applies on devices that can hover.

@use "@brynlabs/fusion-css/index" as fusioncss;
.item {
@include fusioncss.state(());
@include fusioncss.hover {
@include fusioncss.state(("hover": true));
}
@include fusioncss.focus-behavior {
@include fusioncss.focus-ring;
}
&.selected {
@include fusioncss.state(("selected": true));
}
&:active {
@include fusioncss.state(("pressed": true));
}
}
Opacity tokenValue
--opacity--state-hover4%
--opacity--state-hover-strong8%
--opacity--state-hover-extra-strong12%
--opacity--state-focus8%
--opacity--state-focus-strong12%
--opacity--state-focus-extra-strong24%
--opacity--state-selected6%
--opacity--state-activated6%
On this page
  • Overview
  • Try it
  • Combinations
  • Hover & focus overlays
  • Focus ring
  • Pressed & dragging
  • Selected & activated
  • Disabled & loading
  • Using states