{"name":"scroll-stack","entry":"component","title":"ScrollStack","description":"Stack any React content as you scroll. Successive items scale into place while earlier ones fade. Page or contained scrolling, keyboard access, and a plain-list fallback.","category":"Interactive","capabilities":["controls","scroll"],"needsRemotion":false,"registryDependencies":["@jbm/tokens"],"install":"npx shadcn@latest add @jbm/scroll-stack","installName":"scroll-stack","page":"https://jbm-ui.bns.studio/c/scroll-stack","registryItem":"https://jbm-ui.bns.studio/r/scroll-stack.json","sourcePath":"registry/jbm/ui/scroll-stack.tsx","files":[{"source":"registry/jbm/ui/scroll-stack.tsx","target":"src/jbm/ui/scroll-stack.tsx","import":"@/jbm/ui/scroll-stack","type":"registry:ui"}],"endpoints":{"markdown":"https://jbm-ui.bns.studio/catalog/scroll-stack.md","json":"https://jbm-ui.bns.studio/catalog/scroll-stack.json"},"snippet":"import { ScrollStack } from \"@/jbm/ui/scroll-stack\"\nimport { Card } from \"@/jbm/ui/card\" // install @jbm/card separately\n\n<ScrollStack height={480} distance={120}>\n  <Card>First idea</Card>\n  <Card dark>Another idea</Card>\n  <div style={{ background: \"#fff\", padding: 24 }}>Any content</div>\n</ScrollStack>\n// Omit height for page scrolling; avoid overflow ancestors in page mode.","api":[{"export":"ScrollStack","kind":"component","summary":"A list region whose direct children become sticky items: each incoming item scales from 1.06 to 1 as it pins, and the item it covers shrinks toward `minScale` and fades out over the last 35% of its progress. Uses native scroll and sticky positioning (page or contained), never intercepts scroll, and scrolls a covered item back into view when keyboard focus reaches it. It falls back to a plain list under reduced motion, with fewer than two items, or when any item is taller than the viewport minus twice `top`.","props":[{"name":"children","type":"ReactNode","required":true,"default":null,"description":"Each direct child is one stack item; its content and styling stay yours. Keep backgrounds opaque for a solid stack; wrap related content in one element."},{"name":"height","type":"number","required":false,"default":null,"description":"Omit to stack against page scrolling. Set a number for a self-contained, focusable scroll viewport of that many stage pixels (minimum 160; non-finite falls back to 480)."},{"name":"distance","type":"number","required":false,"default":"120","description":"Scroll distance in pixels between successive items while stacking (also the margin between them). Minimum 0; non-finite falls back to 120. The plain list uses a fixed 24px gap."},{"name":"top","type":"number","required":false,"default":"24","description":"Sticky inset from the top of the viewport (or the contained region), in pixels; also the list's top padding. Minimum 0."},{"name":"minScale","type":"number","required":false,"default":"0.9","description":"Scale of an item once fully covered, clamped to 0.5–1."},{"name":"reducedMotion","type":"boolean","required":false,"default":null,"description":"True renders a plain list; false forces stacking. Undefined follows the system prefers-reduced-motion setting and updates when it changes."},{"name":"label","type":"string","required":false,"default":"\"Scroll through the stack\"","description":"Accessible name of the region."},{"name":"className","type":"string","required":false,"default":null,"description":"Class name on the outer region."},{"name":"style","type":"CSSProperties","required":false,"default":null,"description":"Inline styles for the outer region, merged before height and overflow (those are controlled by `height`)."}],"passthrough":[]}],"stage":{"mode":"fluid","reason":"Width is 100% of the container. In page mode (height omitted) the height is the sum of the items plus `distance` between each, `top` padding, and a tail that lets the last item rest pinned. With `height` set the region is exactly that tall (minimum 160) and scrolls internally."},"examples":[{"title":"Contained stack of cards","code":"import { ScrollStack } from \"@/jbm/ui/scroll-stack\"\nimport { Card } from \"@/jbm/ui/card\" // install @jbm/card separately\n\n<ScrollStack height={480} distance={120}>\n  <Card>First idea</Card>\n  <Card dark>Another idea</Card>\n  <div style={{ background: \"#fff\", padding: 24 }}>Any content</div>\n</ScrollStack>\n// Omit height for page scrolling; avoid overflow ancestors in page mode."}],"qa":["Scroll the contained demo from top to bottom and back: each card pins at the top inset, the covered card shrinks and fades fully before the next settles, and the last card rests without a gap or jump.","Toggle Plain list: items render as an ordinary list with 24px gaps, no transforms, and full opacity; toggling back restores stacking.","Tab into the covered cards' controls (the demo's button): the stack scrolls the focused item into view and it stays clickable.","Resize to a narrow screen so an item is taller than the viewport: the component switches to the plain list (data-stack-mode=\"list\").","Check page mode separately (height omitted) inside a page without overflow ancestors; sticky positioning fails under overflow: hidden/auto parents.","Enable prefers-reduced-motion with reducedMotion undefined: it falls back to the list live."],"related":[{"name":"tokens","relation":"installs"},{"name":"card","relation":"example-import"}],"setup":{"namespace":"@jbm","componentsJson":{"registries":{"@jbm":"https://jbm-ui.bns.studio/r/{name}.json"}},"command":"npx shadcn@latest add @jbm/<name>","target":"src/jbm/","importAlias":"@/jbm/…","tsconfigPaths":{"@/*":["./src/*"]}},"rules":["Install through the @jbm namespace: each registry item JSON (/r/<name>.json) carries its files' contents and each guide is served at /docs/<slug>.md, so agents never need the source repository (it is public on GitHub for people browsing the code).","Files install to src/jbm/ and import as @/jbm/…, which needs the @/* → ./src/* path alias in tsconfig.json.","Items marked needsRemotion require the remotion package and must render inside a Remotion composition or Player; every other item works in any React page.","Use one vermilion accent per composition; accent2 is for annotations only and soft is for dark surfaces only.","Stages are 1920×1080 landscape and 1080×1920 vertical with declared safe areas; each item's stage field declares its size in stage pixels, and scenes compose from YAML-shaped specs with @jbm/scene-spec."],"links":{"catalog":"https://jbm-ui.bns.studio/catalog.json","llms":"https://jbm-ui.bns.studio/llms.txt"}}