Axon 911 Frontend Docs
    Loading navigation…
U
User
Switch to light mode
  1. Foundations
  2. Elevation

Elevation

Role-based shadow tokens and how Box, Card, and popup surfaces apply them.

Elevation communicates stacking role: how a surface sits relative to the page and to other layers. Components bind to a role (sunken, raised, overlay, modal, or floating tray), not to a decorative “heavier shadow.” Pick the role from what the surface does; two surfaces with the same job use the same token everywhere. Shipped values live in @prepared911/ui/styles.css as --elevation-* custom properties (vendored from Chroma). React exposes the five Box roles through Elevation on Box and FlexBox. Card uses CardElevation for its optional resting shadow.
Role tokens
Values below are copied from system.css. Shadow lengths that use calc(1rem * …) assume the document root is 16px (1rem), matching the rest of the token scale.
RoleElevationTokenLight (:where(:root))Dark ([data-theme='dark'])Typical useConsumers in @prepared911/ui
FlatNone—nonenoneList rows, dense tables, chrome with no liftDefault Box / Card
SunkenSunken--elevation-sunken-shadowinset 0 1px 2px 0 var(--elevation-xs-color)same shape; --elevation-xs-color is rgba(0,0,0,0.20)Inset wells and recessed tracksBox / FlexBox elevation only
RaisedRaised--elevation-raised-shadow0 1px 2px 0 var(--elevation-md-color)same shape; --elevation-md-color is rgba(0,0,0,0.24)Cards and panels resting on the pageBox, Card (CardElevation.Raised), Popover, Accordion, ChannelList (raised chip)
OverlayOverlay--elevation-overlay-shadow0 4px 8px 0 var(--elevation-md-color)same shapeTooltips, compact popups, chat chromeBox, Tooltip, ChatInput, ChannelList (overlay panel), ChartFrame tooltip, popup-surface-overlay recipe
ModalModal--elevation-modal-shadow0 8px 16px 0 var(--elevation-md-color)same shapeBlocking dialogs and modal shellsBox, Dialog (modal-surface recipe), popup-surface-modal recipe
Floating tray shadow
Some portaled menus and toasts use a floating shadow token instead of the overlay stack. It is not a Box Elevation value; components reference it in CSS.
TokenLightDarkTypical useConsumers
--elevation-floating-shadow0 20px 48px 0 var(--elevation-soft-color-105), 0 3px 10px 0 var(--elevation-soft-color-045)0 22px 55px 0 var(--elevation-soft-color-340)Large floating trays above the pageMenu, Listbox, Toast, Toolbar (floating variant), ChatScroll jump control, Select / Combobox list surfaces
Part and control shadows
TokenPurposeConsumers
--elevation-resting-shadowSelected pill in segmented controlsSelectionPill (used by SegmentedControl, ToggleGroup)
--elevation-thumb-shadowSwitch and slider thumbsSwitchTrack, Switch, Slider
--elevation-bubble-shadowSlider value bubble (dark theme region)SliderBubble
Shadow color ramp
These alpha ramp tokens are the ink inside role shadows. Compose custom shadows only when a design-system part already does; otherwise request a token upstream.
TokenLightDark
--elevation-xs-colorrgba(0,0,0,0.07)rgba(0,0,0,0.20)
--elevation-sm-colorrgba(0,0,0,0.20)rgba(0,0,0,0.22)
--elevation-md-colorrgba(0,0,0,0.22)rgba(0,0,0,0.24)
--elevation-lg-colorrgba(0,0,0,0.24)rgba(0,0,0,0.26)
--elevation-xl-colorrgba(0,0,0,0.28)rgba(0,0,0,0.28)
Additional --elevation-soft-color-* steps in system.css back --elevation-resting-shadow, --elevation-floating-shadow, thumb, and bubble tokens.
How to apply elevation
Box and FlexBox
Pass elevation={Elevation.<Role>}. Background stays on background; elevation only sets box-shadow.
Card
CardElevation.None (default) keeps a Surface card flat. CardElevation.Raised adds --elevation-raised-shadow on CardVariant.Surface only; Ghost accepts None at the type level.
Popup and modal recipes
Portaled shells apply shared Tailwind recipes from tailwind/recipes/popup-surface.css and modal-surface.css. Use @apply in colocated component CSS, not ad hoc utility strings in className (see Portal usage).
  • popup-surface-shell: border, radius, overlay fill, motion hooks; under forced-colors: active, border color becomes CanvasText.
  • popup-surface-overlay: shell + --elevation-overlay-shadow.
  • popup-surface-modal: shell + --elevation-modal-shadow.
  • modal-surface: shell + modal motion + --elevation-modal-shadow (Dialog).
Drawer edge shadows
Drawer paints one of four edge tokens on the sliding panel:
TokenApplied on
--elevation-drawer-inline-start-shadowinlineStart panel (leading inline edge)
--elevation-drawer-inline-end-shadowinlineEnd panel
--elevation-drawer-block-start-shadowblockStart panel
--elevation-drawer-block-end-shadowblockEnd panel
Every edge token casts toward the page content, away from the edge the panel is anchored to: the inline pair casts across the page, block-start casts down from a top-anchored panel and block-end casts up from a bottom-anchored panel. Listbox paints --elevation-drawer-block-end-shadow on a pinned footer divider when footerShadow is enabled.
Dark mode and accessibility
On the default dark theme, shadows are subtle against --color-bg-default; pair raised surfaces with BorderColor.Subtle or BorderColor.Default when fill and page are close in value. Under forced-colors: active, system colors replace token fills and shadows no longer carry the edge. Shared popup shells keep a 1px border-style: solid edge (popup-surface-shell uses var(--border-width-default) and var(--color-border-default); forced colors switch the border to CanvasText). Surfaces that normally rely on shadow alone should still expose a border in that mode (Toast clears box-shadow and keeps a CanvasText border; Tooltip adds a CanvasText border). Elevation is not a focus indicator. Pair interactive surfaces with the focus-ring recipes.
Stacking with z-index
Elevation does not replace z-index. Portaled chrome still uses --z-index-* tokens. Band order for overlays (bottom → top): overlay → modal → popover → tooltip. .pr-tooltip sits at calc(var(--z-index-tooltip) + 100) so tooltips paint above popovers when those tokens share a numeric value.
Do and don't
Do
  • Choose Elevation from the surface role (sunken well, raised card, overlay menu, modal dialog).
  • Use CardElevation.Raised only on CardVariant.Surface.
  • Apply popup/modal shadows through popup-surface-* and modal-surface recipes in component CSS.
  • Add a visible border when shadow contrast is weak (especially on dark default).
Don't
  • Reference legacy ui-core --shadow-1…--shadow-5 or Elevation.Low / Medium / High; they are removed.
  • Stack multiple box-shadows or mix role tokens with hand-written shadows.
  • Use elevation on dense lists or tiny controls; spacing and borders separate them.
  • Depend on a drawer shadow alone for separation in forced-colors mode; keep the border.
Previous
Spacing
Next
Semantics
On this page
Role tokens
Floating tray shadow
Part and control shadows
Shadow color ramp
How to apply elevation
Box and FlexBox
Card
Popup and modal recipes
Drawer edge shadows
Dark mode and accessibility
Stacking with z-index
Do and don't