package
A React primitive for building a stepper component
npm install react-animation-primitiveGitHub-flavored package documentation.
Across all versions.
Download trend unavailable.
Runtime metadata.
Tagged topics.
Estimated unpacked size across 7 packages.
141.8 kB
Includes dependencies.
You want a simple declarative animation container for an open / close, enter / leave element. Like a sidenav.
And you want it to weigh <3 kb.
npm install --save react-animation-primitive<AnimationPrimitive
phase={state.isOpen ? 'enter' : 'leave'}
listenerProp={'onTransitionEnd'}
render={({ getContainerProps, phase, phaseActive, phaseComplete }) =>
<div
{...getContainerProps({
class: cx(style.drawer, {
'hide': !phase || (phase === 'leave' && phaseComplete),
'enter': phase === 'enter',
'enter_active': phase === 'enter' && phaseActive,
'leave': phase === 'leave',
'leave_active': phase === 'leave' &&
<AnimationPrimitive>
string| required
Must be either 'enter' or 'leave'.
When a phase is set, it will change the phase, call render, and wait for onTransitionEnd or onAnimationEnd (depending on listenerProp), then call render again.
string| default'onTransitionEnd'| optional, one of'onTransitionEnd'or'onAnimationEnd'
Set whether phases change on transition or animation end events. Defaults to transition events.
function| required
<AnimationPrimitive render={() => <div />} />
The render prop function is called with the following object:
| property | category | type | description |
|---|---|---|---|
| phase | state | string | The current phase. Either 'enter' or 'leave'. |
| phaseActive | state | boolean | Whether this phase is currently running. For example, true if phase was just set to 'enter' and transition is in progress. False when 'enter' transition finishes. |
| phaseComplete | state | boolean | Whether a transition just finished. True if this state was active and is no longer active. |
| getContainerProps | prop getter | function | Get the props to put on your container element which will be transitioning. Contains a transitionend/animationend event listener. |
MIT © Andrew Joslin