Card
Surface with header, content, footer and action regions.
Installation
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@xerobi/ui/card"This component is client-side. In Astro, hydrate it with a client directive.
Examples
Default
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@xerobi/ui/card"
export function CardDefault() {
return (
<Card className="w-72">
<CardHeader>
<CardTitle>Next steps</CardTitle>
<CardDescription>Finish setting up your project.</CardDescription>
</CardHeader>
<CardContent className="text-body2">Connect a repository to deploy on every push.</CardContent>
</Card>
)
}With action and footer
import { Button } from "@xerobi/ui/button"
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from "@xerobi/ui/card"
export function CardWithAction() {
return (
<Card className="w-72">
<CardHeader>
<CardTitle>Billing</CardTitle>
<CardAction>
<Button size="sm" variant="outline">Manage</Button>
</CardAction>
</CardHeader>
<CardContent className="text-body2">Pro plan, renews on the first of each month.</CardContent>
<CardFooter className="text-caption text-text-secondary">Last invoice paid</CardFooter>
</Card>
)
}API reference
Card
Also accepts every prop of <div> element.
| Prop | Type | Description |
|---|---|---|
| size | "default" | "sm" |
CardAction
Also accepts every prop of <div> element.
No props of its own.
CardContent
Also accepts every prop of <div> element.
No props of its own.
CardDescription
Also accepts every prop of <div> element.
No props of its own.
CardFooter
Also accepts every prop of <div> element.
No props of its own.
CardHeader
Also accepts every prop of <div> element.
No props of its own.
CardTitle
Also accepts every prop of <div> element.
No props of its own.
Styling hooks: [data-slot="card"], [data-slot="card-header"], [data-slot="card-title"], [data-slot="card-description"], [data-slot="card-action"], [data-slot="card-content"], [data-slot="card-footer"].