Skip to Content
Neshel-UI
Animations (experimental)Reference

@neshel-ui/animations/layout

Every export of @neshel-ui/animations/layout, generated from its declarations.

Experimental and not on npm

@neshel-ui/animations is a private package (0.0.0). It cannot be installed, and its API may change before a first publication. These pages document what exists in the repository.

Signatures, members and defaults, generated from the built declarations. For explanations and examples read the guide.

  • AnimatedList component

    A list whose items enter and exit (L03) while the remaining items FLIP into place (L01).

    (props: AnimatedListProps): Element
  • AutoHeight component

    A wrapper whose height follows its content smoothly (async content, text growing).

    (props: AutoHeightProps): Element
  • Collapse component

    An 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): Element
  • CrossFade component

    Content cross-fade swap (L09): old and new content overlap in one grid cell; the height follows (L02).

    (props: CrossFadeProps): Element
  • LayoutItem component

    An element that FLIPs to its new layout box whenever an update of its group moves or resizes it.

    (props: LayoutItemProps): Element
  • Masonry component

    A masonry grid (row spans from observed heights) whose reflows animate (L10). Needs `layout.css`.

    (props: MasonryProps): Element
  • Presence component
    (props: PresenceProps): Element
  • Reflow component

    Children animate whenever the container reflows (resize, column change, size change) — no renders.

    (props: ReflowProps): Element
  • TabIndicator component

    A sliding indicator under the active tab (package-rendered layer; CSS transition on it only).

    (props: TabIndicatorProps): Element
  • createLayoutGroup function
    (): LayoutGroup
  • createPresence function
    <T>(): Presence<T>
  • getLayoutDebugInfo function
    (): LayoutDebugInfo
  • measureBox function

    Layout 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): Box
  • useIsPresent function

    Whether this component is present (`false` while it exits).

    (): boolean
  • useLayoutGroup function

    The nearest `<LayoutGroup>`'s group (`null` outside one): `snapshot()` / `play()` for imperative changes.

    (): LayoutGroup | null
  • useLayoutItem function

    Attach the FLIP effect of the nearest group to `ref` (for custom components; see `<LayoutItem>`).

    (ref: RefObject<Element | null>, options?: LayoutItemOptions | undefined): void
  • usePresence function

    `[isPresent, safeToRemove]` for a custom child of `<Presence>`; `[true, noop]` outside one.

    (): [boolean, () => void]
  • autoHeight const
    Readonly<EffectDefinition<AutoHeightOptions, ResolvedHeight>>
  • collapse const
    Readonly<EffectDefinition<CollapseOptions, ResolvedCollapse>>
  • crossFade const
    Readonly<EffectDefinition<CrossFadeOptions, ResolvedCrossFade>>
  • flipMove const
    Readonly<EffectDefinition<FlipMoveOptions, ResolvedFlip>>
  • gridReflow const
    Readonly<EffectDefinition<GridReflowOptions, ResolvedReflow>>
  • layoutEffects const

    Every layout definition in catalogue order (L01–L07, L09, L10; L08 is `<Presence>`), for registries.

    readonly AnyEffectDefinition[]
  • listItem const
    Readonly<EffectDefinition<ListItemOptions, ResolvedListItem>>
  • masonry const
    Readonly<EffectDefinition<MasonryOptions, ResolvedMasonry>>
  • sharedLayout const
    Readonly<EffectDefinition<SharedLayoutOptions, ResolvedFlip>>
  • tabIndicator const
    Readonly<EffectDefinition<TabIndicatorOptions, ResolvedIndicator>>
  • LayoutGroup class

    Owns a layout group for the items rendered inside it (L01, L03, L04).

  • AnimatedListProps interface

    AnimatedListProps

    AnimatedListProps
    PropTypeDefaultDescription
    as"ul" | "ol" | "div""ul"List element (default "ul").
    childrenReactNode—Keyed items, each accepting a ref.
    durationnumber240Item enter/exit duration in ms (default 240).
    initialbooleanfalseAnimate the first render's items (default false).
    onExitComplete(key: string) => void——
    reducedMotionReducedMotion——
    refRef<HTMLElement>——
    transitionLayoutTransition——

    Also accepts the props of: React DOM attributes.

  • AutoHeightOptions interface

    AutoHeightOptions

    L02 — Auto-height: the element's height follows its content's observed height.

    AutoHeightOptions
    PropTypeDefaultDescription
    durationnumber | DurationPreset280ms or preset (default 280).
    easingEasing | EasingPreset——
    reducedMotionReducedMotion——
  • AutoHeightProps interface

    AutoHeightProps

    AutoHeightProps
    PropTypeDefaultDescription
    childrenReactNode——
    durationnumber | DurationPreset——
    easingEasing | EasingPreset——
    reducedMotionReducedMotion——
    refRef<HTMLDivElement>——

    Also accepts the props of: React DOM attributes.

  • Box interface

    Box

    A layout box in document coordinates (transforms ignored).

    Box
    PropTypeDefaultDescription
    height(required)number——
    width(required)number——
    x(required)number——
    y(required)number——
  • CollapseOptions interface

    CollapseOptions

    L06 — Accordion height (collapse / expand a package-rendered panel).

    CollapseOptions
    PropTypeDefaultDescription
    driver"auto" | "css" | "js"—"auto" (default): CSS interpolate-size where supported, measured WAAPI otherwise.
    durationnumber | DurationPreset280ms or preset (default 280).
    easingEasing | EasingPreset——
    onRequestOpen() => void—Find-in-page matched hidden content: ask the consumer to open the panel.
    openboolean—Expanded state (controlled by the consumer).
    reducedMotionReducedMotion——
  • CollapseProps interface

    CollapseProps

    CollapseProps
    PropTypeDefaultDescription
    childrenReactNode——
    driver"auto" | "css" | "js"—"auto" (default): CSS interpolate-size where supported, measured WAAPI otherwise.
    durationnumber | DurationPreset280ms or preset (default 280).
    easingEasing | EasingPreset——
    onRequestOpen() => void—Find-in-page matched hidden content: ask the consumer to open the panel.
    open(required)boolean——
    reducedMotionReducedMotion——
    refRef<HTMLDivElement>——

    Also accepts the props of: React DOM attributes.

  • CrossFadeOptions interface

    CrossFadeOptions

    L09 — Content cross-fade swap (one layer of a swap; <CrossFade> stacks two).

    CrossFadeOptions
    PropTypeDefaultDescription
    appearboolean—Fade in when attached visible (default false: SSR content stays visible).
    durationnumber | DurationPreset——
    easingEasing | EasingPreset——
    onHidden() => void—Called once each time the layer has faded out.
    reducedMotionReducedMotion——
    visibleboolean—Shown (fades in) or hidden (fades out). Default true.
  • CrossFadeProps interface

    CrossFadeProps

    CrossFadeProps
    PropTypeDefaultDescription
    childrenReactNode——
    durationnumber——
    reducedMotionReducedMotion——
    refRef<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.

  • FlipMoveOptions interface

    FlipMoveOptions

    L01 — FLIP move / reorder (and L04 shared layout with a layoutId).

    FlipMoveOptions
    PropTypeDefaultDescription
    groupLayoutGroup—The group whose snapshot/play cycle animates this element (createLayoutGroup(); <LayoutGroup>).
    layoutLayoutMode"position"What is animated (default "position"; "size"/"both" add a non-uniform scale).
    reducedMotionReducedMotion——
    transitionLayoutTransition——
  • GridReflowOptions interface

    GridReflowOptions

    L05 — Grid reflow.

    GridReflowOptions
    PropTypeDefaultDescription
    reducedMotionReducedMotion——
    transitionLayoutTransition——
  • LayoutDebugInfo interface

    LayoutDebugInfo

    LayoutDebugInfo
    PropTypeDefaultDescription
    observers(required)number——
    plays(required)number——
    reads(required)number——
    reflows(required)number——
    snapshots(required)number——
    watchdog(required)number——
  • LayoutEntry interface

    LayoutEntry

    LayoutEntry
    PropTypeDefaultDescription
    animate(required)() => boolean—false while motion is reduced: changes are applied without animation.
    animator(required)FlipAnimator——
    layout(required)LayoutMode——
    layoutId(required)string | undefined——
  • LayoutGroupHandle interface

    LayoutGroupHandle

    LayoutGroupHandle
    PropTypeDefaultDescription
    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).
  • LayoutItemOptions interface

    LayoutItemOptions

    LayoutItemOptions
    PropTypeDefaultDescription
    layoutLayoutMode——
    layoutIdstring—Shared-layout id (L04): a new element with the same id animates from the old one's box.
    reducedMotionReducedMotion——
    transitionLayoutTransition——
  • LayoutItemProps interface

    LayoutItemProps

    LayoutItemProps
    PropTypeDefaultDescription
    asChildboolean—Apply to the single child element instead of rendering a <div>.
    childrenReactNode——
    layoutLayoutMode——
    layoutIdstring—Shared-layout id (L04): a new element with the same id animates from the old one's box.
    reducedMotionReducedMotion——
    refRef<HTMLDivElement>——
    transitionLayoutTransition——

    Also accepts the props of: React DOM attributes.

  • ListItemOptions interface

    ListItemOptions

    L03 — List item enter / exit (opacity, 4 % scale and 8 px offset; siblings FLIP in a group).

    ListItemOptions
    PropTypeDefaultDescription
    appearboolean—Animate the first appearance (default true; <AnimatedList> sets false for initial items).
    durationnumber | DurationPreset——
    easingEasing | EasingPreset——
    onExited() => void——
    presentboolean—Present (enters) or leaving (exits, then onExited). Default true.
    reducedMotionReducedMotion——
  • MasonryOptions interface

    MasonryOptions

    L10 — Masonry reflow.

    MasonryOptions
    PropTypeDefaultDescription
    columnsnumber—Fixed column count (1–12); omitted: as many columns of minColumnWidth as fit.
    gapnumber—Gap in px (0–96, default 16).
    minColumnWidthnumber—Minimum column width in px when columns is omitted (80–800, default 220).
    reducedMotionReducedMotion——
    transitionLayoutTransition——
    unitnumber—Row unit in px used for spans (1–32, default 4).
  • MasonryProps interface

    MasonryProps

    MasonryProps
    PropTypeDefaultDescription
    childrenReactNode——
    columnsnumber—Fixed column count (1–12); omitted: as many columns of minColumnWidth as fit.
    gapnumber—Gap in px (0–96, default 16).
    minColumnWidthnumber—Minimum column width in px when columns is omitted (80–800, default 220).
    reducedMotionReducedMotion——
    refRef<HTMLDivElement>——
    transitionLayoutTransition——
    unitnumber—Row unit in px used for spans (1–32, default 4).

    Also accepts the props of: React DOM attributes.

  • PresenceEntry interface

    PresenceEntry

    PresenceEntry
    PropTypeDefaultDescription
    generation(required)number—Increments on every status change; remove only acts on the generation it was given.
    key(required)string——
    status(required)PresenceStatus——
    value(required)T——
  • PresenceProps interface

    PresenceProps

    PresenceProps
    PropTypeDefaultDescription
    childrenReactNode—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.
    durationnumber220Built-in fade duration in ms (default 220).
    enterAnyPreset—Entrance definition or preset for entering children (default: the built-in fade).
    exitAnyPreset—Entrance definition or preset for exiting children (default: the built-in fade).
    focusFallbackRefObject<HTMLElement | null>—Focus target when focus was inside an exiting child and no present sibling can take it.
    initialboolean—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.
  • PresenceState interface

    PresenceState

    PresenceState
    PropTypeDefaultDescription
    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.
  • ReflowProps interface

    ReflowProps

    ReflowProps
    PropTypeDefaultDescription
    asChildboolean——
    childrenReactNode——
    reducedMotionReducedMotion——
    refRef<HTMLDivElement>——
    transitionLayoutTransition——

    Also accepts the props of: React DOM attributes.

  • SharedLayoutOptions interface

    SharedLayoutOptions

    L04 — Shared layout: the same logical item rendered by a new element animates from the old one.

    SharedLayoutOptions
    PropTypeDefaultDescription
    groupLayoutGroup—The group whose snapshot/play cycle animates this element (createLayoutGroup(); <LayoutGroup>).
    layoutLayoutMode"position"What is animated (default "position"; "size"/"both" add a non-uniform scale).
    layoutIdstring—Stable id shared by the old and the new element (required).
    reducedMotionReducedMotion——
    transitionLayoutTransition——
  • TabIndicatorOptions interface

    TabIndicatorOptions

    L07 — Tab indicator slide (a package-rendered indicator inside the tab list).

    TabIndicatorOptions
    PropTypeDefaultDescription
    activeElement | number | null—The active tab: an element, its index among the tabs ([role="tab"], else children), or null.
    durationnumber | DurationPreset——
    easingEasing | EasingPreset——
    orientation"horizontal" | "vertical"——
    reducedMotionReducedMotion——
  • TabIndicatorProps interface

    TabIndicatorProps

    TabIndicatorProps
    PropTypeDefaultDescription
    activeElement | number | null—The active tab: an element, its index among the tabs ([role="tab"], else children), or null.
    asChildboolean—Apply to your tab list element instead of rendering a <div>.
    childrenReactNode——
    durationnumber | DurationPreset——
    easingEasing | EasingPreset——
    orientation"horizontal" | "vertical"——
    reducedMotionReducedMotion——
    refRef<HTMLDivElement>——

    Also accepts the props of: React DOM attributes.

  • LayoutMode type
    "position" | "size" | "both"
  • LayoutTransition type

    LayoutTransition

    Transition of layout animations: a spring (default) or a tween.

    LayoutTransition
    PropTypeDefaultDescription
    durationnumber | DurationPreset——
    easingEasing | EasingPreset——
    springSpringOptions | SpringPreset——
    type(required)"spring" | "tween"——
  • PresenceStatus type

    Presence 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"
Edit on GitHub