Skip to content

Component: Box #72784

Closed
Closed

Description

@aduth

What problem does this address?

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.

Related discussions:

What is your proposed solution?

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.

Prior art:

Customization should potentially include:

Activity

  1. added
    [Type] Feature
    [Feature] Component System
    on Oct 29, 2025
  2. added
    [Status] In Progress
    on Nov 4, 2025
  3. aduth commented on Dec 5, 2025

    @aduth
    MemberAuthor

    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?

  4. jameskoster commented on Dec 8, 2025

    @jameskoster
    Contributor

    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.

  5. aduth commented on Dec 8, 2025

    @aduth
    MemberAuthor

    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.

  6. jameskoster commented on Dec 8, 2025

    @jameskoster
    Contributor

    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?

  7. aduth commented on Dec 8, 2025

    @aduth
    MemberAuthor

    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.

    target = 'surface',

  8. jameskoster commented on Dec 9, 2025

    @jameskoster
    Contributor

    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).

  9. aduth commented on Jan 14, 2026

    @aduth
    MemberAuthor

    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.
    • Explore other means of sharing utilities, like React hooks. In particular, I was hoping to use Box's dimension variants support in higher-level components like Card padding (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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Labels

[Feature] Component System[Package] UI[Status] In Progress[Type] Feature

Type

No type

Projects

No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions