Page MenuHomePhabricator

Add a tabbed layout component to Codex
Closed, DuplicatePublic

Description

Existing implementations

Mediawiki software
External libraries

Design documentation

Implementation notes

Implementation requires two components, Tab and Tabs.

The parent Tabs component has a slot that should contain one or more child Tab components; each Tab component in turn has its own slot to contain arbitrary content from the end-user.

The parent Tabs component needs to know some things about its children (it needs to know the label prop of each child in order to construct a header row, for example); likewise each individual Tab looks to the parent to determine whether or not it is the active tab (a tab's v-show and aria-hidden attributes will change based on this).

We want to share this data between the parent and child components automatically (so that the user doesn't have to worry about manually passing certain props when composing slot contents). Vue's provide/inject API is used to accomplish this, and since we are using Typescript we can also ensure that the injected data is type-safe (see this blog post for more on using provide/inject in TS).

Event Timeline

The current patch only supports the Frameless design. Is that okay for now? I don't want to add a bunch of additional styling until we have the real design tokens in the library, because things will all need to be re-written at that point anyway.

Change 733098 had a related patch set uploaded (by Eric Gardner; author: Eric Gardner):

[design/codex@main] Tabs, Build: Add Tab & Tabs layout components, Stylelint updates

https://gerrit.wikimedia.org/r/733098

Change 733098 abandoned by Eric Gardner:

[design/codex@main] Tabs: Add Tab & Tabs layout components

Reason:

Abandoned in favor of https://gerrit.wikimedia.org/r/c/design/codex/+/772516

https://gerrit.wikimedia.org/r/733098