@neshel-ui/animations/layout
Every export of @neshel-ui/animations/layout, generated from its declarations.
Experimental and not on npm
Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.
AnimatedListcomponentA list whose items enter and exit (L03) while the remaining items FLIP into place (L01).
(props: AnimatedListProps): ElementAutoHeightcomponentA wrapper whose height follows its content smoothly (async content, text growing).
(props: AutoHeightProps): ElementCollapsecomponentAn expanding/collapsing panel (L06). Wire your trigger with `aria-expanded` and `aria-controls={id}`; the closed content stays in the DOM (`hidden="until-found"` where supported). Needs `layout.css`.
(props: CollapseProps): ElementCrossFadecomponentContent cross-fade swap (L09): old and new content overlap in one grid cell; the height follows (L02).
(props: CrossFadeProps): ElementLayoutItemcomponentAn element that FLIPs to its new layout box whenever an update of its group moves or resizes it.
(props: LayoutItemProps): ElementMasonrycomponentA masonry grid (row spans from observed heights) whose reflows animate (L10). Needs `layout.css`.
(props: MasonryProps): ElementPresencecomponent(props: PresenceProps): ElementReflowcomponentChildren animate whenever the container reflows (resize, column change, size change) — no renders.
(props: ReflowProps): ElementTabIndicatorcomponentA sliding indicator under the active tab (package-rendered layer; CSS transition on it only).
(props: TabIndicatorProps): ElementcreateLayoutGroupfunction(): LayoutGroupcreatePresencefunction<T>(): Presence<T>getLayoutDebugInfofunction(): LayoutDebugInfomeasureBoxfunctionLayout box of an element (offset chain + `offsetWidth/Height`), or the bounding box plus scroll for non-HTML elements (their transforms are then included — documented).
(element: Element): BoxuseIsPresentfunctionWhether this component is present (`false` while it exits).
(): booleanuseLayoutGroupfunctionThe nearest `<LayoutGroup>`'s group (`null` outside one): `snapshot()` / `play()` for imperative changes.
(): LayoutGroup | nulluseLayoutItemfunctionAttach the FLIP effect of the nearest group to `ref` (for custom components; see `<LayoutItem>`).
(ref: RefObject<Element | null>, options?: LayoutItemOptions | undefined): voidusePresencefunction`[isPresent, safeToRemove]` for a custom child of `<Presence>`; `[true, noop]` outside one.
(): [boolean, () => void]autoHeightconstReadonly<EffectDefinition<AutoHeightOptions, ResolvedHeight>>collapseconstReadonly<EffectDefinition<CollapseOptions, ResolvedCollapse>>crossFadeconstReadonly<EffectDefinition<CrossFadeOptions, ResolvedCrossFade>>flipMoveconstReadonly<EffectDefinition<FlipMoveOptions, ResolvedFlip>>gridReflowconstReadonly<EffectDefinition<GridReflowOptions, ResolvedReflow>>layoutEffectsconstEvery layout definition in catalogue order (L01–L07, L09, L10; L08 is `<Presence>`), for registries.
readonly AnyEffectDefinition[]listItemconstReadonly<EffectDefinition<ListItemOptions, ResolvedListItem>>masonryconstReadonly<EffectDefinition<MasonryOptions, ResolvedMasonry>>sharedLayoutconstReadonly<EffectDefinition<SharedLayoutOptions, ResolvedFlip>>tabIndicatorconstReadonly<EffectDefinition<TabIndicatorOptions, ResolvedIndicator>>LayoutGroupclassOwns a layout group for the items rendered inside it (L01, L03, L04).
AnimatedListPropsinterfaceAnimatedListProps
AnimatedListProps Prop Type Default Description as "ul" | "ol" | "div""ul"List element (default "ul").children ReactNode— Keyed items, each accepting a ref. duration number240Item enter/exit duration in ms (default 240). initial booleanfalseAnimate the first render's items (default false). onExitComplete (key: string) => void— — reducedMotion ReducedMotion— — ref Ref<HTMLElement>— — transition LayoutTransition— — Also accepts the props of: React DOM attributes.
AutoHeightOptionsinterfaceAutoHeightOptions
L02 — Auto-height: the element's height follows its content's observed height.
AutoHeightOptions Prop Type Default Description duration number | DurationPreset280ms or preset (default 280). easing Easing | EasingPreset— — reducedMotion ReducedMotion— — AutoHeightPropsinterfaceAutoHeightProps
AutoHeightProps Prop Type Default Description children ReactNode— — duration number | DurationPreset— — easing Easing | EasingPreset— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — Also accepts the props of: React DOM attributes.
BoxinterfaceBox
A layout box in document coordinates (transforms ignored).
Box Prop Type Default Description height(required) number— — width(required) number— — x(required) number— — y(required) number— — CollapseOptionsinterfaceCollapseOptions
L06 — Accordion height (collapse / expand a package-rendered panel).
CollapseOptions Prop Type Default Description driver "auto" | "css" | "js"— "auto"(default): CSSinterpolate-sizewhere supported, measured WAAPI otherwise.duration number | DurationPreset280ms or preset (default 280). easing Easing | EasingPreset— — onRequestOpen () => void— Find-in-page matched hidden content: ask the consumer to open the panel. open boolean— Expanded state (controlled by the consumer). reducedMotion ReducedMotion— — CollapsePropsinterfaceCollapseProps
CollapseProps Prop Type Default Description children ReactNode— — driver "auto" | "css" | "js"— "auto"(default): CSSinterpolate-sizewhere supported, measured WAAPI otherwise.duration number | DurationPreset280ms or preset (default 280). easing Easing | EasingPreset— — onRequestOpen () => void— Find-in-page matched hidden content: ask the consumer to open the panel. open(required) boolean— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — Also accepts the props of: React DOM attributes.
CrossFadeOptionsinterfaceCrossFadeOptions
L09 — Content cross-fade swap (one layer of a swap;
<CrossFade>stacks two).CrossFadeOptions Prop Type Default Description appear boolean— Fade in when attached visible (default false: SSR content stays visible). duration number | DurationPreset— — easing Easing | EasingPreset— — onHidden () => void— Called once each time the layer has faded out. reducedMotion ReducedMotion— — visible boolean— Shown (fades in) or hidden (fades out). Default true. CrossFadePropsinterfaceCrossFadeProps
CrossFadeProps Prop Type Default Description children ReactNode— — duration number— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — swapKey(required) string | number— Change it to swap the content (old and new cross-fade while the height follows). Also accepts the props of: React DOM attributes.
FlipMoveOptionsinterfaceFlipMoveOptions
L01 — FLIP move / reorder (and L04 shared layout with a
layoutId).FlipMoveOptions Prop Type Default Description group LayoutGroup— The group whose snapshot/play cycle animates this element ( createLayoutGroup();<LayoutGroup>).layout LayoutMode"position"What is animated (default "position";"size"/"both"add a non-uniform scale).reducedMotion ReducedMotion— — transition LayoutTransition— — GridReflowOptionsinterfaceGridReflowOptions
L05 — Grid reflow.
GridReflowOptions Prop Type Default Description reducedMotion ReducedMotion— — transition LayoutTransition— — LayoutDebugInfointerfaceLayoutDebugInfo
LayoutDebugInfo Prop Type Default Description observers(required) number— — plays(required) number— — reads(required) number— — reflows(required) number— — snapshots(required) number— — watchdog(required) number— — LayoutEntryinterfaceLayoutEntry
LayoutEntry Prop Type Default Description animate(required) () => boolean— falsewhile motion is reduced: changes are applied without animation.animator(required) FlipAnimator— — layout(required) LayoutMode— — layoutId(required) string | undefined— — LayoutGroupHandleinterfaceLayoutGroupHandle
LayoutGroupHandle Prop Type Default Description destroy(required) () => void— — play(required) () => void— Measure the new boxes in the next read phase and animate the changes. register(required) (element: Element, entry: LayoutEntry) => () => void— Register an element; returns the unregister function. size(required) number— — snapshot(required) () => void— Read every registered box (once per pending change; further calls are no-ops until play).LayoutItemOptionsinterfaceLayoutItemOptions
LayoutItemOptions Prop Type Default Description layout LayoutMode— — layoutId string— Shared-layout id (L04): a new element with the same id animates from the old one's box. reducedMotion ReducedMotion— — transition LayoutTransition— — LayoutItemPropsinterfaceLayoutItemProps
LayoutItemProps Prop Type Default Description asChild boolean— Apply to the single child element instead of rendering a <div>.children ReactNode— — layout LayoutMode— — layoutId string— Shared-layout id (L04): a new element with the same id animates from the old one's box. reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — transition LayoutTransition— — Also accepts the props of: React DOM attributes.
ListItemOptionsinterfaceListItemOptions
L03 — List item enter / exit (opacity, 4 % scale and 8 px offset; siblings FLIP in a group).
ListItemOptions Prop Type Default Description appear boolean— Animate the first appearance (default true; <AnimatedList>sets false for initial items).duration number | DurationPreset— — easing Easing | EasingPreset— — onExited () => void— — present boolean— Present (enters) or leaving (exits, then onExited). Default true.reducedMotion ReducedMotion— — MasonryOptionsinterfaceMasonryOptions
L10 — Masonry reflow.
MasonryOptions Prop Type Default Description columns number— Fixed column count (1–12); omitted: as many columns of minColumnWidthas fit.gap number— Gap in px (0–96, default 16). minColumnWidth number— Minimum column width in px when columnsis omitted (80–800, default 220).reducedMotion ReducedMotion— — transition LayoutTransition— — unit number— Row unit in px used for spans (1–32, default 4). MasonryPropsinterfaceMasonryProps
MasonryProps Prop Type Default Description children ReactNode— — columns number— Fixed column count (1–12); omitted: as many columns of minColumnWidthas fit.gap number— Gap in px (0–96, default 16). minColumnWidth number— Minimum column width in px when columnsis omitted (80–800, default 220).reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — transition LayoutTransition— — unit number— Row unit in px used for spans (1–32, default 4). Also accepts the props of: React DOM attributes.
PresenceEntryinterfacePresenceEntry
PresenceEntry Prop Type Default Description generation(required) number— Increments on every status change; removeonly acts on the generation it was given.key(required) string— — status(required) PresenceStatus— — value(required) T— — PresencePropsinterfacePresenceProps
PresenceProps Prop Type Default Description children ReactNode— Keyed elements rendered without a wrapper. Each must accept a ref that reaches its DOM element (host elements do; components must forward ref), so exiting content can be made inert and lose focus.duration number220Built-in fade duration in ms (default 220). enter AnyPreset— Entrance definition or preset for entering children (default: the built-in fade). exit AnyPreset— Entrance definition or preset for exiting children (default: the built-in fade). focusFallback RefObject<HTMLElement | null>— Focus target when focus was inside an exiting child and no present sibling can take it. initial boolean— Animate the children of the first render too (default false: server/hydrated content stays visible). onExitComplete (key: string) => void— Called once per removed key, after its exit. PresenceStateinterfacePresenceState
PresenceState Prop Type Default Description entries(required) readonly PresenceEntry<T>[]— — flush(required) () => boolean— Remove every exiting entry at once (container unmount, hidden page). remove(required) (key: string, generation: number) => boolean— An exit finished: remove the key if it is still exiting in generation.update(required) (next: ReadonlyArray<{ key: string; value: T; }>) => boolean— Merge the next ordered children; returns whether anything changed. ReflowPropsinterfaceReflowProps
ReflowProps Prop Type Default Description asChild boolean— — children ReactNode— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — transition LayoutTransition— — Also accepts the props of: React DOM attributes.
SharedLayoutOptionsinterfaceTabIndicatorOptionsinterfaceTabIndicatorOptions
L07 — Tab indicator slide (a package-rendered indicator inside the tab list).
TabIndicatorOptions Prop Type Default Description active Element | number | null— The active tab: an element, its index among the tabs ( [role="tab"], else children), or null.duration number | DurationPreset— — easing Easing | EasingPreset— — orientation "horizontal" | "vertical"— — reducedMotion ReducedMotion— — TabIndicatorPropsinterfaceTabIndicatorProps
TabIndicatorProps Prop Type Default Description active Element | number | null— The active tab: an element, its index among the tabs ( [role="tab"], else children), or null.asChild boolean— Apply to your tab list element instead of rendering a <div>.children ReactNode— — duration number | DurationPreset— — easing Easing | EasingPreset— — orientation "horizontal" | "vertical"— — reducedMotion ReducedMotion— — ref Ref<HTMLDivElement>— — Also accepts the props of: React DOM attributes.
LayoutModetype"position" | "size" | "both"LayoutTransitiontypeLayoutTransition
Transition of layout animations: a spring (default) or a tween.
LayoutTransition Prop Type Default Description duration number | DurationPreset— — easing Easing | EasingPreset— — spring SpringOptions | SpringPreset— — type(required) "spring" | "tween"— — PresenceStatustypePresence state machine (Phase 012, shared from `src/core` since Phase 015 by `./layout` L08 and `./feedback` F06; contracts/layout-engine.md §7, research R8). Framework-free and pure: it merges successive keyed child lists, keeping removed keys in place as `exiting` until `remove(key, generation)` confirms their exit, and turning re-added keys back to `present`. Timers, animations and focus live in the caller (the React `<Presence>` item); every transition is idempotent, so a repeated `update` with the same list (StrictMode double render) changes nothing.
"present" | "exiting"