Skip to content

shadcn.io is not affiliated with official shadcn/ui

Shadcn Card for React

A surface for a single subject: header, media, body, and footer.

Login to your account
Enter your email below to login to your account

Installation

bunx --bun shadcn@latest add https://kit.dev/r/radix/card.json

Usage

import { Button } from "@/components/ui/button";
import {
  Card,
  CardAction,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@/components/ui/card";
import { Field, FieldLabel } from "@/components/ui/field";
import { Input } from "@/components/ui/input";
<Card className="w-full max-w-sm">
  <CardHeader>
    <CardTitle>Login to your account</CardTitle>
    <CardDescription>
      Enter your email below to login to your account
    </CardDescription>
    <CardAction>
      <Button variant="link">Sign Up</Button>
    </CardAction>
  </CardHeader>
  <CardContent>
    <form>
      <div className="flex flex-col gap-6">
        <Field className="gap-2">
          <FieldLabel>Email</FieldLabel>
          <Input placeholder="[email protected]" required type="email" />
        </Field>
        <Field className="gap-2">
          <div className="flex items-center">
            <FieldLabel>Password</FieldLabel>
            <a
              className="ml-auto inline-block text-sm underline-offset-4 hover:underline"
              href="#"
            >
              Forgot your password?
            </a>
          </div>
          <Input required type="password" />
        </Field>
      </div>
    </form>
  </CardContent>
  <CardFooter className="flex-col gap-2">
    <Button className="w-full" type="submit">
      Login
    </Button>
    <Button className="w-full" variant="outline">
      Login with Google
    </Button>
  </CardFooter>
</Card>

Accessibility

KeyDescription
Enter
Activate the focused control.
Space
Activate the focused control.

Demos

Small

Use the size="sm" prop for a compact card with tighter spacing.

Spacing

Override --card-spacing to control section gaps and insets.

Edge To Edge

Use negative --card-spacing margins for edge-to-edge content above a footer.

Image

Place an image before the header for a media card.

Rtl

Right-to-left card. See the RTL configuration guide for document direction.

API Reference

Card

PropType
AttributeType

CardMedia

PropType
AttributeType

CardHeader

PropType
AttributeType

CardTitle

PropType
AttributeType

CardDescription

PropType
AttributeType

CardAction

PropType
AttributeType

CardContent

PropType
AttributeType

CardFooter

PropType
AttributeType