Section
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/scale-x-reveal.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/scale-x-reveal.tsxcomponents/motion/scale-x-reveal.tsx
Usage
Basic
Self-contained by default — no children needed. Draws scaleX 0 → 1 with a fade, anchored left.
With a label
Put text in an inner un-scaled span — ScaleXReveal scales the whole element horizontally, which would otherwise squash text as it draws in.
With delay
Offset a rule from its neighbors by a beat.
Trigger on mount
Skip the scroll-into-view check and draw immediately — useful above the fold or inside a modal.
Props
| Prop | Type | Default | Description |
|---|---|---|---|
| children | ReactNode | — | Usually omitted — pass this in an inner un-scaled span if you do, so text doesn't squash as the width draws in. |
| className | string | — | Passed straight through — ScaleXReveal becomes your layout element (e.g. a rule or underline). |
| style | CSSProperties | — | Inline style passthrough; merges with the internal transformOrigin. |
| delay | number | 0 | Seconds before this instance animates. |
| trigger | "inView" | "mount" | "inView" | Draw open the first time it's 30% in view, or immediately on mount. |