← All components
Slide
SlideDirectional slide — content slides in from a chosen direction and distance tier, with fade.
direction="up"
up
direction="down"
down
direction="left"
left
direction="right"
right
direction="up-left"
up-left
direction="up-right"
up-right
direction="down-left"
down-left
direction="down-right"
down-right
Installation
One command drops the source into your repo — editable, with the provider and motion pulled in automatically.
npx shadcn add https://motion.asmitsah.dev/r/slide.jsonPrerequisiteInstall the provider base first
This component imports from @/lib/motion and needs <MotionProvider> mounted in your root layout — install the base once, before copying this component.
npx shadcn add https://motion.asmitsah.dev/r/provider.jsonStep 1Install the runtime dependency
npm install motionStep 2Copy the source into
components/motion/slide.tsxcomponents/motion/slide.tsx
Usage
Direction
Pick any of the 8 travel directions — diagonals move on both axes.
Distance tier
tight (8px) · base (28px) · hero (64px) — or pass an explicit number.
Trigger on mount
Play immediately instead of waiting for scroll — for above-the-fold content.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Content that slides + fades in. |
| direction | "up" | "down" | "left" | "right" | "up-left" | "up-right" | "down-left" | "down-right" | — | One of 8 travel directions the content enters from. Required. |
| distance | "tight" | "base" | "hero" | number | "base" | Travel distance — a tier (8 / 28 / 64px) or an explicit px value. |
| trigger | "inView" | "mount" | "inView" | Animate on scroll-into-view (once) or immediately on mount. |
| className | string | — | Passed straight through — Slide becomes your layout element. |
| style | CSSProperties | — | Inline style passthrough. |
| delay | number | 0 | Seconds before this instance animates. |