gutenberg icon indicating copy to clipboard operation
gutenberg copied to clipboard

Shadows / Elevation

Open jameskoster opened this issue 1 year ago • 2 comments

Related to https://github.com/WordPress/gutenberg/issues/63703

[!NOTE]
Elevation refers to the vertical distance between two surfaces measured along the z-axis.

As the site editing experience transitions from the Editor to new UIs, there is a need for a more clearly defined elevation scale and shadow styles.

In _variables.scss we find values for modals and popovers only: https://github.com/WordPress/gutenberg/blob/dc93da08a38af14aef07906c63ec11a599d74582/packages/base-styles/_variables.scss#L72-L73

New UIs now exist with custom shadow values, such as the content/preview frame and the Command Palette. The existing variables do not sufficiently cover these additional use cases. Elements like Snackbars and Tooltips may also require reconsideration.

Systematizing elevation will help create a cohesive experience and avoiding maintenance issues in the future.

Proposed elevation scale

  • Elevation 0: The lowest level for most UI elements, with no shadow. Example: Navigation sidebar.
  • Elevation 1: For large sections and containers that group related content and controls, which may overlap other content. Example: Preview Frame.
  • Elevation 2: For components that provide contextual feedback without being intrusive. Generally non-interruptive. Example: Tooltips, Snackbar.
  • Elevation 3: For components that offer additional actions. Example: Menus, Command Palette.
  • Elevation 4: For components that confirm decisions or handle necessary interruptions. Example: Modals.
Elevation

Does this scale meet the needs of the novel UIs, and does its application / mapping of components make sense? Let's discuss and explore further in this issue.

  • [x] https://github.com/WordPress/gutenberg/pull/64108
  • [x] https://github.com/WordPress/gutenberg/pull/65159
  • [x] https://github.com/WordPress/gutenberg/pull/65410
  • [ ] Continue updating site editor elevation; Block toolbar/menus, Focus mode/resize handles, Zoom out, Inline inserter buttons, Quick inserter popover
  • [ ] Update or deprecate Elevation component
  • [ ] Storybook: Add foundations page
  • [ ] Storybook: Add tokens (https://github.com/WordPress/gutenberg/pull/66122)

jameskoster avatar Jul 19 '24 15:07 jameskoster

Nice issue. I wonder, can elevation 2 and 3 be merged? This would improve the contrast between elevations to just have 3 (not conting zero): small, medium, large.

jasmussen avatar Jul 31 '24 07:07 jasmussen

This really needs to focus now on feedback with the labels so moving it to that over needing design. If it is something to bring in then having feedback makes sense over having more design right now.

karmatosed avatar May 31 '25 09:05 karmatosed

For the most part this is complete. We can open dedicated issues for outstanding pieces.

jameskoster avatar Oct 21 '25 15:10 jameskoster