Repository navigation
feat(core): add elevation prop to configurable surfaces - #4251
Merged
Merged
Conversation
Add an `elevation` prop to the configurable surfaces from the elevation system proposal (#4146). Card, ClickableCard, SelectableCard, Button, IconButton, ButtonGroup, Thumbnail, and Banner take the full `'none' | 'low' | 'med' | 'high'` scale; ChatComposer takes the narrowed `'none' | 'low'`. Levels map to the existing `--shadow-low/-med/-high` tokens; `none` is a flat literal. Defaults preserve today's appearance — `none` everywhere except ChatComposer, which defaults to `low` to keep its raised look. Composition is preserved rather than clobbered: Card routes elevation and SelectableCard's inset selection ring through separate box-shadow slots so a selected card keeps its shadow, and Thumbnail's resting elevation coexists with its hover-shadow bump. Button elevation is skipped inside a ButtonGroup, where the group owns the shared surface's shadow. Also documents the elevation prop layer in the elevation foundation doc.
kentonquatman
requested review from
cixzhang,
ejhammond,
imdreamrunner and
josephfarina
as code owners
July 23, 2026 07:44
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
Contributor
PR Analysis Report📚 Storybook PreviewView Storybook for this PR 🧪 Sandbox PreviewView Sandbox for this PR Modified ComponentsBanner · View in Storybook
Button · View in Storybook
ButtonGroup · View in Storybook
Card · View in Storybook
Chat · View in Storybook
ClickableCard · View in Storybook
IconButton · View in Storybook
SelectableCard · View in Storybook
Thumbnail · View in Storybook
Bundle Size Summary
Accessibility AuditStatus: 6 accessibility violation(s) found — 6 serious. Banner - 1 issue(s)
Card - 1 issue(s)
Chat - 1 issue(s)
ClickableCard - 1 issue(s)
SelectableCard - 1 issue(s)
Thumbnail - 1 issue(s)
Generated by PR Enrichment workflow | Storybook | Sandbox | View full report |
Add an example block per configurable surface showing the `elevation` prop in use: Card (all four levels), ClickableCard, SelectableCard, Button, IconButton, Thumbnail, ButtonGroup, and Banner each get a raised example, and ChatComposer gets a flat (`elevation="none"`) example since it is raised by default. These are plain examples (not showcases), so each component keeps its single hero showcase. Updates the ClickableCard/SelectableCard SYNC references to list the new blocks.
Add a "Choosing a level" section to the elevation foundation doc with a table mapping each level (none/low/med/high) to when to use it and concrete examples. The rule keys off how far a surface sits from the page — none for flat/embedded, low for in-flow-but-distinct, med for over page content, high for over the whole UI — so agents pick a level unambiguously by stacking order rather than by desired shadow strength. Also tightens the Best Practices do/don't lists to reference the same rule. Renders via `astryx docs elevation` and on the docsite elevation page.
- Button/IconButton floating examples show all four variants (primary, secondary, ghost, destructive) laid out in a horizontal stack so the buttons hug their content instead of stretching to full width. - ButtonGroup floating example uses hAlign="start" so the group hugs its content rather than stretching wider than the buttons. - ChatComposer flat example includes footer actions (model + settings dropdowns, mic send action) to match the footer-actions example, at the standard 450px composer width.
When ChatComposer's elevation is `none`, draw a border instead of a shadow. The border is drawn inside the padding — its width subtracted from each side (like Card's withBorder) — so total inset is unchanged and content geometry stays identical to the elevated case. Border color and the hover/focus inset rings mirror TextInput's shared input-wrapper treatment: emphasized border at rest, accent on focus-within, the same `color-mix` inset ring on hover, and the accent-muted inset ring on focus. Compact density now overrides the padding var (not the padding property) so the border-inset calc stays correct in both densities.
Contributor
|
Curious on why thumbnail? |
cixzhang
approved these changes
Jul 24, 2026
# Conflicts: # packages/core/src/Button/Button.test.tsx
kentonquatman
enabled auto-merge (squash)
July 24, 2026 02:50
Contributor
Author
I noticed this too. Thumbnail already has an elevation applied for hover states. I want to go back and fix Thumbnail separately so it has the same hover states as ClickableCard. I’ll remove the prop in that PR. |
This was referenced Jul 25, 2026
This branch was successfully deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Implements the Elevation prop (configurable surfaces) table from the elevation system proposal (#4146). Adds a single
elevationprop to every configurable surface, narrowed per component to the steps it needs.'none' | 'low' | 'med' | 'high''none''none' | 'low' | 'med' | 'high''none''none' | 'low' | 'med' | 'high''none''none' | 'low''low''none' | 'low' | 'med' | 'high''none''none' | 'low' | 'med' | 'high''none''none' | 'low' | 'med' | 'high''none''none' | 'low' | 'med' | 'high''none''none' | 'low' | 'med' | 'high''none'Levels map to the existing
--shadow-low/-med/-hightokens;noneis the flatbox-shadow: noneliteral. No new tokens.No breaking changes
Every prop defaults to today's behavior, so nothing changes unless a consumer opts in:
'none'.'low'(low at rest, bumping to med on hover / focus, exactly as before). Setelevation="none"to flatten it.'none'default.Composition, not clobbering
box-shadowis a single CSS property, so a few surfaces needed care so elevation coexists with an existing shadow rather than overwriting it:--_card-ring,--_card-elevation). SelectableCard now drives its inset selection ring through--_card-ring, so a selected card keeps its resting elevation.--_thumbnail-elevation, which the existing:hover → medbump reads, so a raised tile still bumps on hover.elevationfor free by composing Button; ClickableCard/SelectableCard forward it to Card.Intrinsic overlays (Dialog, Popover, Tooltip, Toast, HoverCard, DropdownMenu, …) are unchanged — they bake elevation in and expose no prop.
What's included
elevationprop on all 9 configurable-surface components, with a sharedElevationtype inutils/types..doc.mjs— English, 中文, and dense variants) soastryx component <Name>reflects the new prop.none/low/med/high) to when to use it, keyed off how far a surface sits from the page (flat/embedded → in-flow-but-distinct → over page content → over the whole UI) so agents pick a level unambiguously. Readable viaastryx docs elevation.elevationcontrols on each component's stories plus dedicated stories (CardElevations, ButtonElevations, BannerFloating, ChatComposerFlat).elevation="none") example since it is raised by default. Plain examples, so each component keeps its single hero showcase.Interaction-driven elevation (drag/reorder lift) is intentionally out of scope per the proposal's appendix.
Checks
build,test(154 passing across the touched files + 282 docsite data-extraction tests),lint/check:repo, core + docs + template-docs + storybook typechecks,sync-exports --check,check:demo-media, andcheck:changesetsall pass locally.Implements the first-PR scope of #4146 (the
elevationprop + foundation doc). The proposal's lint/review guard for rawbox-shadowis a separate follow-up.