Playground

Documented example tabs-keyboard : ArrowRight from Overview, billing selected and focused.

The render follows the page's theme switch: light, dark or high contrast. Both frameworks render the same example.

The real Tabs, live
React
Summary
Vue
Summary

readonly TabItem[]

string | undefined

string | undefined

ComponentSize | undefined

string | undefined

string | undefined

Events it emits: change, update. Use either render above, and each event shows here with the framework that sent it.

    Code

    The documented example. HTML is the markup the React component renders for it, which @oods/component-styles styles.

    import { Tabs } from '@oods/components-react';
    import '@oods/component-styles/css';
    
    const items = [
      {
        "id": "overview",
        "label": "Overview",
        "panel": "Summary"
      },
      {
        "id": "billing",
        "label": "Billing",
        "panel": "Invoices"
      }
    ];
    
    export function Example() {
      return (
        <Tabs
          ariaLabel="Account sections"
          defaultSelectedId="overview"
          items={items}
        />
      );
    }

    Props, slots and events

    Contract version 1.1.0. Types are from the React declarations in @oods/components-react.

    Props
    PropTypeRequiredDocumented example
    items readonly TabItem[] yes [{"id":"overview","label":"Overview","panel":"Summary"},{"id":"billing","label":"Billing","panel":"Invoices"}]
    selectedId string | undefined no
    defaultSelectedId string | undefined no overview
    size ComponentSize | undefined no
    overflowLabel string | undefined no
    ariaLabel string | undefined no Account sections

    Slots

    itemLabel, panel

    Events

    change, update

    States

    selected, unselected, disabled, overflow

    Accessibility

    Role
    tab
    How it gets its name
    label on [role="tab"][data-tab-id="overview"]

    Keyboard

    Keyboard
    KeyWhat it does
    TabMove focus to the named native control
    ArrowRightSelect and focus the next tab

    Obligations in the contract

    • tablist/tab/tabpanel semantics
    • Arrow/Home/End keyboard navigation
    • Focus follows the selected tab

    Item-driven API; overflow helper and Popover remain private.

    Tokens

    The token roles this component reads.

    • tabs.background
    • tabs.border
    • tabs.text
    • tabs.selected
    • tabs.focus

    Readiness

    The evidence recorded for this component, with its label.

    proven-in-generated-apps: catalog_list gives this label when generated React and Vue apps in the runtime sweep that ships with this version both use the component. That sweep was measured on the published 0.4.1, not on this version.

    Readiness evidence
    EvidenceReactVue
    stateimplemented-evidence-completeimplemented-evidence-complete
    versioned contractpassedpassed
    target implementationpassedpassed
    package exportpassedpassed
    public declarationpassedpassed
    dependency closurepassedpassed
    framework scenariopassedpassed
    accessibilityverifiedverified
    interactionverifiedverified
    visual themesverifiedverified

    Use your own

    You can replace this component with your own React or Vue component. Map it, and generated code imports yours at the exact version you name. A contract report, run in a real browser, lists what your component met, what it didn't, and what wasn't checked.

    The component_map call, with the parts in angle brackets yours to fill:

    {
      "action": "create",
      "apply": true,
      "externalSystem": "<your design system>",
      "externalComponent": "<YourTabs>",
      "oodsTraits": [
        "<trait names>"
      ],
      "substitution": {
        "component": "Tabs",
        "react": {
          "package": "<your-package>/react",
          "version": "<exact version>",
          "export": "<YourTabs>"
        },
        "vue": {
          "package": "<your-package>/vue",
          "version": "<exact version>",
          "export": "<YourTabs>"
        }
      }
    }

    How this page was made

    Generated at build from the published data, each source with the hash of what was read. The page's manifest.

    • Contract: @oods/component-contracts@0.10.1 componentContracts.Tabs sha256:35095ba5f082…
    • Documented example: @oods/component-contracts@0.10.1 sharedScenarios tabs-keyboard sha256:af0db6d84520…
    • Catalog entry (catalog_list): generated/0.10.1/system/catalog.json Tabs sha256:980d758b0582…
    • React readiness: @oods/components-react@0.10.1 readiness Tabs sha256:857c8b7578b0…
    • Vue readiness: @oods/components-vue@0.10.1 readiness Tabs sha256:ff979a83cccb…
    • Prop types: generated/0.10.1/components/prop-types.json Tabs sha256:8f0882c95cc6…