Kaapi UI

Card

The Card component is a flexible container for grouping content with an optional header, footer, and actions.

← Back to components

Example

Card Title
This is the card description.
This is the main content of the card.
Footer text

<Card
    className="w-full max-w-md"
    title="Card Title"
    description="This is the card description."
    action={<Button>Action</Button>}
    content={<p>This is the main content of the card.</p>}
    footer={<span className="text-sm text-muted-foreground">Footer text</span>}
  />

Login Card

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

<Card
    className="w-full max-w-sm"
    title="Login to your account"
    description="Enter your email below to login to your account"
    action={<Button variant="link-color">Sign Up</Button>}
    content={
        <form>
            <div className="flex flex-col gap-6">
                <div className="grid gap-2">
                    <Label htmlFor="email">Email</Label>
                    <Input
                        id="email"
                        type="email"
                        placeholder="m@example.com"
                        required
                    />
                </div>
                <div className="grid gap-2">
                    <div className="flex items-center">
                        <Label htmlFor="password">Password</Label>
                        <a
                            href="#"
                            className="ml-auto inline-block text-sm underline-offset-4 hover:underline"
                        >
                            Forgot your password?
                        </a>
                    </div>
                    <Input id="password" type="password" required />
                </div>
            </div>
        </form>
    }
    footer={
        <div className="flex flex-col gap-2 w-full">
            <Button type="submit" className="w-full">
                Login
            </Button>
            <Button variant="secondary" className="w-full">
                Login with Google
            </Button>
        </div>
    }
/>

API Reference

Card

PropsTypeDefaultDescription
title?stringCard title text
description?stringCard description text
action?React.ReactNodeOptional action element (e.g. button)
contentReact.ReactNodeMain card content
footer?React.ReactNodeFooter content
className?stringAdditional styles for the card
headerClassName?stringCustom class for header
titleClassName?stringCustom class for title
descriptionClassName?stringCustom class for description
actionClassName?stringCustom class for action slot
contentClassName?stringCustom class for content
footerClassName?stringCustom class for footer