Interactive card
Title, description, optional badge, custom content and an action button.
Preview
Lifts on hover with a spring. With reduced motion turned on, it renders the plain layout.
Starter kit
PopularEverything you need to launch, in one card.
Put any content here: a list, an image or a form.
Starter kit
PopularEverything you need to launch, in one card.
Put any content here: a list, an image or a form.
Installation
Run this in a project that already uses shadcn/ui. It adds the component and anything it needs; the motion version also adds the plain one and the motion package.
Usage
import { InteractiveCard } from "@/components/custom/interactive-card";
<InteractiveCard
title="Starter kit"
description="Everything you need to launch."
badge="Popular"
actionText="Open"
>
<p>Any content goes here.</p>
</InteractiveCard>import { InteractiveCardMotion } from "@/components/custom/interactive-card/interactive-card-motion";
<InteractiveCardMotion {...props} />Props
| Prop | Type | Default | Description |
|---|---|---|---|
| title* (required) | string | – | Card title. |
| description* (required) | string | – | Line under the title. |
| children | ReactNode | – | Custom content in the card body. |
| badge | string | – | Optional badge text. |
| badgeVariant | "default" | "secondary" | "destructive" | "outline" | "default" | Badge style. |
| actionText | string | – | Button text; no button when omitted. |
| onAction | () => void | – | Called when the button is clicked. Needs a client component parent. |
| hoverEffect | boolean | true | Lift the card on hover. |
| ...props | React.ComponentProps<"div"> | – | Any other div attribute (id, aria-*, data-*, ref) goes to the root element. |
| Prop | Type | Default | Description |
|---|---|---|---|
| title* (required) | string | – | Card title. |
| description* (required) | string | – | Line under the title. |
| children | ReactNode | – | Custom content in the card body. |
| badge | string | – | Optional badge text. |
| badgeVariant | "default" | "secondary" | "destructive" | "outline" | "default" | Badge style. |
| actionText | string | – | Button text; no button when omitted. |
| onAction | () => void | – | Called when the button is clicked. Needs a client component parent. |
| hoverEffect | boolean | true | Lift the card on hover. |
| ...props | React.ComponentProps<"div"> | – | Any other div attribute (id, aria-*, data-*, ref) goes to the root element. |
Accessibility
- The action button is described by the card title, so “Open” is announced with its context.
- The motion version follows the visitor's reduced-motion setting and never hides content before it animates.