Luke UI
GitHub repository

Token reference

Public CSS variables to build custom Luke UI elements.

vars is Luke UI's typed public token contract. Each path resolves to a stable --luke-* CSS variable. For example, vars.color.background.danger.solid.hover resolves to var(--luke-color-background-danger-solid-hover).

Use these variables when a component API or layout utility cannot express a custom element. Some values vary by theme identity or colour mode, while others remain fixed. The token paths stay the same across bundled and custom themes.

Use semantic variables

Token reference — Use semantic variables
Light
Dark

Choose the token whose name matches the element's role. A card might use surface.floating, radius.surface, and depth.resting. A warning message might use the warning role's subtle background and foreground.

Choosing a scale

Token families use different naming models. Spacing uses value-based keys such as sp16 and sp24. Radius and depth use semantic roles. Use the public variable instead of copying its resolved CSS value.

Spacing

Spacing provides one scale for gap, padding, and margin. Each key matches its pixel value, so sp16 is 16px.

Token reference — Spacing scale
sp4 (4px)
sp8 (8px)
sp12 (12px)
sp16 (16px)
sp24 (24px)
sp32 (32px)
sp40 (40px)
sp48 (48px)
sp64 (64px)

Read Layout for breakpoint keys and how spacing values cascade.

Radius

Radius provides five semantic roles. Choose the role that matches the element being rounded, such as control for an input or surface for a card.

Token reference — Radius roles
Detail
Control
Surface
Overlay
Full
Token reference — Keep nested corners concentric
Outer radius from inner radius + gap

When one rounded surface sits inside another, derive the outer radius from the inner radius and the space between them, usually the wrapper's padding. This keeps their corners concentric.

import { deriveConcentricRadius, vars } from '@luke-ui/react/theme';

const wrapperRadius = deriveConcentricRadius(vars.radius.control, vars.space.sp8);

Depth

Depth describes how a surface sits above or within the interface.

Token reference — Depth scale
recessed
resting
raised
floating
overlay

Pair each depth role with the matching surface role. For example, a menu can use surface.floating with depth.floating, while a dialog can use surface.overlay with depth.overlay.

Components already apply depth to their own states. Use these variables only for custom surfaces.

Motion

Motion provides three durations. Each duration is named for the role the movement plays.

  • feedback covers an in-place state change, such as hover, focus, or selection.
  • enter covers an element or an overlay that enters the interface.
  • exit covers an element or an overlay that leaves the interface.

Pair easing.standard with feedback and with entry. Pair easing.exit with a dismissal.

Browse the tokens

The explorer lists every public token in the contract. Samples use the active identity and colour mode.

183 tokens

Background layers, from the page canvas to the translucent backdrop behind a dialog.

Colour
Samplevars pathCSS variable
color.surface.canvas--luke-color-surface-canvas
color.surface.recessed--luke-color-surface-recessed
color.surface.floating--luke-color-surface-floating
color.surface.overlay--luke-color-surface-overlay
color.overlay.backdrop--luke-color-overlay-backdrop

Text colours, and the placeholder colour that stands in for content while it loads.

Colour
Samplevars pathCSS variable
color.loadingSkeleton--luke-color-loading-skeleton
color.text.primary--luke-color-text-primary
color.text.secondary--luke-color-text-secondary
color.text.disabled--luke-color-text-disabled

Border colours for decoration, control outlines, and the focus ring.

Colour
Samplevars pathCSS variable
color.border.decorative--luke-color-border-decorative
color.border.control--luke-color-border-control
color.border.focus--luke-color-border-focus

The six semantic roles. Every role carries the same backgrounds, foregrounds, and border.

Colour
Samplevars pathCSS variable
color.background.neutral.subtle.rest--luke-color-background-neutral-subtle-rest
color.background.neutral.subtle.hover--luke-color-background-neutral-subtle-hover
color.background.neutral.subtle.pressed--luke-color-background-neutral-subtle-pressed
color.background.neutral.solid.rest--luke-color-background-neutral-solid-rest
color.background.neutral.solid.hover--luke-color-background-neutral-solid-hover
color.background.neutral.solid.pressed--luke-color-background-neutral-solid-pressed
color.background.accent.subtle.rest--luke-color-background-accent-subtle-rest
color.background.accent.subtle.hover--luke-color-background-accent-subtle-hover
color.background.accent.subtle.pressed--luke-color-background-accent-subtle-pressed
color.background.accent.solid.rest--luke-color-background-accent-solid-rest
color.background.accent.solid.hover--luke-color-background-accent-solid-hover
color.background.accent.solid.pressed--luke-color-background-accent-solid-pressed
color.background.info.subtle.rest--luke-color-background-info-subtle-rest
color.background.info.subtle.hover--luke-color-background-info-subtle-hover
color.background.info.subtle.pressed--luke-color-background-info-subtle-pressed
color.background.info.solid.rest--luke-color-background-info-solid-rest
color.background.info.solid.hover--luke-color-background-info-solid-hover
color.background.info.solid.pressed--luke-color-background-info-solid-pressed
color.background.success.subtle.rest--luke-color-background-success-subtle-rest
color.background.success.subtle.hover--luke-color-background-success-subtle-hover
color.background.success.subtle.pressed--luke-color-background-success-subtle-pressed
color.background.success.solid.rest--luke-color-background-success-solid-rest
color.background.success.solid.hover--luke-color-background-success-solid-hover
color.background.success.solid.pressed--luke-color-background-success-solid-pressed
color.background.warning.subtle.rest--luke-color-background-warning-subtle-rest
color.background.warning.subtle.hover--luke-color-background-warning-subtle-hover
color.background.warning.subtle.pressed--luke-color-background-warning-subtle-pressed
color.background.warning.solid.rest--luke-color-background-warning-solid-rest
color.background.warning.solid.hover--luke-color-background-warning-solid-hover
color.background.warning.solid.pressed--luke-color-background-warning-solid-pressed
color.background.danger.subtle.rest--luke-color-background-danger-subtle-rest
color.background.danger.subtle.hover--luke-color-background-danger-subtle-hover
color.background.danger.subtle.pressed--luke-color-background-danger-subtle-pressed
color.background.danger.solid.rest--luke-color-background-danger-solid-rest
color.background.danger.solid.hover--luke-color-background-danger-solid-hover
color.background.danger.solid.pressed--luke-color-background-danger-solid-pressed
color.foreground.neutral.rest--luke-color-foreground-neutral-rest
color.foreground.neutral.hover--luke-color-foreground-neutral-hover
color.foreground.neutral.pressed--luke-color-foreground-neutral-pressed
color.foreground.neutral.onSolid--luke-color-foreground-neutral-on-solid
color.foreground.accent.rest--luke-color-foreground-accent-rest
color.foreground.accent.hover--luke-color-foreground-accent-hover
color.foreground.accent.pressed--luke-color-foreground-accent-pressed
color.foreground.accent.onSolid--luke-color-foreground-accent-on-solid
color.foreground.info.rest--luke-color-foreground-info-rest
color.foreground.info.hover--luke-color-foreground-info-hover
color.foreground.info.pressed--luke-color-foreground-info-pressed
color.foreground.info.onSolid--luke-color-foreground-info-on-solid
color.foreground.success.rest--luke-color-foreground-success-rest
color.foreground.success.hover--luke-color-foreground-success-hover
color.foreground.success.pressed--luke-color-foreground-success-pressed
color.foreground.success.onSolid--luke-color-foreground-success-on-solid
color.foreground.warning.rest--luke-color-foreground-warning-rest
color.foreground.warning.hover--luke-color-foreground-warning-hover
color.foreground.warning.pressed--luke-color-foreground-warning-pressed
color.foreground.warning.onSolid--luke-color-foreground-warning-on-solid
color.foreground.danger.rest--luke-color-foreground-danger-rest
color.foreground.danger.hover--luke-color-foreground-danger-hover
color.foreground.danger.pressed--luke-color-foreground-danger-pressed
color.foreground.danger.onSolid--luke-color-foreground-danger-on-solid
color.border.neutral--luke-color-border-neutral
color.border.accent--luke-color-border-accent
color.border.info--luke-color-border-info
color.border.success--luke-color-border-success
color.border.warning--luke-color-border-warning
color.border.danger--luke-color-border-danger

Type styles, font families, and weight roles.

Typography
vars pathCSS variable
font.caption.baselineTrim--luke-font-caption-baseline-trim
font.caption.capHeightTrim--luke-font-caption-cap-height-trim
font.caption.fontFamily--luke-font-caption-font-family
font.caption.fontSize--luke-font-caption-font-size
font.caption.fontWeight--luke-font-caption-font-weight
font.caption.letterSpacing--luke-font-caption-letter-spacing
font.caption.lineHeight--luke-font-caption-line-height
font.label.baselineTrim--luke-font-label-baseline-trim
font.label.capHeightTrim--luke-font-label-cap-height-trim
font.label.fontFamily--luke-font-label-font-family
font.label.fontSize--luke-font-label-font-size
font.label.fontWeight--luke-font-label-font-weight
font.label.letterSpacing--luke-font-label-letter-spacing
font.label.lineHeight--luke-font-label-line-height
font.body.baselineTrim--luke-font-body-baseline-trim
font.body.capHeightTrim--luke-font-body-cap-height-trim
font.body.fontFamily--luke-font-body-font-family
font.body.fontSize--luke-font-body-font-size
font.body.fontWeight--luke-font-body-font-weight
font.body.letterSpacing--luke-font-body-letter-spacing
font.body.lineHeight--luke-font-body-line-height
font.lead.baselineTrim--luke-font-lead-baseline-trim
font.lead.capHeightTrim--luke-font-lead-cap-height-trim
font.lead.fontFamily--luke-font-lead-font-family
font.lead.fontSize--luke-font-lead-font-size
font.lead.fontWeight--luke-font-lead-font-weight
font.lead.letterSpacing--luke-font-lead-letter-spacing
font.lead.lineHeight--luke-font-lead-line-height
font.heading4.baselineTrim--luke-font-heading4-baseline-trim
font.heading4.capHeightTrim--luke-font-heading4-cap-height-trim
font.heading4.fontFamily--luke-font-heading4-font-family
font.heading4.fontSize--luke-font-heading4-font-size
font.heading4.fontWeight--luke-font-heading4-font-weight
font.heading4.letterSpacing--luke-font-heading4-letter-spacing
font.heading4.lineHeight--luke-font-heading4-line-height
font.heading3.baselineTrim--luke-font-heading3-baseline-trim
font.heading3.capHeightTrim--luke-font-heading3-cap-height-trim
font.heading3.fontFamily--luke-font-heading3-font-family
font.heading3.fontSize--luke-font-heading3-font-size
font.heading3.fontWeight--luke-font-heading3-font-weight
font.heading3.letterSpacing--luke-font-heading3-letter-spacing
font.heading3.lineHeight--luke-font-heading3-line-height
font.heading2.baselineTrim--luke-font-heading2-baseline-trim
font.heading2.capHeightTrim--luke-font-heading2-cap-height-trim
font.heading2.fontFamily--luke-font-heading2-font-family
font.heading2.fontSize--luke-font-heading2-font-size
font.heading2.fontWeight--luke-font-heading2-font-weight
font.heading2.letterSpacing--luke-font-heading2-letter-spacing
font.heading2.lineHeight--luke-font-heading2-line-height
font.heading1.baselineTrim--luke-font-heading1-baseline-trim
font.heading1.capHeightTrim--luke-font-heading1-cap-height-trim
font.heading1.fontFamily--luke-font-heading1-font-family
font.heading1.fontSize--luke-font-heading1-font-size
font.heading1.fontWeight--luke-font-heading1-font-weight
font.heading1.letterSpacing--luke-font-heading1-letter-spacing
font.heading1.lineHeight--luke-font-heading1-line-height
font.display.baselineTrim--luke-font-display-baseline-trim
font.display.capHeightTrim--luke-font-display-cap-height-trim
font.display.fontFamily--luke-font-display-font-family
font.display.fontSize--luke-font-display-font-size
font.display.fontWeight--luke-font-display-font-weight
font.display.letterSpacing--luke-font-display-letter-spacing
font.display.lineHeight--luke-font-display-line-height
font.family.body--luke-font-family-body
font.family.code--luke-font-family-code
font.weight.body--luke-font-weight-body
font.weight.label--luke-font-weight-label
font.weight.heading--luke-font-weight-heading
font.weight.emphasis--luke-font-weight-emphasis

The spacing scale for gaps, padding, and margin.

Samplevars pathCSS variable
space.sp4--luke-space-sp4
space.sp8--luke-space-sp8
space.sp12--luke-space-sp12
space.sp16--luke-space-sp16
space.sp24--luke-space-sp24
space.sp32--luke-space-sp32
space.sp40--luke-space-sp40
space.sp48--luke-space-sp48
space.sp64--luke-space-sp64

Corner radii, from small details to full rounding.

Samplevars pathCSS variable
radius.detail--luke-radius-detail
radius.control--luke-radius-control
radius.surface--luke-radius-surface
radius.overlay--luke-radius-overlay
radius.full--luke-radius-full

The shadow ladder, and the face finish that pairs with it on action controls.

vars pathCSS variable
depth.recessed--luke-depth-recessed
depth.resting--luke-depth-resting
depth.raised--luke-depth-raised
depth.floating--luke-depth-floating
depth.overlay--luke-depth-overlay
actionControlFinish.recessed--luke-action-control-finish-recessed
actionControlFinish.resting--luke-action-control-finish-resting
actionControlFinish.raised--luke-action-control-finish-raised

Block sizes for controls and icons.

Samplevars pathCSS variable
controlSize.small--luke-control-size-small
controlSize.medium--luke-control-size-medium
controlSize.minTarget--luke-control-size-min-target
controlSize.comboboxAction--luke-control-size-combobox-action
iconSize.xsmall--luke-icon-size-xsmall
iconSize.small--luke-icon-size-small
iconSize.medium--luke-icon-size-medium
iconSize.large--luke-icon-size-large

State effects a control applies to its own material, such as the disabled fade.

Samplevars pathCSS variable
interaction.disabledOpacity--luke-interaction-disabled-opacity

Durations and easing curves for interaction.

Samplevars pathCSS variable
motion.duration.feedback--luke-motion-duration-feedback
motion.duration.enter--luke-motion-duration-enter
motion.duration.exit--luke-motion-duration-exit
motion.easing.standard--luke-motion-easing-standard
motion.easing.exit--luke-motion-easing-exit

Continue learning