Components
- Accordion
- Add to Cart
- Animated List
- Carousel
- Collapsible Sidebarnew
- Dynamic Island
- Expandable Cardnew
- Expanding Searchnew
- Filter Grid
- Kanban Board
- Layout Switcher
- Morphing Popover
- Number Flip
- Page Transition
- Product Gallery
- Segmented Control
- Sortable Table
- Stack Navigator
- Status Button
- Step Wizard
- Tabs
- Text Morphnew
- Theme Mode Switch
- Theme Morph Button
- Theme Toggle Button
- Theme Toggle Switch
- Theme Transition
- Toast Stacknew
Installation
$ pnpm dlx shadcn@latest add @transition-kit/theme/gif-michael-jacksonUsage
<ThemeTransitionProvider transition="gif-michael-jackson">
{children}
</ThemeTransitionProvider>const { toggleTheme } = useThemeTransition();
<button
type="button"
onClick={(event) =>
toggleTheme({ transition: "gif-michael-jackson", origin: event })
}
>
Toggle theme
</button>;API Reference
| Prop | Type | Default | Description |
|---|---|---|---|
transition | string | The provider's transition | "gif-michael-jackson" for this style: on the provider for every change, or per change with setTheme / toggleTheme. |
duration | number | 1700 | Milliseconds on the provider. Overrides this style's 1700ms timing. Edit var(--tk-theme-duration, 1700ms) in the style's CSS to change only this style. |
easing | string | cubic-bezier(0.16, 1, 0.3, 1) | Easing on the provider. Overrides this style's easing. Edit var(--tk-theme-easing, cubic-bezier(0.16, 1, 0.3, 1)) in the style's CSS to change only this style. |
origin | { clientX: number; clientY: number } | Element | The viewport centre | Pass the click event to start at the pointer, or an element to start at its centre. |
Notes
The mask is a GIF loaded from Tenor:
https://media.tenor.com/MdlKGirpTAQAAAAi/michael-jackson-moon-walk.gifUntil the browser has downloaded it, the mask is empty and the theme switches when the transition ends. Preload it so the first transition plays, or download it and serve it from your own domain:
<link
rel="preload"
as="image"
href="https://media.tenor.com/MdlKGirpTAQAAAAi/michael-jackson-moon-walk.gif"
/>If you swap in another image, keep the reveal centred by updating the aspect ratio (height ÷ width) used in the mask-position calculations.