Transition
MotionMITSmooth transition primitive for animating value changes between states.
bun add @otfdashkit/ui
Preview
TransitionMotion
Loading Storybook preview…
Code
@otfdashkit/uiimport { FadeIn, Transition } from '@otfdashkit/ui'
import React, { useState } from 'react'
export function Example() {
const [show, setShow] = React.useState(true)
return (
<div className="space-y-4">
<button
onClick={() => setShow(!show)}
className="rounded-md bg-primary px-4 py-2 text-sm text-primary-foreground hover:bg-primary/90 transition-colors"
>
{show ? 'Hide' : 'Show'}
</button>
<Transition show={show}>
<FadeIn>
<div className="rounded-lg border border-border bg-card p-6">
<p className="text-foreground">Toggled content with enter/exit</p>
</div>
</FadeIn>
</Transition>
</div>
)
}
Free with the SDK. This pattern ships in @otfdashkit/ui under the MIT license.
Props
Props declared in the Transition source. Inherited HTML attributes are not listed.
| Prop | Type | Default | Description |
|---|---|---|---|
| childrenrequired | ReactNode | ||
| mode | 'wait' | 'sync' | 'popLayout' | 'wait' | |
| show | boolean | true |