Motion React
boldkit/motion-reactFreeComponent
BoldKit Motion React adapter — <Motion>/<Reveal>/<Stagger> components plus useShake and useViewTransition hooks over a framework-agnostic core.
Live preview
live · rendered by the registry
Rendered by boldkit on their own page — this is the component running, not a screenshot of it.Install it
npx shadcn@latest add https://boldkit.dev/r/motion-react.jsonSource
1/* eslint-disable react-refresh/only-export-components */2/**3 * BoldKit Motion — React adapter (L3).4 *5 * Thin wrapper around @boldkit/motion-core. Adds React lifecycle wiring6 * to the framework-agnostic primitives. The Vue adapter mirrors this7 * surface 1:1 so apps can switch frameworks without re-learning the API.8 *9 * Requires `motion.css` (L2 recipes) to be loaded. If you're using10 * BoldKit's globals.css, the recipes are already included.11 */12import * as React from 'react'13import { cn } from '@/lib/utils'14import {15 observeReveal,16 staggerChildren,17 triggerAnimation,18 startViewTransition,19 prefersReducedMotion,20 type RevealOptions,21 type StaggerOptions,22} from '@/lib/motion-core'2324// ──────────────────────────────────────────────────────────────────25// <Reveal> — scroll-triggered entrance26// ──────────────────────────────────────────────────────────────────2728export type RevealDirection = 'up' | 'down' | 'left' | 'right'2930export interface RevealProps31 extends React.HTMLAttributes<HTMLDivElement>,32 Omit<RevealOptions, 'rootMargin'> {33 /** Direction to slide in from. Default 'up'. */34 direction?: RevealDirection35 /** Custom IntersectionObserver rootMargin. */36 rootMargin?: string37 /** Element tag to render. Default 'div'. */38 as?: keyof React.JSX.IntrinsicElements39}4041export const Reveal = React.forwardRef<HTMLDivElement, RevealProps>(42 ({ direction = 'up', rootMargin, threshold, once, delay, as, className, children, ...rest }, ref) => {43 const innerRef = React.useRef<HTMLDivElement | null>(null)44 React.useImperativeHandle(ref, () => innerRef.current as HTMLDivElement)4546 React.useEffect(() => {47 const el = innerRef.current48 if (!el) return49 return observeReveal(el, { rootMargin, threshold, once, delay })50 }, [rootMargin, threshold, once, delay])5152 const Tag = (as ?? 'div') as React.ElementType53 return (54 <Tag55 ref={innerRef}56 className={cn('bk-reveal', `bk-reveal-${direction}`, className)}57 {...rest}58 >59 {children}60 </Tag>61 )62 }63)64Reveal.displayName = 'Reveal'6566// … truncated
What it pulls in
Other registry items
Files it writes
More from boldkit
All 94 items| Component | Registry | Kind | Access | Installs | Command |
|---|---|---|---|---|---|
| Accordionaccordion | boldkit | Components | Free | 2 deps | |
| Alertalert | boldkit | Components | Free | 2 deps | |
| Alert Dialogalert-dialog | boldkit | Components | Free | 1 dep | |
| ASCII Shapesascii-shapes | boldkit | Components | Free | no deps | |
| Aspect Ratioaspect-ratio | boldkit | Components | Free | 1 dep | |
| Avataravatar | boldkit | Components | Free | 1 dep | |
| Badgebadge | boldkit | Components | Free | 1 dep | |
| Breadcrumbbreadcrumb | boldkit | Components | Free | 2 deps |
