You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
There have been several recent examples highlighting the need for a common primitive component that allows for (design) systems-based component layouts based on shared design standards for e.g. spacing, color, etc.
Create a new Box component that integrates with the new Theme package to provide a way to render components styled using tokens provided through the theming context.
I'm debating if we should close this as complete without "elevation" or "sizing" supports, at least for now and letting those requirements emerge as needed.
@jameskoster Since you mentioned "width" originally in #72984, I'm curious if you have any impressions about this? Widths, elevation, and text measure may be something we want to support at a tokens level, but I'm not sure if it needs to be part of Box? Do we have some examples of how these would be used?
I think we'll want width for things like Cards, Modals, Sidebars, Snackbars, Menus, etc. Elevation likewise. What's the rationale for not supporting this at the Box level? It's not clear to me why it would support things like padding but not width.
Thanks for sharing the examples. Perhaps elevation is more clear-cut as a common use-case. For some of those examples with widths, do you think those widths would be associated with system-wide widths, or more component specific? Something like sidebar for example.
The way I see it (which might not be the best perspective) Box is basically equivalent to the 'surface' concept we've defined in the tokens.
I think I'd expect the components to reference a subset of system-wide widths via Box. Sometimes that subset might be one value. So for example at the system-level we might specify tokens like --wpds-dimension-width-surface-xs – --wpds-dimension-width-surface-xl (or similar). Box would expose all those options. Modal might only want to support the lg and xl values which it would expose via it's own size property which gets passed to Box. Sidebar might only support a single value. Do you think that makes sense?
Yeah, I think that could make sense, assuming we can decide on a standard set of widths for the surface tokens. (I think this was a missing piece for me)
I'm not sure we'll need it, but the way Box was implemented also allows it to be used to render using token groups other than "surface", via its target prop.
I think the measure values in this comment are a reasonable starting place tbh. They should cover all the examples outlined above.
The scale doesn't match 1:1 with all width values we use currently, but that's because they're kind of all over the place. Arguably the most important one (Inspector) does match (280px). The next most important (List View/Inserter) is very close (currently 350px, would become 360px with the new scale).
There was some recent discussion in #73931 (comment) about the value of component abstractions like Box or Text. In reflection, I'm not as convinced to the imminent value of Box as currently implemented. One of the original arguments I raised in #73931 was that this would provide useful guardrails for token usage, but we also recognize that Box is a very low-level abstraction that ideally most people wouldn't need to be using directly anyways. And so if that leaves usage primarily for folks iterating on the design system, those people would already be well-positioned to understand correct usage of the tokens. There are also some trade-offs already acknowledged elsewhere, like mixing and matching different token types (e.g. color and dimensions in Box), excessive DOM element nesting, etc.
With that in mind, I'd propose:
Removing the Box component implementation, updating existing usage (pretty limited) to use equivalent design tokens directly
Continue introducing Text component, but only with support for variant or preset prop for convenience to opting into a preset of multiple token options. This should be a separate GitHub issue.
Activity
aduth commentedon Dec 5, 2025
I'm debating if we should close this as complete without "elevation" or "sizing" supports, at least for now and letting those requirements emerge as needed.
@jameskoster Since you mentioned "width" originally in #72984, I'm curious if you have any impressions about this? Widths, elevation, and text measure may be something we want to support at a tokens level, but I'm not sure if it needs to be part of Box? Do we have some examples of how these would be used?
jameskoster commentedon Dec 8, 2025
I think we'll want width for things like Cards, Modals, Sidebars, Snackbars, Menus, etc. Elevation likewise. What's the rationale for not supporting this at the Box level? It's not clear to me why it would support things like padding but not width.
aduth commentedon Dec 8, 2025
Thanks for sharing the examples. Perhaps elevation is more clear-cut as a common use-case. For some of those examples with widths, do you think those widths would be associated with system-wide widths, or more component specific? Something like sidebar for example.
jameskoster commentedon Dec 8, 2025
The way I see it (which might not be the best perspective) Box is basically equivalent to the 'surface' concept we've defined in the tokens.
I think I'd expect the components to reference a subset of system-wide widths via Box. Sometimes that subset might be one value. So for example at the system-level we might specify tokens like
--wpds-dimension-width-surface-xs–--wpds-dimension-width-surface-xl(or similar).Boxwould expose all those options.Modalmight only want to support thelgandxlvalues which it would expose via it's ownsizeproperty which gets passed toBox. Sidebar might only support a single value. Do you think that makes sense?aduth commentedon Dec 8, 2025
Yeah, I think that could make sense, assuming we can decide on a standard set of widths for the surface tokens. (I think this was a missing piece for me)
I'm not sure we'll need it, but the way Box was implemented also allows it to be used to render using token groups other than "surface", via its
targetprop.gutenberg/packages/ui/src/box/box.tsx
Line 83 in 6bbe30d
jameskoster commentedon Dec 9, 2025
I think the
measurevalues in this comment are a reasonable starting place tbh. They should cover all the examples outlined above.The scale doesn't match 1:1 with all width values we use currently, but that's because they're kind of all over the place. Arguably the most important one (Inspector) does match (280px). The next most important (List View/Inserter) is very close (currently 350px, would become 360px with the new scale).
aduth commentedon Jan 14, 2026
There was some recent discussion in #73931 (comment) about the value of component abstractions like
BoxorText. In reflection, I'm not as convinced to the imminent value ofBoxas currently implemented. One of the original arguments I raised in #73931 was that this would provide useful guardrails for token usage, but we also recognize thatBoxis a very low-level abstraction that ideally most people wouldn't need to be using directly anyways. And so if that leaves usage primarily for folks iterating on the design system, those people would already be well-positioned to understand correct usage of the tokens. There are also some trade-offs already acknowledged elsewhere, like mixing and matching different token types (e.g.coloranddimensionsinBox), excessive DOM element nesting, etc.With that in mind, I'd propose:
Boxcomponent implementation, updating existing usage (pretty limited) to use equivalent design tokens directlyTextcomponent, but only with support forvariantorpresetprop for convenience to opting into a preset of multiple token options. This should be a separate GitHub issue.Box's dimension variants support in higher-level components likeCardpadding (like Card Component Padding System Enhancement #72511 from which it was inspired). This could still be achieved using a React hook if needed.This is also proposed in mind that it's easier to reintroduce the component later if there's demonstrated value, than it is to try to remove it later.
aduth commentedon Jan 27, 2026
Closing in favor of: