shelving 1.321.0 → 1.322.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/docs/guides/building-with-shelving.md +204 -1
  2. package/docs/llms-full.txt +786 -114
  3. package/docs/ui/App.md +105 -7
  4. package/docs/ui/AppLayout.md +85 -0
  5. package/docs/ui/AppLayoutProps.md +21 -0
  6. package/docs/ui/Catcher.md +1 -1
  7. package/docs/ui/ErrorPage.md +2 -1
  8. package/docs/ui/FixedLayout.md +91 -0
  9. package/docs/ui/FixedLayoutProps.md +13 -0
  10. package/docs/ui/GapVariants.md +2 -2
  11. package/docs/ui/HeightVariant.md +30 -0
  12. package/docs/ui/HeightVariants.md +26 -0
  13. package/docs/ui/Navigation.md +20 -11
  14. package/docs/ui/PaddingVariants.md +2 -2
  15. package/docs/ui/Page.md +12 -8
  16. package/docs/ui/PageLoader.md +2 -1
  17. package/docs/ui/RouteCache.md +22 -17
  18. package/docs/ui/Router.md +9 -5
  19. package/docs/ui/Scroll.md +60 -6
  20. package/docs/ui/ScrollVariants.md +5 -1
  21. package/docs/ui/SidebarLayout.md +17 -8
  22. package/docs/ui/SpaceValue.md +1 -0
  23. package/docs/ui/TreeApp.md +1 -1
  24. package/docs/ui/getBlockClass.md +1 -1
  25. package/docs/ui/getGapClass.md +1 -1
  26. package/docs/ui/getHeightClass.md +64 -0
  27. package/docs/ui/getPaddingClass.md +1 -1
  28. package/docs/ui/getScrollClass.md +4 -2
  29. package/docs/ui/getSpaceClass.md +2 -0
  30. package/docs/ui.md +13 -8
  31. package/package.json +1 -1
  32. package/ui/README.md +1 -1
  33. package/ui/app/App.md +105 -7
  34. package/ui/docs/DocumentationApp.js +4 -1
  35. package/ui/docs/DocumentationApp.tsx +10 -1
  36. package/ui/layout/AppLayout.d.ts +21 -0
  37. package/ui/layout/AppLayout.js +18 -0
  38. package/ui/layout/AppLayout.md +57 -0
  39. package/ui/layout/AppLayout.module.css +106 -0
  40. package/ui/layout/AppLayout.tsx +36 -0
  41. package/ui/layout/FixedLayout.d.ts +18 -0
  42. package/ui/layout/FixedLayout.js +15 -0
  43. package/ui/layout/FixedLayout.md +65 -0
  44. package/ui/layout/FixedLayout.module.css +55 -0
  45. package/ui/layout/FixedLayout.tsx +25 -0
  46. package/ui/layout/SidebarLayout.d.ts +2 -2
  47. package/ui/layout/SidebarLayout.js +3 -4
  48. package/ui/layout/SidebarLayout.md +15 -6
  49. package/ui/layout/SidebarLayout.module.css +11 -16
  50. package/ui/layout/SidebarLayout.tsx +10 -13
  51. package/ui/layout/index.d.ts +2 -1
  52. package/ui/layout/index.js +2 -1
  53. package/ui/layout/index.tsx +2 -1
  54. package/ui/misc/Catcher.d.ts +2 -1
  55. package/ui/misc/Catcher.js +4 -3
  56. package/ui/misc/Catcher.md +1 -1
  57. package/ui/misc/Catcher.tsx +5 -4
  58. package/ui/misc/Loader.d.ts +1 -0
  59. package/ui/misc/Loader.js +6 -2
  60. package/ui/misc/Loader.tsx +11 -2
  61. package/ui/page/Page.md +12 -8
  62. package/ui/router/Navigation.md +20 -11
  63. package/ui/router/RouteCache.d.ts +2 -1
  64. package/ui/router/RouteCache.js +2 -1
  65. package/ui/router/RouteCache.md +20 -16
  66. package/ui/router/RouteCache.tsx +2 -1
  67. package/ui/router/Router.md +9 -5
  68. package/ui/style/Block.d.ts +3 -2
  69. package/ui/style/Block.js +3 -2
  70. package/ui/style/Block.tsx +4 -2
  71. package/ui/style/Gap.d.ts +1 -1
  72. package/ui/style/Gap.tsx +1 -1
  73. package/ui/style/Height.d.ts +32 -0
  74. package/ui/style/Height.js +13 -0
  75. package/ui/style/Height.module.css +88 -0
  76. package/ui/style/Height.tsx +61 -0
  77. package/ui/style/Padding.d.ts +1 -1
  78. package/ui/style/Padding.tsx +1 -1
  79. package/ui/style/Scroll.d.ts +9 -5
  80. package/ui/style/Scroll.js +6 -4
  81. package/ui/style/Scroll.md +59 -0
  82. package/ui/style/Scroll.module.css +13 -1
  83. package/ui/style/Scroll.tsx +13 -5
  84. package/ui/style/Space.d.ts +1 -1
  85. package/ui/style/Space.module.css +12 -0
  86. package/ui/style/Space.tsx +1 -0
  87. package/ui/style/getHeightClass.md +30 -0
  88. package/ui/style/getSpaceClass.md +2 -0
  89. package/ui/style/index.d.ts +1 -0
  90. package/ui/style/index.js +1 -0
  91. package/ui/style/index.ts +1 -0
  92. package/ui/tree/TreeApp.d.ts +1 -1
  93. package/ui/tree/TreeApp.js +5 -2
  94. package/ui/tree/TreeApp.tsx +11 -2
  95. package/docs/ui/CenteredLayout.md +0 -66
  96. package/docs/ui/CenteredLayoutProps.md +0 -14
  97. package/ui/layout/CenteredLayout.d.ts +0 -21
  98. package/ui/layout/CenteredLayout.js +0 -28
  99. package/ui/layout/CenteredLayout.md +0 -41
  100. package/ui/layout/CenteredLayout.module.css +0 -72
  101. package/ui/layout/CenteredLayout.tsx +0 -56
@@ -481,7 +481,7 @@ Mirrors `shared/config/` folder-for-folder. Where `shared/config/<area>/` define
481
481
  - **`app/index.html`** — production HTML shell. References `./style.css` and `./index.tsx`; the bundler resolves and bundles from here.
482
482
  - **`app/start.html`** — identical shell for local dev, minus any third-party scripts you don't want running locally.
483
483
  - **`app/index.tsx`** — mounts `<App />` into `#root`. Nothing else.
484
- - **`app/App.tsx`** — the composition root of the client: the `ROUTES` table, the app-level context value, and the provider tree (Shelving's `App`, `Navigation`, `PageCatcher`, `Router`, `Dialogs`, `Notices`). Every page component is registered here.
484
+ - **`app/App.tsx`** — the composition root of the client: the `ROUTES` table, the app-level context value, and the provider tree (Shelving's `App`, `Navigation`, `Dialogs`, `Notices`), and the app shell (layout picker, layout, cache and router — see [The app shell](#the-app-shell)). Every page component is registered here.
485
485
  - **`app/start.ts`** — local dev server: `Bun.serve` on the port derived from `APP_URL`, serving the HTML shell for all SPA routes and static files (e.g. `/img/*` mapped to `shared/img/`).
486
486
 
487
487
  ### Routing
@@ -548,6 +548,197 @@ The client has one local database (`DB`, a plain `MemoryDBProvider`). API result
548
548
  - **No inline `style` props, ever.** All styling lives in `.module.css` files named after their component (`OrderPage.module.css` for `OrderPage.tsx`).
549
549
  - Reusable components expose styling options as **variants**: boolean props mapped to class names in the CSS module. Pages compose existing `shelving/ui` primitives (`Button`, `Notice`, `Page`, `Row`, layouts, transitions) rather than styling raw elements.
550
550
 
551
+ ### The app shell
552
+
553
+ The app shell is everything around the pages: the layout, the scroll box, the page cache, the page transition and the tab stacks. **Every part is opt-in.** Start with the smallest shell that works, and add a part only when the app needs it. Each recipe below says what to add and where.
554
+
555
+ The full nesting, from the outside in, is: contexts, then the app-level catcher, then your layout picker, then the layout, then the transition, then `<RouteCache>`, then `<Scroll vertical cover>`, then `<PageLoader>`, then `<Router>`, then the page. Leave out the parts you do not need, but keep the order. "Composing an app" on `<App>` has the full rules and a complete `App.tsx`.
556
+
557
+ #### A simple site: no layout
558
+
559
+ With no layout, the document body scrolls. This is fine for a site or a small app.
560
+
561
+ ```tsx
562
+ <App app="My site" root="https://example.com/">
563
+ <Navigation>
564
+ <PageLoader>
565
+ <Router routes={ROUTES} />
566
+ </PageLoader>
567
+ </Navigation>
568
+ </App>
569
+ ```
570
+
571
+ #### A full-screen app with its own scroll box
572
+
573
+ Use `<FixedLayout>`. It locks the body and gives one full-screen content slot inside the safe areas. It does not scroll, so put a `<Scroll vertical cover>` in it. `cover` makes the scroll box fill the slot.
574
+
575
+ ```tsx
576
+ <FixedLayout>
577
+ <Scroll vertical cover>
578
+ <PageLoader>
579
+ <Router routes={ROUTES} />
580
+ </PageLoader>
581
+ </Scroll>
582
+ </FixedLayout>
583
+ ```
584
+
585
+ #### Content in the middle of the screen
586
+
587
+ A layout never centres. The page centres its own content with `<Block height="full" middle>`. The block is at least as tall as the scroll box, so short content sits in the middle, and tall content starts at the top and scrolls. Use `top` or `bottom` to put it at an edge. This is how to make a log-in page or an error page.
588
+
589
+ ```tsx
590
+ <Page title="Log in">
591
+ <Block height="full" middle width="narrow" padding="xxlarge" indent="normal">
592
+ <LoginForm />
593
+ </Block>
594
+ </Page>
595
+ ```
596
+
597
+ #### A sidebar
598
+
599
+ Use `<SidebarLayout sidebar>`. On a narrow screen the sidebar becomes a drawer with a menu button. Fill its content slot the same way as any other layout.
600
+
601
+ ```tsx
602
+ <SidebarLayout sidebar={<Menu />}>
603
+ <Scroll vertical cover>
604
+ <Router routes={ROUTES} />
605
+ </Scroll>
606
+ </SidebarLayout>
607
+ ```
608
+
609
+ #### A tab bar
610
+
611
+ Use `<AppLayout nav>`. It puts the content slot above a bar, at every screen size. The bar has its own view-transition group, so it stays still while pages slide. Set `nav={false}` to hide the bar.
612
+
613
+ ```tsx
614
+ <AppLayout nav={<StackBar />}>
615
+ <Scroll vertical cover>
616
+ <Router routes={ROUTES} />
617
+ </Scroll>
618
+ </AppLayout>
619
+ ```
620
+
621
+ #### A custom layout with a custom scroll area
622
+
623
+ Make your own frame when no layout fits, for example a header that stays on screen above the content. A frame does three things:
624
+
625
+ 1. It locks the document, so only its own boxes scroll.
626
+ 2. It fills the screen with `position: absolute; inset: 0`, so it works inside a mount element such as `<div id="root">`.
627
+ 3. It gives a content slot with `position: relative`, which a `<Scroll vertical cover>` fills.
628
+
629
+ A frame does not scroll, centre, cache or transition. The app puts those in the slot.
630
+
631
+ ```tsx
632
+ export function TopBarLayout({ bar, children }: TopBarLayoutProps): ReactElement {
633
+ return (
634
+ <div className={LAYOUT_CLASS}>
635
+ <header className={BAR_CLASS}>{bar}</header>
636
+ <main className={CONTENT_CLASS}>{children}</main>
637
+ </div>
638
+ );
639
+ }
640
+ ```
641
+
642
+ ```css
643
+ @layer components {
644
+ html:has(.layout) { height: 100dvh; overflow: hidden; }
645
+ body:has(.layout) { position: fixed; inset: 0; margin: 0; }
646
+ .layout { position: absolute; inset: 0; display: flex; flex-direction: column; }
647
+ .content { position: relative; flex: 1; min-height: 0; overflow: hidden; }
648
+ }
649
+ ```
650
+
651
+ `modules/ui/layout/AppLayout.module.css` in Shelving is a full example, with the safe areas.
652
+
653
+ #### Other scroll boxes
654
+
655
+ `<Scroll>` is not only for pages. Use `<Scroll horizontal>` for a wide table, or `<Scroll vertical cover reverse>` for a chat that starts at the end and stays there as messages arrive. See `<Scroll>`.
656
+
657
+ #### Keep page state when you go back
658
+
659
+ By default a page unmounts when you leave it, so its scroll position, toggles and form input are lost. Add `<RouteCache>` to keep recent pages mounted but hidden. Put the scroll box **inside** the cache, so each page keeps its own scroll position.
660
+
661
+ ```tsx
662
+ <RouteCache>
663
+ <Scroll vertical cover>
664
+ <PageLoader>
665
+ <Router routes={ROUTES} />
666
+ </PageLoader>
667
+ </Scroll>
668
+ </RouteCache>
669
+ ```
670
+
671
+ Keep the layout **outside** the cache, so the chrome has one copy and keeps its own state. Clear a create form after it saves, because the cache keeps its input. See `<RouteCache>`.
672
+
673
+ #### Page transitions
674
+
675
+ Put a page transition, for example `<HorizontalTransition>`, **around** `<RouteCache>` and inside the layout. The pages slide and the chrome stays still. Do not put a transition inside the cache around each page: Safari loses the exit animation.
676
+
677
+ ```tsx
678
+ <AppLayout nav={<StackBar />}>
679
+ <HorizontalTransition>
680
+ <RouteCache>
681
+ <Scroll vertical cover>…</Scroll>
682
+ </RouteCache>
683
+ </HorizontalTransition>
684
+ </AppLayout>
685
+ ```
686
+
687
+ #### Tab stacks, like a phone app
688
+
689
+ Each tab keeps its own stack of pages, and its back button goes back within that tab. You need four parts:
690
+
691
+ 1. Set `stacks` on `<Navigation>` to the root path of each tab, in tab order, and `stack` to the tab the app opens in: `<Navigation stacks={["/home", "/discover", "/profile"]} stack="/home">`.
692
+ 2. Make a tab bar of `<StackButton stack="/home">` buttons, and put it in `<AppLayout nav>`.
693
+ 3. Put `<BackButton href="/home" />` in each page header. It goes back in the current tab, or to `href` when there is no page before.
694
+ 4. Use `<RouteCache>`, so each tab shows the page you left it on.
695
+
696
+ Use `className="replace"` on in-page tab links (for example `/dave/posts` and `/dave/likes`), so they change the URL without a new page. See `<Navigation>`, `NavigationStore`, `<StackButton>` and `<BackButton>`.
697
+
698
+ #### Hide the tab bar on some pages
699
+
700
+ All pages in one stack share one layout, because they share one cache. So a page cannot change the layout itself. Pick the layout props from the URL in your layout picker, above the router:
701
+
702
+ ```tsx
703
+ function Shell() {
704
+ const { path } = requireMetaURL();
705
+ return (
706
+ <AppLayout nav={path.startsWith("/squad/") ? false : <StackBar />}>
707
+ <Content />
708
+ </AppLayout>
709
+ );
710
+ }
711
+ ```
712
+
713
+ #### Pick a layout by state or path
714
+
715
+ The layout picker is plain React, so any rule works: the session, the path, or both. Swap to another layout only between sections the user does not move back and forth in, such as log-in and the main app, because a new layout mounts a new cache.
716
+
717
+ ```tsx
718
+ function Shell({ signedIn }: { signedIn: boolean }) {
719
+ if (!signedIn) return <FixedLayout><Content routes={LOGIN_ROUTES} /></FixedLayout>;
720
+ return <AppLayout nav={<StackBar />}><Content routes={ROUTES} /></AppLayout>;
721
+ }
722
+ ```
723
+
724
+ Put the slot content (transition, cache, scroll box, loader and router) in one small `Content` component, and reuse it in each layout.
725
+
726
+ #### Errors and loading
727
+
728
+ A page, an error page or a loading state never renders a layout. `<PageLoader>` catches errors and shows a loading state inside the scroll box, in the layout the user already sees. An app-level `<Catcher>` sits outside every layout, so it picks one itself:
729
+
730
+ ```tsx
731
+ function AppError({ reason }: ErrorProps) {
732
+ return (
733
+ <FixedLayout>
734
+ <Scroll vertical cover>
735
+ <ErrorPage reason={reason} />
736
+ </Scroll>
737
+ </FixedLayout>
738
+ );
739
+ }
740
+ ```
741
+
551
742
  ## Boundaries
552
743
 
553
744
  Three mechanisms keep the packages honest:
@@ -880,6 +1071,18 @@ What changes for users:
880
1071
 
881
1072
  See `<Navigation>`, `NavigationStore`, `<RouteCache>`, `<StackButton>` and `<BackButton>` for the full details.
882
1073
 
1074
+ ### Layouts are frames
1075
+
1076
+ Layouts no longer include a `<RouteCache>` or a scroll box. Each layout is a frame with a content slot, so the app chooses the scroll box, the transition and the cache. `<CenteredLayout>` is now `<FixedLayout>`, and it no longer centres or scrolls. `<ErrorPage>` and the `<PageLoader>` fallback no longer render a layout. To upgrade an app:
1077
+
1078
+ 1. **Fill the `<SidebarLayout>` slot.** Put `<RouteCache>`, then `<Scroll vertical cover>`, then `<PageLoader>`, then your `<Router>` in it. Without a scroll box, the content does not scroll. Put a page transition around the `<RouteCache>`, inside the layout, so the sidebar stays still.
1079
+ 2. **Change `<CenteredLayout>` to `<FixedLayout>`.** Put a `<Scroll vertical cover>` in it, then your page or `<Router>`. Move the centring into the page: `<Block height="full" middle width="narrow" padding="xxlarge" indent="normal">`. The new `height` and `middle` block variants put the content in the middle of the screen, and it still scrolls when it is taller. The `width`, `padding` and `indent` props and the `--centered-layout-*` hooks are removed; the background and colour hooks are now `--fixed-layout-background` and `--fixed-layout-color`.
1080
+ 3. **Do not render a layout in a page.** A page, an error page or a loading state never renders a layout. Pick the layout once, above the router. An app-level catcher sits outside every layout, so give it one: `<Catcher as={AppError}>`, where `AppError` renders `<ErrorPage>` in a `<FixedLayout>` and a `<Scroll vertical cover>`.
1081
+ 4. **Use `<AppLayout>` for a tab bar (optional).** `<AppLayout nav={<StackBar />}>` puts a bar of `<StackButton>`s below the content slot. Set `nav={false}` to hide it for some pages.
1082
+ 5. **Rename the scroll focus hook.** `--scrollable-focus-border` is now `--scroll-focus-border`.
1083
+
1084
+ See "Composing an app" on `<App>` for the full nesting rules and an example `App.tsx`, and [The app shell](#the-app-shell) above for each part as a recipe.
1085
+
883
1086
  ### From `CacheDBProvider` to `HydratingAPIProvider`
884
1087
 
885
1088
  `CacheDBProvider` and the paging in `QueryStore` are removed. To upgrade an app:
@@ -20062,7 +20265,7 @@ The components below are listed in the index following this page; this is the sh
20062
20265
 
20063
20266
  **Content.** Block-level structure starts with `<Card>`, `<Section>`, and the `<Heading>` / `<Title>` family, with `<Table>`, `<List>`, and `<Figure>` for specific shapes; wrap longform copy in `<Prose>`. Inline pieces — `<Link>`, `<Code>`, `<Strong>`, `<Mark>` — live inside that block content. To render a Markdown string as components, use `<Markup>`.
20064
20267
 
20065
- **Structure.** Mount a client app with `<App>`, or render a full server document with `<HTML>` and `<Page>`. Arrange the screen with `<CenteredLayout>` or `<SidebarLayout>`, and drive URLs with `<Navigation>` and `<Router>`.
20268
+ **Structure.** Mount a client app with `<App>`, or render a full server document with `<HTML>` and `<Page>`. Arrange the screen with `<AppLayout>`, `<SidebarLayout>` or `<FixedLayout>`, and drive URLs with `<Navigation>` and `<Router>`. A layout is a frame: it sits above the router, and the app fills its content slot with `<RouteCache>` and `<Scroll>`. See "Composing an app" on `<App>`.
20066
20269
 
20067
20270
  **Interaction.** Forms start at `<Form>`, which wires `<Field>` and the typed inputs to a `FormStore`; `<Button>` is the standalone action. Overlays are `<Dialog>` and `<Modal>`; navigation menus are `<Menu>` and `<MenuItem>`; transient feedback is `<Notice>` (and the global `<Notices>` list); animate enter/leave with `<Transition>`.
20068
20271
 
@@ -20176,14 +20379,15 @@ The components below are listed in the index following this page; this is the sh
20176
20379
  - [DataSchemaInput](ui/DataSchemaInput.md): Show a DataInput for a nested DataSchema.
20177
20380
  - [SchemaField](ui/SchemaField.md): Show the appropriate input for a schema, wrapped in a <Field> with its label and message.
20178
20381
  - [SelectInput](ui/SelectInput.md): Dropdown input bound to a string value, rendered as a <select> of the provided options.
20179
- - [CenteredLayout](ui/CenteredLayout.md): Layout that centres its content with no header/footer and a narrow max-width.
20180
- - [SidebarLayout](ui/SidebarLayout.md): Layout with a fixed-width side column (typically navigation) next to a scrollable main content column.
20382
+ - [AppLayout](ui/AppLayout.md): Layout with a content slot above a bar of the app's main sections, like the tab bar of a phone app.
20383
+ - [FixedLayout](ui/FixedLayout.md): Layout with no chrome: the whole screen is one content slot.
20384
+ - [SidebarLayout](ui/SidebarLayout.md): Layout with a fixed-width side column (typically navigation) next to a content slot.
20181
20385
  - [Menu](ui/Menu.md): A <menu> list of <MenuItem> children.
20182
20386
  - [MenuItem](ui/MenuItem.md): A <li> containing an <a> link, plus optional submenu content shown when this item is "proud".
20183
20387
  - [Catcher](ui/Catcher.md): React error boundary that renders a fallback component when any descendant throws.
20184
20388
  - [ErrorNotice](ui/ErrorNotice.md): Render a caught error as an inline <Notice> with a retry button.
20185
20389
  - [PageCatcher](ui/PageCatcher.md): Error boundary for a whole page that renders a full <ErrorPage> fallback on error.
20186
- - [ErrorPage](ui/ErrorPage.md): Render a caught error as a full-page <Page> with a centered <ErrorNotice>.
20390
+ - [ErrorPage](ui/ErrorPage.md): Render a caught error as a <Page> with an <ErrorNotice> in a narrow column, centred in the middle of the screen.
20187
20391
  - [Icon](ui/Icon.md): Render the icon for a given status, coloured to match.
20188
20392
  - [Loader](ui/Loader.md): Load a component.
20189
20393
  - [PageLoader](ui/PageLoader.md): Load a page.
@@ -20198,7 +20402,7 @@ The components below are listed in the index following this page; this is the sh
20198
20402
  - [Page](ui/Page.md): Wrap a single page (or screen) within an app, applying its meta and head tags.
20199
20403
  - [BackButton](ui/BackButton.md): Back button for the current stack.
20200
20404
  - [Navigation](ui/Navigation.md): Top-level navigation provider, with one stack of pages for each tab.
20201
- - [RouteCache](ui/RouteCache.md): Keep-alive page cache for the pages in the navigation stacks. Drop it into a layout around its scrolling content region.
20405
+ - [RouteCache](ui/RouteCache.md): Keep-alive page cache for the pages in the navigation stacks. Put it in a layout's content slot, around a <Scroll vertical cover> box.
20202
20406
  - [Router](ui/Router.md): Match the current URL against routes and render the matched element.
20203
20407
  - [StackButton](ui/StackButton.md): Button for one stack in a tab bar.
20204
20408
  - [Scroll](ui/Scroll.md): Wrap children in a scrollable container with horizontal and/or vertical scrolling enabled.
@@ -20271,10 +20475,11 @@ The components below are listed in the index following this page; this is the sh
20271
20475
  - [getFlexClass()](ui/getFlexClass.md): Get the flex layout class for a component from its flex variant props.
20272
20476
  - [getGapClass()](ui/getGapClass.md): Get the gap class for a component from its gap variant prop.
20273
20477
  - [getGridClass()](ui/getGridClass.md): Get the grid layout class for a component from its grid variant props.
20478
+ - [getHeightClass()](ui/getHeightClass.md): Get the height class for a component from its height, top, middle and bottom variant props.
20274
20479
  - [getIndentClass()](ui/getIndentClass.md): Get the inline-padding ("indent") class for a component from its indent variant prop.
20275
20480
  - [getPaddingClass()](ui/getPaddingClass.md): Get the block-padding class for a component from its padding variant prop.
20276
20481
  - [getRadiusClass()](ui/getRadiusClass.md): Get the corner-radius class for a component from its radius variant prop.
20277
- - [getScrollClass()](ui/getScrollClass.md): Get the scroll class for a component from its horizontal / vertical variant props.
20482
+ - [getScrollClass()](ui/getScrollClass.md): Get the scroll class for a component from its horizontal, vertical, cover and reverse variant props.
20278
20483
  - [getShadowClass()](ui/getShadowClass.md): Get the drop-shadow class for a component from its shadow variant prop.
20279
20484
  - [getSpaceClass()](ui/getSpaceClass.md): Get the block spacing class for a component from its space="" variant prop.
20280
20485
  - [getStatusClass()](ui/getStatusClass.md): Get the status tint class for a component from its status variant prop.
@@ -20436,7 +20641,8 @@ The components below are listed in the index following this page; this is the sh
20436
20641
  - [SelectProps](ui/SelectProps.md): Props for SelectInput, a dropdown <select> bound to a string value.
20437
20642
  - [TextareaInputProps](ui/TextareaInputProps.md): Props for TextareaInput, a multiline text input bound to a string value.
20438
20643
  - [TextInputProps](ui/TextInputProps.md): Props for TextInput, a single-line text input bound to a string value.
20439
- - [CenteredLayoutProps](ui/CenteredLayoutProps.md): Props for <CenteredLayout> — optional children plus width (of the centred column) and padding / indent (block / inline padding of the scroll area) variants.
20644
+ - [AppLayoutProps](ui/AppLayoutProps.md): Props for <AppLayout>: the nav bar content and the content slot children.
20645
+ - [FixedLayoutProps](ui/FixedLayoutProps.md): Props for <FixedLayout>: the content slot children.
20440
20646
  - [SidebarLayoutProps](ui/SidebarLayoutProps.md): Props for <SidebarLayout> — the sidebar column content, main children, and a right placement flag.
20441
20647
  - [MenuProps](ui/MenuProps.md): Props for <Menu> — optional <MenuItem> children.
20442
20648
  - [MenuItemProps](ui/MenuItemProps.md): Props for <MenuItem> — <Clickable> props plus children whose first node is the label and the rest the submenu.
@@ -20469,10 +20675,11 @@ The components below are listed in the index following this page; this is the sh
20469
20675
  - [FlexVariants](ui/FlexVariants.md): Variant props for flex layout — opt-in modifiers any component can mix in via getFlexClass().
20470
20676
  - [GapVariants](ui/GapVariants.md): Variant props for the gap between a component's children, e.g. gap="large".
20471
20677
  - [GridVariants](ui/GridVariants.md): Variant props for grid layout, e.g. columns={3} gap="normal".
20678
+ - [HeightVariants](ui/HeightVariants.md): Variant props that set a component's height, and where its content sits inside that height, e.g. height="full" middle.
20472
20679
  - [IndentVariants](ui/IndentVariants.md): Variant props for the inline-padding ("indent", left + right) of a component, e.g. indent="normal".
20473
20680
  - [PaddingVariants](ui/PaddingVariants.md): Variant props for the block-padding (top + bottom) of a component, e.g. padding="large".
20474
20681
  - [RadiusVariants](ui/RadiusVariants.md): Variant props for the corner radius of an element, e.g. radius="large".
20475
- - [ScrollVariants](ui/ScrollVariants.md): Variant props selecting which scroll axes are enabled on an element.
20682
+ - [ScrollVariants](ui/ScrollVariants.md): Variant props for a scroll region: which axes scroll, plus cover and reverse.
20476
20683
  - [ScrollComponentProps](ui/ScrollComponentProps.md): Props for the Scroll component — children plus scroll-axis variants.
20477
20684
  - [ShadowVariants](ui/ShadowVariants.md): Variant props for the drop shadow of an element, e.g. shadow="large".
20478
20685
  - [SpaceVariants](ui/SpaceVariants.md): Variants to control block spacing on components, e.g. space="large".
@@ -20521,6 +20728,7 @@ The components below are listed in the index following this page; this is the sh
20521
20728
  - [ColorVariant](ui/ColorVariant.md): Enumerated colour names selectable via the color="purple" prop for components that support that support ColorVariants
20522
20729
  - [DurationValue](ui/DurationValue.md): Allowed values for transition timing for components that support DurationVariants
20523
20730
  - [ColumnsVariant](ui/ColumnsVariant.md): Number of equal-width columns selectable via the columns variant prop.
20731
+ - [HeightVariant](ui/HeightVariant.md): Enumerated height selectable via the height variant prop.
20524
20732
  - [IndentVariant](ui/IndentVariant.md): Allowed values for inline-padding ("indent") for components that support IndentVariants
20525
20733
  - [RadiusVariant](ui/RadiusVariant.md): Allowed values for border radius for components that support RadiusVariants
20526
20734
  - [ShadowVariant](ui/ShadowVariant.md): Enumerated drop-shadow scale selectable via the shadow="normal" variant prop.
@@ -20613,17 +20821,19 @@ Use `<App>` when mounting into an existing HTML page on the client. For server-s
20613
20821
  The smallest single-screen app — `<App>` wraps a layout and some content:
20614
20822
 
20615
20823
  ```tsx
20616
- import { App, CenteredLayout, Section, Title, Paragraph } from "shelving/ui";
20824
+ import { App, FixedLayout, Paragraph, Scroll, Section, Title } from "shelving/ui";
20617
20825
 
20618
20826
  function HelloApp() {
20619
20827
  return (
20620
20828
  <App app="My app">
20621
- <CenteredLayout>
20622
- <Section width="narrow">
20623
- <Title>Hello</Title>
20624
- <Paragraph>Welcome to the app.</Paragraph>
20625
- </Section>
20626
- </CenteredLayout>
20829
+ <FixedLayout>
20830
+ <Scroll vertical cover>
20831
+ <Section width="narrow">
20832
+ <Title>Hello</Title>
20833
+ <Paragraph>Welcome to the app.</Paragraph>
20834
+ </Section>
20835
+ </Scroll>
20836
+ </FixedLayout>
20627
20837
  </App>
20628
20838
  );
20629
20839
  }
@@ -20654,6 +20864,102 @@ export function MyApp() {
20654
20864
 
20655
20865
  `<App>` accepts all `PossibleMeta` props (`app`, `root`, `url`, `title`, `language`, `tags`, etc.) and merges them into the context it provides to children. On mount it adds the theme class to `document.body`, which activates the CSS custom property tokens defined in `App.module.css`; on unmount it removes it.
20656
20866
 
20867
+ ## Composing an app
20868
+
20869
+ An app is built from layers, each with one job. Write them in plain sight in `App.tsx`, from the outside in:
20870
+
20871
+ 1. **Contexts**: `<App>`, your data contexts, `<Navigation>`, `<DialogsContext>`.
20872
+ 2. **App-level catcher**: a last resort, outside every layout.
20873
+ 3. **Layout picker**: your own component that picks the layout (and its props) from the session, the path, or any other state.
20874
+ 4. **Layout**: `<AppLayout>`, `<SidebarLayout>` or `<FixedLayout>`. It draws the chrome (tab bar, sidebar) and gives a content slot. It knows nothing about the cache.
20875
+ 5. **Content**: transition, then `<RouteCache>`, then `<Scroll vertical cover>`, then `<PageLoader>`, then `<Router>`. Put it in a small component of your own, and reuse it in each layout.
20876
+ 6. **Page**: `<Page>` with its title, then the page content. A page renders no layout.
20877
+
20878
+ Nesting rules:
20879
+
20880
+ - The layout sits **above** the router. A page, an error page or a loading state never renders a layout.
20881
+ - The transition goes **around** `<RouteCache>`, not inside it.
20882
+ - `<Scroll vertical cover>` goes **inside** `<RouteCache>`, so each page keeps its own scroll.
20883
+ - Chrome that keeps state or animates (a tab bar, a sidebar) stays in the layout, **outside** the cache.
20884
+ - All pages in one stack must share one layout, because they share one `<RouteCache>`. To change the chrome for some pages (hide the tab bar), change a layout prop from the picker, for example `nav={false}`. Swap to another layout only between sections you do not move back and forth in, such as log-in and the main app.
20885
+
20886
+ ```tsx
20887
+ import { useStore } from "shelving/react";
20888
+ import {
20889
+ App, AppLayout, Catcher, DialogsContext, Dialogs, ErrorPage, FixedLayout, HorizontalTransition,
20890
+ Navigation, Notices, PageLoader, requireMetaURL, RouteCache, Router, type ErrorProps, type Routes,
20891
+ Scroll, StackButton,
20892
+ } from "shelving/ui";
20893
+
20894
+ const STACKS = ["/home", "/discover", "/profile"] as const;
20895
+
20896
+ /** 1–2. Contexts and the app-level catcher. No layout here. */
20897
+ export function MyApp() {
20898
+ const session = useStore(SESSION).value;
20899
+ return (
20900
+ <App key={session?.id ?? "out"} app="My app" root="https://example.com/">
20901
+ <Navigation stacks={STACKS} stack="/home">
20902
+ <DialogsContext>
20903
+ <Catcher as={AppError}>
20904
+ <Shell signedIn={!!session} />
20905
+ </Catcher>
20906
+ <Dialogs />
20907
+ <Notices />
20908
+ </DialogsContext>
20909
+ </Navigation>
20910
+ </App>
20911
+ );
20912
+ }
20913
+
20914
+ /** 3–4. Pick the layout. Plain React, so any rule works. */
20915
+ function Shell({ signedIn }: { signedIn: boolean }) {
20916
+ const { path } = requireMetaURL();
20917
+ if (!signedIn) return <FixedLayout><Content routes={LOGIN_ROUTES} /></FixedLayout>;
20918
+ return (
20919
+ <AppLayout nav={path.startsWith("/squad/") ? false : <StackBar />}>
20920
+ <Content routes={ROUTES} />
20921
+ </AppLayout>
20922
+ );
20923
+ }
20924
+
20925
+ /** 5. The content of a layout's slot. */
20926
+ function Content({ routes }: { routes: Routes }) {
20927
+ return (
20928
+ <HorizontalTransition>
20929
+ <RouteCache>
20930
+ <Scroll vertical cover>
20931
+ <PageLoader>
20932
+ <Router routes={routes} />
20933
+ </PageLoader>
20934
+ </Scroll>
20935
+ </RouteCache>
20936
+ </HorizontalTransition>
20937
+ );
20938
+ }
20939
+
20940
+ /** The tab bar, in the layout, outside the cache. */
20941
+ function StackBar() {
20942
+ return <>
20943
+ <StackButton stack="/home" title="Home"><HomeIcon /></StackButton>
20944
+ <StackButton stack="/discover" title="Discover"><SearchIcon /></StackButton>
20945
+ <StackButton stack="/profile" title="Profile"><ProfileIcon /></StackButton>
20946
+ </>;
20947
+ }
20948
+
20949
+ /** An error outside every layout: the app picks one here. */
20950
+ function AppError({ reason }: ErrorProps) {
20951
+ return (
20952
+ <FixedLayout>
20953
+ <Scroll vertical cover>
20954
+ <ErrorPage reason={reason} />
20955
+ </Scroll>
20956
+ </FixedLayout>
20957
+ );
20958
+ }
20959
+ ```
20960
+
20961
+ Layouts are optional. With no layout, the document body scrolls, which is fine for a simple site. Use a layout when the app scrolls inside its own boxes: it locks the body and gives a content slot. Every layout is a frame: none of them scroll or centre. A page centres its own content, for example with `<Block height="full" middle width="narrow">`.
20962
+
20657
20963
  For a documentation site, hand an extracted tree to `<TreeApp>` instead — see the `shelving/extract` guide.
20658
20964
 
20659
20965
 
@@ -30490,14 +30796,127 @@ TextInput({
30490
30796
 
30491
30797
  ---
30492
30798
 
30493
- # CenteredLayoutProps
30799
+ # AppLayoutProps
30494
30800
 
30495
30801
  - Kind: interface
30496
- - Import: `import { CenteredLayoutProps } from "shelving/ui";`
30497
- - Extends: `WidthVariants`
30802
+ - Import: `import { AppLayoutProps } from "shelving/ui";`
30803
+ - Extends: `OptionalChildProps`
30498
30804
 
30499
- Props for `<CenteredLayout>` — optional `children` plus `width` (of the centred column) and `padding` / `indent`
30500
- (block / inline padding of the scroll area) variants.
30805
+ Props for `<AppLayout>`: the `nav` bar content and the content slot `children`.
30806
+
30807
+ ## Signatures
30808
+
30809
+ ```ts
30810
+ {
30811
+ nav?: ReactNode;
30812
+ }
30813
+ ```
30814
+
30815
+ ## Properties
30816
+
30817
+ | Property | Type | Description |
30818
+ | --- | --- | --- |
30819
+ | `nav` | `ReactNode` | Items for the bar below the content, for example a `<StackButton>` for each tab. Set `false` (or leave it out) to show no bar. Optional. |
30820
+
30821
+
30822
+ ---
30823
+
30824
+ # AppLayout
30825
+
30826
+ - Kind: component
30827
+ - Import: `import { AppLayout } from "shelving/ui";`
30828
+
30829
+ Layout with a content slot above a bar of the app's main sections, like the tab bar of a phone app.
30830
+ - It is a frame only: the content slot does not scroll. Fill it with `<Scroll vertical cover>`, inside `<RouteCache>`, so each page scrolls in its own box.
30831
+ - The bar sits below the content slot, not over it, and it stays still while a page slides.
30832
+ - Set `nav={false}` to hide the bar, for example for a full-screen page. Change the prop in place (from the URL), so the layout and its page cache stay mounted.
30833
+
30834
+ A full-viewport layout with a content slot above a bar of the app's main sections, like the tab bar of a phone app. It is a frame only: it draws the bar and gives the content slot, and the app fills the slot.
30835
+
30836
+ **Things to know:**
30837
+
30838
+ - The content slot does not scroll. Fill it with `<Scroll vertical cover>` inside `<RouteCache>`, so each page scrolls in its own box and keeps its own scroll position.
30839
+ - The bar sits below the content slot, not over it. So pages need no extra space at the bottom for the bar.
30840
+ - The bar shows at every screen size.
30841
+ - The content slot stays clear of the notch and the rounded screen corners, and the bar stays clear of the home bar (safe-area insets).
30842
+ - Each item in the bar takes an equal share of its width, up to `--app-layout-nav-item-width` each.
30843
+ - The bar is outside the page cache, so it has one copy. It keeps its state, and the CSS transitions of its items (an active tab) still play while a page slides.
30844
+ - The bar has its own view-transition group, so it stays still while the page slides under it.
30845
+ - Leave out `nav`, or set it to `false`, to show no bar. The content slot then fills the screen. To hide the bar for some pages, change the prop from the URL, so the layout and its page cache stay mounted: `nav={path.startsWith("/squad/") ? false : <StackBar />}`.
30846
+ - Pages, error pages and loading states never render it themselves. Pick it above the router. See "Composing an app" on `<App>`.
30847
+
30848
+ ## Usage
30849
+
30850
+ ```tsx
30851
+ import { AppLayout, HorizontalTransition, PageLoader, RouteCache, Router, Scroll, StackButton } from "shelving/ui";
30852
+
30853
+ function StackBar() {
30854
+ return <>
30855
+ <StackButton stack="/home" title="Home"><HomeIcon /></StackButton>
30856
+ <StackButton stack="/discover" title="Discover"><SearchIcon /></StackButton>
30857
+ <StackButton stack="/profile" title="Profile"><ProfileIcon /></StackButton>
30858
+ </>;
30859
+ }
30860
+
30861
+ <AppLayout nav={<StackBar />}>
30862
+ <HorizontalTransition>
30863
+ <RouteCache>
30864
+ <Scroll vertical cover>
30865
+ <PageLoader>
30866
+ <Router routes={ROUTES} />
30867
+ </PageLoader>
30868
+ </Scroll>
30869
+ </RouteCache>
30870
+ </HorizontalTransition>
30871
+ </AppLayout>
30872
+ ```
30873
+
30874
+ ## Styling
30875
+
30876
+ | Variable | Styles | Default |
30877
+ |---|---|---|
30878
+ | `--app-layout-background` | Page background while the layout is mounted | `var(--tint-100)` (white) |
30879
+ | `--app-layout-color` | Text colour for the layout | `var(--tint-00)` (black) |
30880
+ | `--app-layout-nav-background` | Bar fill (also fills the home-bar area below it) | `var(--tint-100)` (white) |
30881
+ | `--app-layout-nav-color` | Bar text and icon colour | `var(--tint-00)` (black) |
30882
+ | `--app-layout-nav-border` | Line above the bar | `var(--stroke-normal) solid var(--tint-90)` |
30883
+ | `--app-layout-nav-shadow` | Shadow of the bar, for example a soft shadow above it | `none` |
30884
+ | `--app-layout-nav-item-width` | Largest width of one bar item | `6rem` |
30885
+
30886
+ The bar keeps its items clear of the home bar and the rounded screen corners with safe-area insets.
30887
+
30888
+ **Global tokens it reads** — `--tint-00`, `--tint-90`, `--tint-100`, and `--stroke-normal`.
30889
+
30890
+
30891
+ ## Signatures
30892
+
30893
+ ```ts
30894
+ AppLayout({ nav, children }: AppLayoutProps): ReactElement
30895
+ ```
30896
+
30897
+ ## Parameters
30898
+
30899
+ | Param | Type | Description |
30900
+ | --- | --- | --- |
30901
+ | `props` | `AppLayoutProps` | |
30902
+ | `.nav` | `ReactNode` | Items for the bar below the content, for example a `<StackButton>` for each tab. Set `false` (or leave it out) to show no bar. Optional. |
30903
+
30904
+ ## Returns
30905
+
30906
+ | Type | Description |
30907
+ | --- | --- |
30908
+ | `ReactElement` | |
30909
+
30910
+
30911
+ ---
30912
+
30913
+ # FixedLayoutProps
30914
+
30915
+ - Kind: interface
30916
+ - Import: `import { FixedLayoutProps } from "shelving/ui";`
30917
+ - Extends: `OptionalChildProps`
30918
+
30919
+ Props for `<FixedLayout>`: the content slot `children`.
30501
30920
 
30502
30921
  ## Signatures
30503
30922
 
@@ -30508,66 +30927,91 @@ Props for `<CenteredLayout>` — optional `children` plus `width` (of the centre
30508
30927
 
30509
30928
  ---
30510
30929
 
30511
- # CenteredLayout
30930
+ # FixedLayout
30512
30931
 
30513
30932
  - Kind: component
30514
- - Import: `import { CenteredLayout } from "shelving/ui";`
30933
+ - Import: `import { FixedLayout } from "shelving/ui";`
30515
30934
 
30516
- Layout that centres its content with no header/footer and a narrow max-width.
30517
- - Used for e.g. login/register/error/form pages where the content is the only focus.
30935
+ Layout with no chrome: the whole screen is one content slot.
30936
+ - It locks the document and gives a full-height slot inside the safe areas. It does not scroll or centre.
30937
+ - Fill the slot with `<Scroll vertical cover>`. Used for e.g. log-in and error screens, and full-screen pages.
30518
30938
 
30519
- A full-viewport layout that centres its content — vertically and horizontally — inside a narrow max-width column. Good for login, registration, error, and other focused single-purpose pages where the content is the only thing on screen. When the content is taller than the viewport it scrolls vertically, pinned to the top so nothing is clipped.
30939
+ A full-viewport layout with no chrome: the whole screen is one content slot. It locks the document, so the page behind never scrolls or rubber-bands, and gives a full-height slot inside the safe areas. Use it for log-in and error screens, and other full-screen pages.
30520
30940
 
30521
30941
  **Things to know:**
30522
30942
 
30523
- - Pass the `width` variant to resize the centred column (e.g. `width="normal"`, `width="wide"`, or `width="full"` to fill the available width).
30524
- - Pass the `padding` (block / top + bottom) and `indent` (inline / left + right) variants to change the space around the content.
30525
- - Like the other full-viewport layouts it owns scroll, padding, and safe-area insets so individual pages don't have to.
30943
+ - It is a frame only. It does not scroll or centre. Fill the slot with `<Scroll vertical cover>`, so the content scrolls inside it.
30944
+ - Centre the content in the page itself, for example with `<Block height="full" middle width="narrow">`: it puts the content in the middle of the screen, and it still scrolls when it is taller.
30945
+ - The slot stays clear of the notch, the home bar and the rounded screen corners (safe-area insets).
30946
+ - For pages that you move back and forth between, put a `<RouteCache>` around the scroll box, as in `<AppLayout>`.
30947
+ - Pages, error pages and loading states never render it themselves. Pick it above the router. See "Composing an app" on `<App>`.
30526
30948
 
30527
30949
  ## Usage
30528
30950
 
30529
30951
  ```tsx
30530
- import { CenteredLayout, Section } from "shelving/ui";
30952
+ import { Block, FixedLayout, Router, Scroll } from "shelving/ui";
30953
+
30954
+ // The signed-out screens: one layout around their own router.
30955
+ <FixedLayout>
30956
+ <Scroll vertical cover>
30957
+ <Router routes={{
30958
+ "/login": LoginPage,
30959
+ "/register": RegisterPage,
30960
+ }} />
30961
+ </Scroll>
30962
+ </FixedLayout>
30531
30963
 
30964
+ // Each page centres its own content.
30532
30965
  function LoginPage() {
30533
30966
  return (
30534
- <CenteredLayout width="narrow">
30535
- <Section>
30536
- <LoginForm/>
30537
- </Section>
30538
- </CenteredLayout>
30967
+ <Page title="Log in">
30968
+ <Block height="full" middle width="narrow" padding="xxlarge" indent="normal">
30969
+ <LoginForm />
30970
+ </Block>
30971
+ </Page>
30539
30972
  );
30540
30973
  }
30541
30974
  ```
30542
30975
 
30543
- Layouts compose naturally as `<Router>` route values — wrap a group of routes in a shared layout, then route further inside it.
30976
+ An app-level error, outside every other layout:
30977
+
30978
+ ```tsx
30979
+ import { Catcher, ErrorPage, type ErrorProps, FixedLayout, Scroll } from "shelving/ui";
30980
+
30981
+ function AppError({ reason }: ErrorProps) {
30982
+ return (
30983
+ <FixedLayout>
30984
+ <Scroll vertical cover>
30985
+ <ErrorPage reason={reason} />
30986
+ </Scroll>
30987
+ </FixedLayout>
30988
+ );
30989
+ }
30990
+
30991
+ <Catcher as={AppError}>…</Catcher>
30992
+ ```
30544
30993
 
30545
30994
  ## Styling
30546
30995
 
30547
30996
  | Variable | Styles | Default |
30548
30997
  |---|---|---|
30549
- | `--centered-layout-width` | Width of the centred column (capped at 100%) | `var(--width-narrow)` |
30550
- | `--centered-layout-padding` | Block (top/bottom) padding of the scroll area | `var(--space-normal)` |
30551
- | `--centered-layout-indent` | Inline (left/right) padding of the scroll area | `var(--space-normal)` |
30552
- | `--centered-layout-background` | Page background while the layout is mounted | `var(--tint-100)` (white) |
30553
- | `--centered-layout-color` | Text colour for the layout | `var(--tint-00)` (black) |
30554
-
30555
- The column width and the scroll-area padding can also be set per-instance via the `width`, `padding`, and `indent` variant props. The outer element owns its scroll, padding, and safe-area behaviour directly — safe-area insets are applied as transparent borders so they stack with (rather than replace) the padding.
30998
+ | `--fixed-layout-background` | Page background while the layout is mounted | `var(--tint-100)` (white) |
30999
+ | `--fixed-layout-color` | Text colour for the layout | `var(--tint-00)` (black) |
30556
31000
 
30557
- **Global tokens it reads** — `--width-narrow`, `--space-normal`, `--tint-100`, and `--tint-00`.
31001
+ **Global tokens it reads** — `--tint-00` and `--tint-100`.
30558
31002
 
30559
31003
 
30560
31004
  ## Signatures
30561
31005
 
30562
31006
  ```ts
30563
- CenteredLayout({ children, ...props }: CenteredLayoutProps): ReactElement
31007
+ FixedLayout({ children }: FixedLayoutProps): ReactElement
30564
31008
  ```
30565
31009
 
30566
31010
  ## Parameters
30567
31011
 
30568
31012
  | Param | Type | Description |
30569
31013
  | --- | --- | --- |
30570
- | `props` | `CenteredLayoutProps` | |
31014
+ | `props` | `FixedLayoutProps` | |
30571
31015
 
30572
31016
  ## Returns
30573
31017
 
@@ -30610,14 +31054,14 @@ Props for `<SidebarLayout>` — the `sidebar` column content, main `children`, a
30610
31054
  - Kind: component
30611
31055
  - Import: `import { SidebarLayout } from "shelving/ui";`
30612
31056
 
30613
- Layout with a fixed-width side column (typically navigation) next to a scrollable main content column.
31057
+ Layout with a fixed-width side column (typically navigation) next to a content slot.
30614
31058
  - The sidebar is rendered as `<nav>` — it almost always contains the page's primary navigation.
30615
31059
  - On narrow viewports the sidebar becomes an off-canvas drawer toggled by a single menu button that switches between a burger and a close icon.
30616
31060
  - While the drawer is open an overlay dims the rest of the page; clicking the overlay closes the drawer.
30617
31061
  - Inside a `<Navigation>` the drawer closes itself whenever the route changes (e.g. tapping a sidebar link).
30618
- - The scrollable content column is kept alive across navigation via `<RouteCache>`, so returning to a recently-visited page restores its scroll position and state; the sidebar stays mounted throughout.
31062
+ - It is a frame only: the content slot does not scroll. Fill it with `<Scroll vertical cover>`, inside `<RouteCache>`, so each page scrolls in its own box. The sidebar stays outside the cache, so it keeps its own state and scroll.
30619
31063
 
30620
- A full-viewport layout with a fixed-width side column next to a scrollable main content column. The sidebar renders as a `<nav>` landmark — it almost always holds the primary navigation. On narrow viewports it collapses to an off-canvas drawer toggled by a single burger/close button.
31064
+ A full-viewport layout with a fixed-width side column next to a content slot. The sidebar renders as a `<nav>` landmark — it almost always holds the primary navigation. On narrow viewports it collapses to an off-canvas drawer toggled by a single burger/close button.
30621
31065
 
30622
31066
  **Things to know:**
30623
31067
 
@@ -30626,12 +31070,15 @@ A full-viewport layout with a fixed-width side column next to a scrollable main
30626
31070
  - While the drawer is open an overlay dims the page; clicking the overlay closes it.
30627
31071
  - Under `prefers-reduced-motion: reduce` the drawer snaps open/closed instead of sliding off-canvas; the overlay keeps its dimming fade, which is opacity-only and therefore reduced-motion-safe.
30628
31072
  - Inside a `<Navigation>` context the drawer closes itself whenever the route changes (e.g. tapping a sidebar link).
30629
- - The layout owns scroll, padding, and safe-area insets so individual pages don't have to.
31073
+ - It is a frame only. The content slot does not scroll: fill it with `<Scroll vertical cover>` inside `<RouteCache>`, so each page scrolls in its own box. Content put in the slot without a scroll box does not scroll.
31074
+ - The sidebar stays outside the page cache, so it keeps its own scroll position and state as pages change.
31075
+ - On a narrow screen the menu button floats at the top right of the content slot, above the page.
31076
+ - Pages, error pages and loading states never render it themselves. Pick it above the router. See "Composing an app" on `<App>`.
30630
31077
 
30631
31078
  ## Usage
30632
31079
 
30633
31080
  ```tsx
30634
- import { SidebarLayout, Menu, MenuItem, Router } from "shelving/ui";
31081
+ import { Menu, MenuItem, PageLoader, RouteCache, Router, Scroll, SidebarLayout } from "shelving/ui";
30635
31082
 
30636
31083
  function AppShell() {
30637
31084
  const nav = (
@@ -30643,13 +31090,19 @@ function AppShell() {
30643
31090
  );
30644
31091
  return (
30645
31092
  <SidebarLayout sidebar={nav}>
30646
- <Router routes={ROUTES}/>
31093
+ <RouteCache>
31094
+ <Scroll vertical cover>
31095
+ <PageLoader>
31096
+ <Router routes={ROUTES}/>
31097
+ </PageLoader>
31098
+ </Scroll>
31099
+ </RouteCache>
30647
31100
  </SidebarLayout>
30648
31101
  );
30649
31102
  }
30650
31103
  ```
30651
31104
 
30652
- Layouts compose naturally as `<Router>` route values — wrap a group of routes in a shared layout, then route further inside it.
31105
+ To slide pages, put a transition around the `<RouteCache>`, inside the layout. The sidebar is outside the transition, so it stays still.
30653
31106
 
30654
31107
  ## Styling
30655
31108
 
@@ -30663,7 +31116,7 @@ Layouts compose naturally as `<Router>` route values — wrap a group of routes
30663
31116
  | `--sidebar-layout-border` | Divider between sidebar and content, e.g. `1px solid var(--tint-90)` | `none` |
30664
31117
  | `--sidebar-layout-shadow` | Drop shadow of the open drawer on a narrow screen | `var(--shadow-large)` |
30665
31118
 
30666
- The sidebar and content columns own their own scroll behaviour directly (this layout no longer composes a shared `.layout` class).
31119
+ The sidebar scrolls on its own. The content slot does not scroll: its `<Scroll vertical cover>` box does.
30667
31120
 
30668
31121
  **Global tokens it reads** — `--tint-00` / `--tint-90` / `--tint-100`, plus `--space-normal`, `--duration-normal`, `--shadow-large`, and `--color-backdrop`.
30669
31122
 
@@ -30993,7 +31446,7 @@ A React error boundary that catches errors thrown anywhere in its subtree and re
30993
31446
 
30994
31447
  **Things to know:**
30995
31448
 
30996
- - `PageCatcher` is a convenience wrapper that renders `ErrorPage` instead — a full-page error display inside a `<CenteredLayout>`.
31449
+ - `PageCatcher` is a convenience wrapper that renders `ErrorPage` instead — a page with the error in a narrow column. `ErrorPage` renders no layout, so it shows inside the layout around it. An app-level catcher sits outside every layout, so give it one: `<Catcher as={AppError}>`, where `AppError` renders `<ErrorPage>` in a `<FixedLayout>` and `<Scroll vertical cover>` (see `<FixedLayout>`).
30997
31450
  - `RetryButton` reads the retry callback from the nearest `Catcher` via context and renders a `<Button>`. It returns `null` when there is no parent catcher to retry.
30998
31451
  - `ErrorNotice` and `ErrorPage` can be used standalone when you need to display a known error without a boundary. Both use `getMessage()` to extract a human-readable message, falling back to `"Unknown error"`.
30999
31452
 
@@ -31129,7 +31582,8 @@ PageCatcher({ children }: ChildProps): ReactElement
31129
31582
  - Kind: component
31130
31583
  - Import: `import { ErrorPage } from "shelving/ui";`
31131
31584
 
31132
- Render a caught error as a full-page `<Page>` with a centered `<ErrorNotice>`.
31585
+ Render a caught error as a `<Page>` with an `<ErrorNotice>` in a narrow column, centred in the middle of the screen.
31586
+ - It renders no layout, so it shows inside whatever layout is around it. Outside every layout (an app-level catcher), wrap it in one, for example `<FixedLayout>` with a `<Scroll vertical cover>`.
31133
31587
 
31134
31588
  ## Signatures
31135
31589
 
@@ -31321,11 +31775,12 @@ Load a page.
31321
31775
 
31322
31776
  - Wrapped in `<PageCatcher>` so child components can throw errors.
31323
31777
  - Wrapped in `<Suspense>` so child components can throw promises.
31778
+ - It renders no layout, so its loading state and error page show inside whatever layout is around it.
31324
31779
 
31325
31780
  ## Signatures
31326
31781
 
31327
31782
  ```ts
31328
- PageLoader({ children, fallback = <CenteredLayout>{LOADING}</CenteredLayout> }: LoaderProps): ReactElement
31783
+ PageLoader({ children, fallback = PAGE_LOADING }: LoaderProps): ReactElement
31329
31784
  ```
31330
31785
 
31331
31786
  ## Parameters
@@ -32621,16 +33076,20 @@ function UserPage({ id }: { id: string }) {
32621
33076
  }
32622
33077
  ```
32623
33078
 
32624
- Layouts go inside `<Page>`:
33079
+ A page renders no layout. The layout goes outside the page, above the router, so every page in it shares one frame. See "Composing an app" on `<App>`.
32625
33080
 
32626
33081
  ```tsx
32627
- import { Page, CenteredLayout } from "shelving/ui";
33082
+ import { Block, FixedLayout, Page, Scroll } from "shelving/ui";
32628
33083
 
32629
- <Page title="Sign in">
32630
- <CenteredLayout>
32631
- <LoginForm/>
32632
- </CenteredLayout>
32633
- </Page>
33084
+ <FixedLayout>
33085
+ <Scroll vertical cover>
33086
+ <Page title="Sign in">
33087
+ <Block height="full" middle width="narrow">
33088
+ <LoginForm/>
33089
+ </Block>
33090
+ </Page>
33091
+ </Scroll>
33092
+ </FixedLayout>
32634
33093
  ```
32635
33094
 
32636
33095
 
@@ -32844,26 +33303,35 @@ import { App, Navigation, Router } from "shelving/ui";
32844
33303
  List the root path of each stack in tab order. Put a `<StackButton>` for each stack in the tab bar.
32845
33304
 
32846
33305
  ```tsx
32847
- import { App, HorizontalTransition, Navigation, RouteCache, Router, StackButton } from "shelving/ui";
33306
+ import { App, AppLayout, HorizontalTransition, Navigation, PageLoader, RouteCache, Router, Scroll, StackButton } from "shelving/ui";
32848
33307
 
32849
33308
  const STACKS = ["/home", "/discover", "/profile"] as const;
32850
33309
 
33310
+ const TABS = <>
33311
+ <StackButton stack="/home">Home</StackButton>
33312
+ <StackButton stack="/discover">Discover</StackButton>
33313
+ <StackButton stack="/profile">Profile</StackButton>
33314
+ </>;
33315
+
32851
33316
  <App root="https://example.com/">
32852
33317
  <Navigation stacks={STACKS}>
32853
- <HorizontalTransition>
32854
- <RouteCache>
32855
- <Router routes={ROUTES}/>
32856
- </RouteCache>
32857
- </HorizontalTransition>
32858
- <nav className="tab-bar">
32859
- <StackButton stack="/home">Home</StackButton>
32860
- <StackButton stack="/discover">Discover</StackButton>
32861
- <StackButton stack="/profile">Profile</StackButton>
32862
- </nav>
33318
+ <AppLayout nav={TABS}>
33319
+ <HorizontalTransition>
33320
+ <RouteCache>
33321
+ <Scroll vertical cover>
33322
+ <PageLoader>
33323
+ <Router routes={ROUTES}/>
33324
+ </PageLoader>
33325
+ </Scroll>
33326
+ </RouteCache>
33327
+ </HorizontalTransition>
33328
+ </AppLayout>
32863
33329
  </Navigation>
32864
33330
  </App>
32865
33331
  ```
32866
33332
 
33333
+ The tab bar is in the layout, outside the cache, so it stays still while pages slide. See "Composing an app" on `<App>` for the full nesting rules.
33334
+
32867
33335
  To select a tab when the app starts, pass the starting `stack`. The app decides which stack the opening URL belongs to, for example:
32868
33336
 
32869
33337
  ```tsx
@@ -33330,8 +33798,9 @@ Props for `<RouteCache>`: the `maxCached` size and the content `children` to kee
33330
33798
  - Kind: component
33331
33799
  - Import: `import { RouteCache } from "shelving/ui";`
33332
33800
 
33333
- Keep-alive page cache for the pages in the navigation stacks. Drop it into a layout around its scrolling content region.
33801
+ Keep-alive page cache for the pages in the navigation stacks. Put it in a layout's content slot, around a `<Scroll vertical cover>` box.
33334
33802
 
33803
+ - Put a page transition around it, and a `<Scroll vertical cover>` inside it, so each kept page scrolls in its own box.
33335
33804
  - Keeps each page in the stacks mounted but hidden (with React's `<Activity>`), so going back to a page, or switching back to a tab, shows it exactly as you left it.
33336
33805
  - Each page is keyed by its stack and its depth in that stack, not by its URL. So `NavigationStore.replace()` (a canonical URL, an in-page tab) keeps the same page mounted, and the same URL open in two tabs is two separate pages.
33337
33806
  - A page leaves the cache as soon as it leaves its stack: when you go back from it, or when a stack is popped to its root. After a browser back, a browser forward shows that page fresh.
@@ -33340,9 +33809,9 @@ Keep-alive page cache for the pages in the navigation stacks. Drop it into a lay
33340
33809
  - `<Activity mode="hidden">` keeps a hidden page's state but unmounts its effects, so its subscriptions and timers pause and resume as it is hidden and shown.
33341
33810
  - Without the browser Navigation API (older browsers, server renders), or with `maxCached` of `0`, it renders the current page directly with no cache.
33342
33811
 
33343
- A keep-alive cache for the pages in the navigation stacks. Put it in a layout around the scrolling content region. It keeps each page in the stacks mounted but hidden (with React's [`<Activity>`](https://react.dev/reference/react/Activity)), so when you go back to a page, or switch back to a tab, the page is exactly as you left it: scroll position, toggles, searches, form input and focus.
33812
+ A keep-alive cache for the pages in the navigation stacks. Put it in a layout's content slot, around a `<Scroll vertical cover>` box. It keeps each page in the stacks mounted but hidden (with React's [`<Activity>`](https://react.dev/reference/react/Activity)), so when you go back to a page, or switch back to a tab, the page is exactly as you left it: scroll position, toggles, searches, form input and focus.
33344
33813
 
33345
- `<SidebarLayout>` and `<CenteredLayout>` already wrap their content in a `<RouteCache>`. Use it by hand only in a custom layout.
33814
+ Layouts do not include a cache. The app composes it, so it can also choose the transition, or leave the cache out.
33346
33815
 
33347
33816
  **Things to know:**
33348
33817
 
@@ -33355,33 +33824,37 @@ A keep-alive cache for the pages in the navigation stacks. Put it in a layout ar
33355
33824
  - A form that makes something stays in the cache with its input. Clear it after a successful submit, so it is empty the next time you see it (see the example below).
33356
33825
  - Each kept page is frozen under its own `<Meta>`, so a hidden page never re-renders for another page's URL.
33357
33826
  - `<Activity mode="hidden">` keeps a hidden page's state but unmounts its effects, so subscriptions, observers (for example infinite scroll) and timers pause and resume as the page is hidden and shown.
33358
- - The cache must wrap the scroll container itself to keep each page's scroll. So it goes in the layout around the scrolling column, not inside the router. Chrome outside the cache (a sidebar, a tab bar) is not duplicated or remounted.
33359
- - Put a page `<Transition>` around the `<RouteCache>`, not inside it. Safari (iOS 18) loses the exit animation when each page has its own `<ViewTransition>`.
33827
+ - **Nesting:** layout, then transition, then `<RouteCache>`, then `<Scroll vertical cover>`, then `<PageLoader>`, then `<Router>`. See the usage below.
33828
+ - The scroll box goes **inside** the cache, so each kept page has its own scroll box and keeps its own scroll position. A scroll box outside the cache is shared by every page, so pages lose their scroll.
33829
+ - Put a page `<Transition>` **around** the `<RouteCache>`, not inside it. Safari (iOS 18) loses the exit animation when each page has its own `<ViewTransition>`.
33830
+ - Keep the layout **outside** the cache. Chrome in the layout (a sidebar, a tab bar) then has one copy, keeps its own state, and plays its own CSS transitions. Chrome inside the cache gets one copy per kept page.
33360
33831
  - Without the browser Navigation API, or with `maxCached={0}`, there is no cache: the current page renders directly and unmounts when you leave it.
33361
33832
 
33362
33833
  ## Usage
33363
33834
 
33364
33835
  ```tsx
33365
- import { HorizontalTransition, RouteCache, Router } from "shelving/ui";
33836
+ import { AppLayout, HorizontalTransition, PageLoader, RouteCache, Router, Scroll } from "shelving/ui";
33366
33837
 
33367
- function MyLayout() {
33368
- return (
33369
- <HorizontalTransition>
33370
- <RouteCache>
33371
- <main className="scroll">
33838
+ <AppLayout nav={<StackBar />}>
33839
+ <HorizontalTransition>
33840
+ <RouteCache>
33841
+ <Scroll vertical cover>
33842
+ <PageLoader>
33372
33843
  <Router routes={ROUTES}/>
33373
- </main>
33374
- </RouteCache>
33375
- </HorizontalTransition>
33376
- );
33377
- }
33844
+ </PageLoader>
33845
+ </Scroll>
33846
+ </RouteCache>
33847
+ </HorizontalTransition>
33848
+ </AppLayout>
33378
33849
  ```
33379
33850
 
33380
33851
  Keep fewer pages:
33381
33852
 
33382
33853
  ```tsx
33383
33854
  <RouteCache maxCached={5}>
33384
- <Router routes={ROUTES}/>
33855
+ <Scroll vertical cover>
33856
+ <Router routes={ROUTES}/>
33857
+ </Scroll>
33385
33858
  </RouteCache>
33386
33859
  ```
33387
33860
 
@@ -33484,7 +33957,7 @@ A pure URL matcher: it reads the current URL from the surrounding `<Meta>` conte
33484
33957
  - With a `base` set, the path used for matching is the URL after `matchURLPrefix()` strips the base prefix; URLs outside the base render as `null`.
33485
33958
  - Pass `fallback` to control no-match behaviour. An explicit `null` renders nothing; leaving it `undefined` throws a `NotFoundError`.
33486
33959
  - Inside `<Navigation>` with stacks, each page in a stack is a new page: a link mounts a new page, and `NavigationStore.replace()` keeps the same page mounted (it re-renders with the new URL). Elsewhere each path is a new page.
33487
- - `<Router>` itself does not cache pages — wrap it in a `<RouteCache>` (or use a layout that already does) to keep recently-visited pages mounted but hidden so back/forward navigation restores their state.
33960
+ - `<Router>` itself does not cache pages — wrap it in a `<RouteCache>` (with a `<Scroll vertical cover>` between them) to keep recently-visited pages mounted but hidden so back/forward navigation restores their state.
33488
33961
 
33489
33962
  ## Usage
33490
33963
 
@@ -33530,7 +34003,7 @@ Modifier chars are tolerant: one-or-more stars and three-or-more dots are all eq
33530
34003
 
33531
34004
  ### Layout wrapping
33532
34005
 
33533
- Put layout JSX as the route value with another `<Router>` inside. Since `<Router>` reads its URL from `<Meta>`, the inner router sees the same URL.
34006
+ Put layout JSX as the route value with another `<Router>` inside. Since `<Router>` reads its URL from `<Meta>`, the inner router sees the same URL. A layout's content slot does not scroll, so put a `<Scroll vertical cover>` in it (and a `<RouteCache>` around that, to keep pages). See "Composing an app" on `<App>`.
33534
34007
 
33535
34008
  ```tsx
33536
34009
  const SIDEBARRED_ROUTES = {
@@ -33543,7 +34016,9 @@ const SIDEBARRED_ROUTES = {
33543
34016
  "/": <HomePage/>,
33544
34017
  "/{...path}": (
33545
34018
  <SidebarLayout sidebar={<Nav/>}>
33546
- <Router routes={SIDEBARRED_ROUTES}/>
34019
+ <Scroll vertical cover>
34020
+ <Router routes={SIDEBARRED_ROUTES}/>
34021
+ </Scroll>
33547
34022
  </SidebarLayout>
33548
34023
  ),
33549
34024
  }}/>
@@ -33590,7 +34065,9 @@ const SIDEBARRED_ROUTES = {
33590
34065
  "/login": <LoginPage/>, // no sidebar
33591
34066
  "/{...path}": ( // everything else wrapped
33592
34067
  <SidebarLayout sidebar={<Nav/>}>
33593
- <Router routes={SIDEBARRED_ROUTES}/>
34068
+ <Scroll vertical cover>
34069
+ <Router routes={SIDEBARRED_ROUTES}/>
34070
+ </Scroll>
33594
34071
  </SidebarLayout>
33595
34072
  ),
33596
34073
  }}/>
@@ -33598,7 +34075,7 @@ const SIDEBARRED_ROUTES = {
33598
34075
 
33599
34076
  ### Keeping page state
33600
34077
 
33601
- By default a page is unmounted when you navigate away and mounted fresh when you return — so scroll position, open/closed toggles, in-progress searches, form inputs, and focus are all lost, and you land back at the top. Wrap the router (or its scrolling content region) in a `<RouteCache>` to keep recently-visited pages mounted but hidden so their state is still there when you go back to them, or switch back to their tab. Shelving's `<SidebarLayout>` and `<CenteredLayout>` already do this for you.
34078
+ By default a page is unmounted when you navigate away and mounted fresh when you return — so scroll position, open/closed toggles, in-progress searches, form inputs, and focus are all lost, and you land back at the top. Wrap the router in a `<RouteCache>`, with a `<Scroll vertical cover>` between them, to keep recently-visited pages mounted but hidden so their state is still there when you go back to them, or switch back to their tab. Layouts do not do this for you: see `<RouteCache>` for the full nesting.
33602
34079
 
33603
34080
  ### SSR / static rendering
33604
34081
 
@@ -33859,7 +34336,7 @@ Variants for block level elements.
33859
34336
 
33860
34337
  Get the combined `className` string for a block from its styling variants.
33861
34338
 
33862
- Composes the base block class and tint ladder with the colour, space, typography, and width variant helpers, so anything that wants block-level styling can apply it.
34339
+ Composes the base block class and tint ladder with the colour, space, typography, width, and height variant helpers, so anything that wants block-level styling can apply it.
33863
34340
 
33864
34341
  ## Signatures
33865
34342
 
@@ -34219,7 +34696,7 @@ Variant props for the gap between a component's children, e.g. `gap="large"`.
34219
34696
 
34220
34697
  ```ts
34221
34698
  {
34222
- gap?: SpaceValue | undefined;
34699
+ gap?: Exclude<SpaceValue, "auto"> | undefined;
34223
34700
  }
34224
34701
  ```
34225
34702
 
@@ -34227,7 +34704,7 @@ Variant props for the gap between a component's children, e.g. `gap="large"`.
34227
34704
 
34228
34705
  | Property | Type | Description |
34229
34706
  | --- | --- | --- |
34230
- | `gap` | `SpaceValue \| undefined` | Gap between child elements. Optional. |
34707
+ | `gap` | `Exclude<SpaceValue, "auto"> \| undefined` | Gap between child elements. Optional. |
34231
34708
 
34232
34709
 
34233
34710
  ---
@@ -34250,7 +34727,7 @@ getGapClass({ gap }: GapVariants): string | undefined
34250
34727
  | Param | Type | Description |
34251
34728
  | --- | --- | --- |
34252
34729
  | `options` | `GapVariants` | |
34253
- | `.gap` | `SpaceValue \| undefined` | Gap between child elements. Optional. |
34730
+ | `.gap` | `Exclude<SpaceValue, "auto"> \| undefined` | Gap between child elements. Optional. |
34254
34731
 
34255
34732
  ## Returns
34256
34733
 
@@ -34365,6 +34842,138 @@ getGridClass({ columns: 3, gap: "normal" })
34365
34842
  ```
34366
34843
 
34367
34844
 
34845
+ ---
34846
+
34847
+ # HeightVariant
34848
+
34849
+ - Kind: type
34850
+ - Import: `import { HeightVariant } from "shelving/ui";`
34851
+
34852
+ Enumerated height selectable via the `height` variant prop.
34853
+ - `full` — at least the full height of the container.
34854
+ - `1x`–`32x` — at least a multiple of `--space-normal` (1x–8x at 1x intervals, then 10x/12x, then 16x–32x at 4x intervals).
34855
+ - Each value is a minimum (`min-block-size`), so the element grows when its content is taller and nothing is cut off.
34856
+
34857
+ ## Signatures
34858
+
34859
+ ```ts
34860
+ | "full"
34861
+ | "1x"
34862
+ | "2x"
34863
+ | "3x"
34864
+ | "4x"
34865
+ | "5x"
34866
+ | "6x"
34867
+ | "7x"
34868
+ | "8x"
34869
+ | "10x"
34870
+ | "12x"
34871
+ | "16x"
34872
+ | "20x"
34873
+ | "24x"
34874
+ | "28x"
34875
+ | "32x"
34876
+ ```
34877
+
34878
+
34879
+ ---
34880
+
34881
+ # HeightVariants
34882
+
34883
+ - Kind: interface
34884
+ - Import: `import { HeightVariants } from "shelving/ui";`
34885
+
34886
+ Variant props that set a component's height, and where its content sits inside that height, e.g. `height="full" middle`.
34887
+
34888
+ ## Signatures
34889
+
34890
+ ```ts
34891
+ {
34892
+ height?: HeightVariant | undefined;
34893
+ top?: boolean | undefined;
34894
+ middle?: boolean | undefined;
34895
+ bottom?: boolean | undefined;
34896
+ }
34897
+ ```
34898
+
34899
+ ## Properties
34900
+
34901
+ | Property | Type | Description |
34902
+ | --- | --- | --- |
34903
+ | `height` | `HeightVariant \| undefined` | Height of the element. It is a minimum, so the element grows when its content is taller. Optional. |
34904
+ | `top` | `boolean \| undefined` | Put the content at the top of the element (the default). Optional. |
34905
+ | `middle` | `boolean \| undefined` | Put the content in the vertical middle of the element. Use with `height`. Optional. |
34906
+ | `bottom` | `boolean \| undefined` | Put the content at the bottom of the element. Use with `height`. Optional. |
34907
+
34908
+
34909
+ ---
34910
+
34911
+ # getHeightClass()
34912
+
34913
+ - Kind: function
34914
+ - Import: `import { getHeightClass } from "shelving/ui";`
34915
+
34916
+ Get the height class for a component from its `height`, `top`, `middle` and `bottom` variant props.
34917
+
34918
+ The `height` variant prop sets a component's minimum block size, and `top` / `middle` / `bottom` set where its content sits inside that height — `<Block height="full" middle>`, `<Section height="12x" bottom>`. It is the vertical partner of the `width` variant (see `getWidthClass()`).
34919
+
34920
+ `getHeightClass({ height, top, middle, bottom })` maps the props to height classes.
34921
+
34922
+ **Values:**
34923
+
34924
+ - `full` — at least the full height of the container, for example a layout's `<Scroll vertical cover>` box.
34925
+ - `1x` / `2x` / `3x` / `4x` / `5x` / `6x` / `7x` / `8x` / `10x` / `12x` / `16x` / `20x` / `24x` / `28x` / `32x` — at least a multiple of `--space-normal`.
34926
+
34927
+ **Things to know:**
34928
+
34929
+ - Every height is a minimum (`min-block-size`). When the content is taller, the element grows, so a scroll box scrolls it from the top and nothing is cut off.
34930
+ - `top` (the default), `middle` and `bottom` set `align-content` on the element itself. The element keeps its own `display`, so its parent does not need to be a flex box. They only do something when the element is taller than its content, so use them with `height`.
34931
+ - `<Row>` and `<Column>` already have `top` / `middle` / `bottom` flex variants with the same meaning, so `<Column height="full" middle>` also puts its items in the middle (see `getFlexClass()`).
34932
+ - In a flex or grid container, `space="auto"` is the other way to centre a block (see `getSpaceClass()`).
34933
+ - `align-content` on a plain block shipped in Chrome 123, Firefox 125 and Safari 17.4. Older browsers show the content at the top.
34934
+
34935
+ ## Usage
34936
+
34937
+ A log-in screen, in the middle of a layout's scroll box:
34938
+
34939
+ ```tsx
34940
+ <Page title="Log in">
34941
+ <Block height="full" middle width="narrow" padding="xxlarge" indent="normal">
34942
+ <LoginForm />
34943
+ </Block>
34944
+ </Page>
34945
+ ```
34946
+
34947
+
34948
+ ## Signatures
34949
+
34950
+ ```ts
34951
+ getHeightClass({ height, top, middle, bottom }: HeightVariants): string | undefined
34952
+ ```
34953
+
34954
+ ## Parameters
34955
+
34956
+ | Param | Type | Description |
34957
+ | --- | --- | --- |
34958
+ | `options` | `HeightVariants` | |
34959
+ | `.height` | `HeightVariant \| undefined` | Height of the element. It is a minimum, so the element grows when its content is taller. Optional. |
34960
+ | `.top` | `boolean \| undefined` | Put the content at the top of the element (the default). Optional. |
34961
+ | `.middle` | `boolean \| undefined` | Put the content in the vertical middle of the element. Use with `height`. Optional. |
34962
+ | `.bottom` | `boolean \| undefined` | Put the content at the bottom of the element. Use with `height`. Optional. |
34963
+
34964
+ ## Returns
34965
+
34966
+ | Type | Description |
34967
+ | --- | --- |
34968
+ | `string \| undefined` | The height class string, or `undefined` if no height variants are set. |
34969
+
34970
+ ## Examples
34971
+
34972
+ ```ts
34973
+ getHeightClass({ height: "full", middle: true }) // "height height-full middle"
34974
+ ```
34975
+
34976
+
34368
34977
  ---
34369
34978
 
34370
34979
  # IndentVariant
@@ -34470,7 +35079,7 @@ Variant props for the block-padding (top + bottom) of a component, e.g. `padding
34470
35079
 
34471
35080
  ```ts
34472
35081
  {
34473
- padding?: SpaceValue | undefined;
35082
+ padding?: Exclude<SpaceValue, "auto"> | undefined;
34474
35083
  }
34475
35084
  ```
34476
35085
 
@@ -34478,7 +35087,7 @@ Variant props for the block-padding (top + bottom) of a component, e.g. `padding
34478
35087
 
34479
35088
  | Property | Type | Description |
34480
35089
  | --- | --- | --- |
34481
- | `padding` | `SpaceValue \| undefined` | Block-padding (top + bottom) of the element. Optional. |
35090
+ | `padding` | `Exclude<SpaceValue, "auto"> \| undefined` | Block-padding (top + bottom) of the element. Optional. |
34482
35091
 
34483
35092
 
34484
35093
  ---
@@ -34501,7 +35110,7 @@ getPaddingClass({ padding }: PaddingVariants): string | undefined
34501
35110
  | Param | Type | Description |
34502
35111
  | --- | --- | --- |
34503
35112
  | `options` | `PaddingVariants` | |
34504
- | `.padding` | `SpaceValue \| undefined` | Block-padding (top + bottom) of the element. Optional. |
35113
+ | `.padding` | `Exclude<SpaceValue, "auto"> \| undefined` | Block-padding (top + bottom) of the element. Optional. |
34505
35114
 
34506
35115
  ## Returns
34507
35116
 
@@ -34615,7 +35224,7 @@ getRadiusClass({ radius: "large" }) // "radius-large"
34615
35224
  - Kind: interface
34616
35225
  - Import: `import { ScrollVariants } from "shelving/ui";`
34617
35226
 
34618
- Variant props selecting which scroll axes are enabled on an element.
35227
+ Variant props for a scroll region: which axes scroll, plus `cover` and `reverse`.
34619
35228
 
34620
35229
  ## Signatures
34621
35230
 
@@ -34623,6 +35232,8 @@ Variant props selecting which scroll axes are enabled on an element.
34623
35232
  {
34624
35233
  vertical?: boolean | undefined;
34625
35234
  horizontal?: boolean | undefined;
35235
+ cover?: boolean | undefined;
35236
+ reverse?: boolean | undefined;
34626
35237
  }
34627
35238
  ```
34628
35239
 
@@ -34632,6 +35243,8 @@ Variant props selecting which scroll axes are enabled on an element.
34632
35243
  | --- | --- | --- |
34633
35244
  | `vertical` | `boolean \| undefined` | Vertical scrolling (defaults to `false`). Optional. |
34634
35245
  | `horizontal` | `boolean \| undefined` | Horizontal scrolling (defaults to `false`). Optional. |
35246
+ | `cover` | `boolean \| undefined` | Cover the nearest positioned ancestor (`position: absolute; inset: 0`), for example a layout's content slot (defaults to `false`). Optional. |
35247
+ | `reverse` | `boolean \| undefined` | Start at the end and stay there as the content grows, for example a chat (defaults to `false`). Put the content in one child. Optional. |
34635
35248
 
34636
35249
 
34637
35250
  ---
@@ -34641,12 +35254,12 @@ Variant props selecting which scroll axes are enabled on an element.
34641
35254
  - Kind: function
34642
35255
  - Import: `import { getScrollClass } from "shelving/ui";`
34643
35256
 
34644
- Get the scroll class for a component from its `horizontal` / `vertical` variant props.
35257
+ Get the scroll class for a component from its `horizontal`, `vertical`, `cover` and `reverse` variant props.
34645
35258
 
34646
35259
  ## Signatures
34647
35260
 
34648
35261
  ```ts
34649
- getScrollClass({ horizontal, vertical }: ScrollVariants): string
35262
+ getScrollClass({ horizontal, vertical, cover, reverse }: ScrollVariants): string
34650
35263
  ```
34651
35264
 
34652
35265
  ## Parameters
@@ -34656,6 +35269,8 @@ getScrollClass({ horizontal, vertical }: ScrollVariants): string
34656
35269
  | `options` | `ScrollVariants` | |
34657
35270
  | `.vertical` | `boolean \| undefined` | Vertical scrolling (defaults to `false`). Optional. |
34658
35271
  | `.horizontal` | `boolean \| undefined` | Horizontal scrolling (defaults to `false`). Optional. |
35272
+ | `.cover` | `boolean \| undefined` | Cover the nearest positioned ancestor (`position: absolute; inset: 0`), for example a layout's content slot (defaults to `false`). Optional. |
35273
+ | `.reverse` | `boolean \| undefined` | Start at the end and stay there as the content grows, for example a chat (defaults to `false`). Put the content in one child. Optional. |
34659
35274
 
34660
35275
  ## Returns
34661
35276
 
@@ -34695,6 +35310,66 @@ Props for the `Scroll` component — children plus scroll-axis variants.
34695
35310
  - Import: `import { Scroll } from "shelving/ui";`
34696
35311
 
34697
35312
  Wrap children in a scrollable container with horizontal and/or vertical scrolling enabled.
35313
+ - With `cover`, it fills a layout's content slot, so each page in a `<RouteCache>` scrolls in its own box.
35314
+
35315
+ A box that scrolls its content on one or both axes. Use it for a wide table on a small screen, or as the scroll box of each page in an app.
35316
+
35317
+ **Things to know:**
35318
+
35319
+ - Set `vertical`, `horizontal`, or both. With neither, the box clips its content and does not scroll.
35320
+ - Set `cover` to fill the nearest positioned ancestor (`position: absolute; inset: 0`). A layout's content slot is positioned, so `<Scroll vertical cover>` fills it.
35321
+ - Set `reverse` to start at the end and stay there when the content grows, for example a chat. Put the content in one child: only the scroll is reversed, so the child keeps its own order. No script is needed.
35322
+ - Overscroll stops at the box edge (`overscroll-behavior: none`), so a scroll inside the box never scrolls the page behind it.
35323
+ - When the box has keyboard focus, it shows a focus outline.
35324
+
35325
+ ## Usage
35326
+
35327
+ ### A wide table
35328
+
35329
+ ```tsx
35330
+ import { Scroll, Table } from "shelving/ui";
35331
+
35332
+ <Scroll horizontal>
35333
+ <Table>…</Table>
35334
+ </Scroll>
35335
+ ```
35336
+
35337
+ ### A scroll box for each page
35338
+
35339
+ Put `<Scroll vertical cover>` inside `<RouteCache>`, so each kept page has its own scroll box and keeps its own scroll position. The layout gives its content slot `position: relative`, and the scroll box fills it.
35340
+
35341
+ ```tsx
35342
+ import { AppLayout, HorizontalTransition, PageLoader, RouteCache, Router, Scroll } from "shelving/ui";
35343
+
35344
+ <AppLayout nav={<StackBar />}>
35345
+ <HorizontalTransition>
35346
+ <RouteCache>
35347
+ <Scroll vertical cover>
35348
+ <PageLoader>
35349
+ <Router routes={ROUTES} />
35350
+ </PageLoader>
35351
+ </Scroll>
35352
+ </RouteCache>
35353
+ </HorizontalTransition>
35354
+ </AppLayout>
35355
+ ```
35356
+
35357
+ ### A chat
35358
+
35359
+ ```tsx
35360
+ <Scroll vertical cover reverse>
35361
+ <div>{messages}</div>
35362
+ </Scroll>
35363
+ ```
35364
+
35365
+ ## Styling
35366
+
35367
+ | Variable | Styles | Default |
35368
+ |---|---|---|
35369
+ | `--scroll-focus-border` | Outline when the box has keyboard focus | `var(--stroke-focus) solid var(--color-focus)` |
35370
+
35371
+ **Global tokens it reads** — `--stroke-focus`, `--stroke-normal`, and `--color-focus`.
35372
+
34698
35373
 
34699
35374
  ## Signatures
34700
35375
 
@@ -34714,12 +35389,6 @@ Scroll({ children, ...props }: ScrollComponentProps): ReactElement
34714
35389
  | --- | --- |
34715
35390
  | `ReactElement` | A `<div>` element with the computed scroll class. |
34716
35391
 
34717
- ## Examples
34718
-
34719
- ```ts
34720
- <Scroll horizontal>{wideContent}</Scroll>
34721
- ```
34722
-
34723
35392
 
34724
35393
  ---
34725
35394
 
@@ -34829,6 +35498,7 @@ Allowed values for block spacing for components that support `SpaceVariants`
34829
35498
  | "section"
34830
35499
  | "paragraph"
34831
35500
  | "none"
35501
+ | "auto"
34832
35502
  | "xxsmall"
34833
35503
  | "xsmall"
34834
35504
  | "small"
@@ -34886,6 +35556,8 @@ The `space` variant prop sets a block-level element's `margin-block` (top + bott
34886
35556
 
34887
35557
  `getSpaceClass({ space })` maps the prop to a margin class (e.g. `space="large"` → `large`). The same scale also backs `getPaddingClass()` (block padding), `getIndentClass()` (inline padding), and `getGapClass()`, so they all move together when you change `--space-normal`.
34888
35558
 
35559
+ `space="auto"` sets `margin-block: auto`. In a flex or grid container, such as a `<Column>`, the auto margins take the free space, so the block sits in the middle (it still keeps auto margins as a first or last child). In normal block flow they do nothing: to centre a block vertically there, use `height="full" middle` (see `getHeightClass()`). `padding` and `gap` have no `auto`.
35560
+
34889
35561
  Alongside the named scale, `space`, `padding`, and `indent` also accept numeric multiples of `--space-normal` — `1x` … `10x` (e.g. `padding="5x"` → `calc(var(--space-normal) * 5)`) — for larger one-off blocks like hero panels.
34890
35562
 
34891
35563
  ## Theme variables
@@ -36580,7 +37252,7 @@ Props for the `TreeApp` component — the tree to render plus optional extra rou
36580
37252
 
36581
37253
  Top-level app component for a tree-based documentation site.
36582
37254
 
36583
- - Wraps `<App>` with error catching and a sidebar layout.
37255
+ - Wraps `<App>` with error catching and a sidebar layout. Each page is kept in a `<RouteCache>` and scrolls in its own `<Scroll>` box, and a page error shows inside the layout.
36584
37256
  - Flattens `tree` once via `<TreeProvider>` wrapping both the sidebar and the router, so everything below shares a single `useTreeMap()` lookup — nothing re-flattens.
36585
37257
  - The sidebar shows a `<TreeSidebar>` (root as a home link + a menu of its children).
36586
37258
  - `/` renders the root via `<TreePage>`; `/**` catches every deeper path and feeds the full sub-path into `<TreePage>`.