For AI agents: the complete documentation index is available at /ooui-react/en/llms.txt, the full documentation bundle is available at /ooui-react/en/llms-full.txt, and this page is available as Markdown at /ooui-react/en/components/index-layout/index.md.
  • English
  • IndexLayout

    Source | Original component

    An index layout: a tab select on top and a stack of tab panels below. Suits settings pages — "top tabs + chunked content"; for the side-outline variant see BookletLayout.

    Basic usage

    An options item is { value, label, children } plus the TabPanelLayout panel fields (with disabled to disable a tab); the active tab rides the value / defaultValue / onChange channels. Tabs and panels are wired with aria-controls / aria-labelledby automatically.

    General settings
    import { useState } from "react";
    import { IndexLayout } from "ooui-react";
    
    function App() {
      const [tab, setTab] = useState<string | number>("general");
    
      return (
        <div style={{ position: "relative", height: 180 }}>
          <IndexLayout
            framed
            value={tab}
            onChange={setTab}
            options={[
              { value: "general", label: "General", padded: true, children: "General settings" },
              { value: "appearance", label: "Appearance", padded: true, children: "Appearance settings" },
              { value: "advanced", label: "Advanced", padded: true, disabled: true, children: "Advanced settings" },
            ]}
          />
        </div>
      );
    }
    
    export default App;
    Form premise

    In the expanded form (on by default) the layout fills its parent via absolute positioning, so the parent must be positioned and sized (the demo wrapper above exists for exactly that). The expanded={false} static form works only for MenuLayout's own flow content — the panel stacks of this component and BookletLayout are absolutely positioned panels with no content height in static mode, so don't use it here.

    Browser-search linkage

    openMatchedPanels (default true) hides inactive panels with hidden="until-found": when the browser's in-page search (Ctrl+F) matches content inside a hidden panel, the corresponding tab is activated automatically. Under continuous all panels show at once and openMatchedPanels is disabled — panels are no longer hidden with until-found and the browser-search linkage stops. autoFocus (default true) focuses the panel's first focusable element after a switch (suppressed in the mobile form).

    When the active tab is removed, the first selectable (non-disabled) tab is auto-selected.

    API

    Inherits all MenuLayout props (except menu / menuPosition / children), plus:

    PropDescriptionTypeDefault
    optionsThe tab set: value, label, disabled plus TabPanelLayout fieldsIndexLayoutTabProps[]—
    valueCurrent active tab (controlled; passing it enables controlled mode)string | number—
    defaultValueInitial active tab for uncontrolled usestring | number—
    onChangeActive-tab change callbackChangeHandler<string | number>—
    framedWhether the tabs are framedbooleantrue
    continuousWhether all panels showbooleanfalse
    autoFocusFocus the panel's first focusable element after switchingbooleantrue
    openMatchedPanelsHide inactive panels with hidden="until-found" and switch tabs when the browser search matches (disabled under continuous)booleantrue

    See also