Page MenuHomePhabricator

[EPIC] [New component] Container: Add responsive Container component to Codex
Open, In Progress, MediumPublic

Description

Background goal

As part of T340535: [EPIC] Responsive layout approach we are going to implement a Container component. We will need both fluid and fixed containers.

  • Fixed containers have a max width (like article max width)
  • Fluid containers expand as the viewport gets bigger (but they still have padding or margins at the edges)
  • Containers may need different margin/padding tokens at different breakpoint sizes

Assuming that this goes well, we will adopt a component-based approach to responsive layout in Codex, and we will plan to introduce a series of more complex Layout components (exact members TBD, but will likely include Columns, Grid, etc).

Description

A Container is a flexible layout wrapper that adapts across the different breakpoints and screen sizes.

User stories

  • As an engineer, I need a flexible Container component that allows me to easily set min-width, max-width, and fluid behavior to create consistent layouts across all breakpoints and screen sizes.

Codex implementation

Component task owners

Design spec

  • Width: 100% by default, ensuring a fluid and flexible layout.
  • Min-Width: @size-1600 (equivalent to 256px) by default to avoid content to be too narrow, but it can be customizable to a smaller or larger width.
  • Max-Width: some predefined max-widths and then customizable to other widths. Predefined max-widths will be:
    • x-large 1596px (new token needed)
    • large 944px (new token needed)
    • medium 640px (@size-4000)
    • small 448px (@size-2800)
    • x-small 256px (@size-1600) 2025-03-10: We decided for the WIP implementation to only roll-out larger containers startign with medium, as the use case of the small ones is questionable under premise of underlying Grid and container supposedly being just most outer layout helper
  • Breakpoint Mobile: at breakpoint mobile (320px - 639px screens) the Container will be full-width, and it will reset to 100% even if the min or max width is different at other breakpoints.
  • Paddings: by default, paddings in container will be 0, although they can be customized with other system paddings if needed.
  • Alignment: horizontally center-aligned in LTR/RTL by default, but they will be customizable to other placements.

Guidelines

Open questions

  • Is this going to be a "normal" Codex component, and live in the sidebar of the https://doc.wikimedia.org/codex/latest/components/overview.html page?
    • VE: From my POV it makes most sense to have it as specific entry in the sidebar, as it fits into the 'Content & data' section and it seems important enough to feature it for general documentation.
  • [design] Should the Containers always be centered in their container – HTML body/main/section or div?
    • VE: I think an opinionated default could be more problematic when feature teams have to override it too often. An alternative could be to
  • [engineering] Clarify (tbd if in MVP) HTML5 sectioning character feature for Container? Should dev teams be able to also choose between semantic sectioning elements like section, main, nav or aside as well instead of an meaningless wrapper div? This would also need to feature a heading or an ARIA label.

Acceptance criteria

Event Timeline

egardner updated the task description. (Show Details)
CCiufo-WMF triaged this task as Medium priority.Nov 25 2024, 3:44 PM

Ater some discussions with the team, these are the decisions for the Container implementation:

  • Width: 100% by default, ensuring a fluid and flexible layout.
  • Min-Width: @size-1600 (equivalent to 256px) by default to avoid content to be too narrow, but it can be customizable to a smaller or larger width.
  • Max-Width: some predefined max-widths and then customizable to other widths. Predefined max-widths will be:
    • x-large 1596px (new token needed)
    • large 948px (new token needed)
    • medium 640px (@size-4000)
    • small 448px (@size-2800)
    • x-small 256px (@size-1600)
  • Breakpoint Mobile: at breakpoint mobile (320px - 639px screens) the Container will be full-width, and it will reset to 100% even if the min or max width is different at other breakpoints.
  • Paddings: by default, paddings in container will be 0px, although they can be customized with other system paddings if needed.
  • Alignment: horizontally left-aligned in LTR and right-aligned in RTL by default, but they will be customizable to other placements.

I've defined both Figma spec and guidelines with these specifications. Once we start with the implementation, we will see how this works and we will iterate if needed.

@Volker_E @CCiufo-WMF Moving the task to Needs Refinement so we can start with its implementation in the following sprints.

CCiufo-WMF removed the point value 1 for this task.Jan 7 2025, 4:13 PM
CCiufo-WMF renamed this task from Responsiveness: container component to Container: Add responsive Container component to Codex.Jan 30 2025, 6:08 PM
Catrope set the point value for this task to 3.Feb 3 2025, 6:27 PM
CCiufo-WMF renamed this task from Container: Add responsive Container component to Codex to [EPIC] Container: Add responsive Container component to Codex.Feb 21 2025, 3:57 PM
CCiufo-WMF changed the task status from Open to In Progress.
CCiufo-WMF removed the point value 3 for this task.

@bmartinezcalvo In regards to further WIP demos, I've uncovered the behaviour of oversized content. With current approach would follow the standard CSS behaviour and expand the Container box. See Netlify demo. This needs some design discussion and agreement.

image.png (1×2 px, 162 KB)

DTorsani-WMF renamed this task from [EPIC] Container: Add responsive Container component to Codex to [EPIC] [New component] Container: Add responsive Container component to Codex.Jul 29 2025, 2:22 PM