A card that leans away from your pointer: the surface shifts a few pixels and grows a touch, while its content and media move a little further, so the layers read as depth. It springs back on leave, and holds still on touch screens and with reduced motion.
- Feature tiles
- Pricing highlights
- Product shots
- Landing cards
Examples
Installation
npx knowns-ui@latest add parallax-cardPaste this into your coding agent (Claude Code, Cursor, Codex). It checks your project, sets up the registry, runs the install and verifies it.
Install Parallax Card from Knowns UI into this project. Work step by step, show me each change, and ask before you edit files outside this project.
Context: Knowns UI (https://ui.knowns.dev) is a shadcn registry. Items land in the project as source files. Docs: https://ui.knowns.dev/docs/parallax-card
1. Check the project first. Stop and tell me if any of these is missing:
- React 19 and Tailwind CSS v4.
- A components.json at the project root. If there is none, ask me before running `npx knowns-ui@latest init --no-key` (it runs shadcn init when needed, then adds the registries).
2. Run:
```bash
npx knowns-ui@latest add parallax-card
```
It writes these files:
- lib/knowns/run.ts
- lib/knowns/json.tsx
- lib/knowns/status.ts
- lib/knowns/tone.ts
- lib/knowns/types.ts
- lib/knowns/use-abortable.ts
- lib/knowns/utils.ts
- components/ui/knowns/illustrations/illust-utils.ts
- components/ui/knowns/illustrations/use-in-view.ts
- components/ui/knowns/parallax-card.tsx
and installs these npm packages: clsx@^2.1.1, tailwind-merge@^3.7.0.
3. While it runs:
- It also adds a few @keyframes (all named kn-*) to the global CSS file (globals.css or the file components.json points at). Let it: they only add animations.
- If it asks to overwrite files under lib/knowns/: these are shared by every Knowns UI item. List them, say whether I changed them (check git), and ask me before you answer.
- If it asks to overwrite any other file, show me the diff and ask me.
4. Verify:
- Every file in the list above exists.
- The project type-checks (for example `npx tsc --noEmit`) and the dev build has no new errors.
5. Use it: follow the examples and props on https://ui.knowns.dev/docs/parallax-card, and ask me if anything about my data is unclear.
If the Knowns UI MCP server is connected (https://ui.knowns.dev/docs/ai-and-mcp), use get_component({ name: "parallax-card" }) or search_docs for details.
Finish with a short summary: the files you added or changed, the packages you installed, and anything I still need to do.Props
- tone
"plain"|"muted"|"accent"- Default
"plain" - The ground: the card colour, a quiet muted fill, or a light tint of `tint` with a matching hairline.
- tint
string- Default
indigo - The accent tint for tone accent: any CSS colour or a token such as var(--primary).
- grain
boolean|number- Default
false - A soft film grain over the ground; a number sets its opacity, 0 to 0.3.
- depth
number- Default
10 - How far the content travels at the card's edge, in px. The surface moves half as much, media about twice the surface.
- scale
number- Default
1.02 - Hover scale of the surface.
- media / mediaSide
ReactNode / "right"|"bottom"- Default
- / "right" - A screenshot or illustration placed on an edge and bleeding off it. Right moves to the bottom on small screens.
- contentClassName
string- Default
"p-6 sm:p-8" - Classes for the content layer, e.g. a max width that leaves room for the media.
- Motion
-- Transforms only, so no layout shift. One rAF loop runs while hovered or settling and writes transforms directly (no re-renders). Off on touch and coarse pointers and with reduced motion.
| Prop | Type | Default | Description |
|---|---|---|---|
| tone | "plain" | "muted" | "accent" | "plain" | The ground: the card colour, a quiet muted fill, or a light tint of `tint` with a matching hairline. |
| tint | string | indigo | The accent tint for tone accent: any CSS colour or a token such as var(--primary). |
| grain | boolean | number | false | A soft film grain over the ground; a number sets its opacity, 0 to 0.3. |
| depth | number | 10 | How far the content travels at the card's edge, in px. The surface moves half as much, media about twice the surface. |
| scale | number | 1.02 | Hover scale of the surface. |
| media / mediaSide | ReactNode / "right" | "bottom" | - / "right" | A screenshot or illustration placed on an edge and bleeding off it. Right moves to the bottom on small screens. |
| contentClassName | string | "p-6 sm:p-8" | Classes for the content layer, e.g. a max width that leaves room for the media. |
| Motion | - | - | Transforms only, so no layout shift. One rAF loop runs while hovered or settling and writes transforms directly (no re-renders). Off on touch and coarse pointers and with reduced motion. |
What it handles
- 01Leans the surface a few pixels away from the pointer and grows it to 102% while the pointer is over it.
- 02Moves the content layer and an optional `media` slot further than the surface, so the layers read as depth.
- 03Sets how far things travel with `depth` in pixels and how much the surface grows with `scale`.
- 04Lets `media` bleed off the `right` or `bottom` edge, with the right edge moving to the bottom on small screens.
- 05Picks a ground with `tone` plain, muted or accent, tinted by `tint`, with a static noise tile from `grain`.
- 06Uses transforms only and one frame loop that runs while the pointer is over the card or the spring is settling, and stays still for touch and reduced motion.
States
- First render
- Nothing. The card paints at rest
- none
- Pointer over the card
- The layers follow the pointer with a spring
- none
- Pointer leaves
- The layers spring back to rest
- none
- Reduced motion or touch
- The card stays still
- 0ms
| State | What moves | Timing |
|---|---|---|
| First render | Nothing. The card paints at rest | none |
| Pointer over the card | The layers follow the pointer with a spring | none |
| Pointer leaves | The layers spring back to rest | none |
| Reduced motion or touch | The card stays still | 0ms |
Works with
When to use
When to use
- A few feature cards in a bento or a launch section, where a little depth on hover invites a closer look.
- A card with a product screenshot bleeding off its edge, so the screenshot feels like a window into the app.
When not to use
- Dense grids, lists or anything people click through quickly: motion on every card gets tiring.
- Pointing at the one option to choose: use Shine Border.
Using with AI
Use Copy page for AI above to give your assistant this page, Copy prompt under the install command to have it installed and wired to your data, or connect the Knowns UI MCP server and just ask:
- Add the Knowns UI Parallax Card to my app and wire it to my own data.
- I need a few feature cards in a bento or a launch section, where a little depth on hover invites a closer look. Set that up with the Knowns UI Parallax Card.
- Which Parallax Card props do I need for a minimal setup? Show me a short example.
With the server connected, your assistant calls get_component({ name: "parallax-card" }) and search_docs({ query: "parallax card" }).