View stack
Views that replace one another in one place: a push in from the end, a pop back, a tab rising in.
import { ViewStack } from "@arcadia/ui"Views that replace one another in one place. view names the one showing; depth says how deep it is. A deeper view is a push: it comes in from the end as the old one sets back a third of the way and fades, over --duration-enter on --ease-enter. A shallower one is a pop, the mirror. The leaving view keeps its last face, scroll included, until it is gone, and both share one grid cell while they cross, so the stack never changes height.
Examples
Knobs
The views are painted on the surface the stack sits on, so the one on top of a move hides the one under it. Set it where the stack sits on another surface.
--view-stack-surface- PaintDefault var(--bg-app)
- What each view is painted on (the surface the stack sits on,
--bg-appby default): the view on top of a move hides the one under it.
The leaving view is inert and hidden from assistive tech the moment the move starts, so focus and the pointer land only on the new view and no input waits on the animation. Move focus into the new view yourself (its heading, or the row Back returns to). Reduced motion swaps the views at once.
ViewStack
viewrequired- string
- Which view shows: a new value is a move to another view.
depth- numberDefault 0
- How deep the view is (a list 0, the item it opened 1). Deeper than the last is a push: the new view comes in from the end as the old one sets back. Shallower is a pop, the mirror. The same depth is a swap: the new view rises in.
rootStyle- RootStyle<ViewStackKnobs>
- Typed StyleX override: where the stack sits (it fills a flex or grid parent like a block) and its surface.
children- ReactNode
- The view.
Rest props go to HTMLAttributes<HTMLDivElement>.