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/layout/index.md.
  • English
  • Layout

    Source | Original component

    The layout base class: the common root of the other layout components. Used alone it only provides the oo-ui-layout root class and the hidden three-state control.

    The hidden three states

    hidden has three states: true hides fully (hidden attribute + aria-hidden); 'until-found' hides visually but stays reachable by the browser's in-page search (Ctrl+F) — when matched, the browser reveals the element itself and fires the beforematch event, which you can listen for on the element for custom reactions (IndexLayout's openMatchedPanels is exactly this); omitting it leaves the element visible.

    Currently visible

    import { useState } from "react";
    import { Button, Layout } from "ooui-react";
    
    function App() {
      const [hidden, setHidden] = useState<boolean | "until-found">(false);
    
      return (
        <div style={{ display: "flex", flexDirection: "column", gap: 12 }}>
          <Layout hidden={hidden}>
            <p>
              {hidden === "until-found"
                ? "Reachable by search: find this text with the browser's Ctrl+F and it is revealed"
                : "Currently visible"}
            </p>
          </Layout>
          <div style={{ display: "flex", gap: 8 }}>
            <Button onClick={() => setHidden(true)}>hidden</Button>
            <Button onClick={() => setHidden("until-found")}>until-found</Button>
            <Button onClick={() => setHidden(false)}>Unhide</Button>
          </div>
        </div>
      );
    }
    
    export default App;
    Note

    React 18 writes any truthy hidden as the boolean attribute, so the component rewrites the attribute after commit to make 'until-found' take effect; once React 19 types support it natively this workaround can go.

    API

    PropDescriptionTypeDefault
    hiddenWhether hidden: true hides fully; 'until-found' hides visually but stays reachable by in-page searchboolean | 'until-found'—
    ...restNative div props (className, id, data-*, etc.) passed straight to the root; to listen for beforematch, attach a native listener via a ref (React 18's types do not include the event yet)HTMLAttributes<HTMLDivElement>—

    See also

    • The form switches built on it: PanelLayout
    • The full application of until-found: IndexLayout's openMatchedPanels