Skip to main content

State

Open in ChatGPT

State tokens define how components visually respond to user interaction, such as when they're disabled or focused. These variables help ensure consistent behavior and styling across all UI elements, and can be easily customized to match your design system.

Disabled state​

The disabled state properties are used to make an element appear visually inactive and non-interactive.

The opacity adapts to the current theme for optimal visibility in both light and dark modes.

Example​

input:disabled {
opacity: var(--dwc-disabled-opacity);
cursor: var(--dwc-disabled-cursor);
}

Variables​

VariableDefault ValueDescription
--dwc-disabled-opacityAdapts to light/dark modeReduced opacity for disabled elements
--dwc-disabled-cursorvar(--dwc-cursor-disabled)

Focus state​

When a component receives focus, a focus ring is shown around it to indicate its active state. The focus ring uses a gap-ring pattern with a surface-colored inner gap and a colored outer ring.

Variables​

VariableDefault ValueDescription
--dwc-focus-ring-a0.75Alpha opacity of the focus ring
--dwc-focus-ring-width2pxThickness of the focus ring
--dwc-focus-ring-gap2pxGap between the component edge and the ring

Each color palette generates its own focus ring variable:

Variable PatternDescription
--dwc-focus-ring-{name}Focus ring shadow tinted with the palette color.

Where {name} is one of: primary, success, warning, danger, info, gray, default. See Component Themes for details.


Scales​

Scale transforms are used for press/click feedback animations on interactive elements.

VariableDefault ValueDescription
--dwc-scale-press0.97Standard press scale (3% shrink)
--dwc-scale-press-deep0.93Deep press scale (7% shrink)