Skip to content

Card

Surface with header, content, footer and action regions.

Installation

bun add @xerobi/ui
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

Next steps
Finish setting up your project.
Connect a repository to deploy on every push.
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>
  )
}
Billing
Pro plan, renews on the first of each month.
Last invoice paid
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.

PropTypeDescription
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"].

Search documentation

Search pages, components and blocks.