structyl

Transition

stable

Manages entering/entered/exiting/exited states for CSS transitions.

Basic usage

fade

Examples

Slide animations

slide-up, slide-down, slide-left, slide-right — content enters from the opposite edge.

slide-up
slide-down
slide-left
slide-right

Scale animations

zoom scales from 75%, grow scales from 90% — both combine with fade.

zoom
grow

Collapse and fade

collapse slides from the top edge; fade is pure opacity-only.

collapse
fade

Render function (status)

Pass a function as children to receive the current transition status and drive custom styles.

state: entered

animation prop

Pick from 8 built-in animations: fade, slide-up/down/left/right, zoom, grow, collapse.

slide-up

Features

  • Eight animation types.
  • Four-stage state machine.
  • unmountOnExit support.
  • Timeout control.

Installation

bash
pnpm dlx structyl add transition

API Reference

Transition

Data-state transition wrapper.

PropTypeDefault
inboolean

Open state.

false
appearboolean

Marks initial appearance.

mountOnEnter | unmountOnExitboolean

Mount behavior.

false
timeoutnumber | { appear?: number; enter?: number; exit?: number }

Transition duration metadata.

classNamestring

Additional Tailwind classes merged with the component defaults.

Transition | structyl