Card

Displays a card with header, content, and footer.

@react.component
let make = () =>
  <Card className="w-full max-w-sm">

Installation

npx shadcn@latest add @rescript-shadcn/Card

Usage

<Card>
  <Card.Header>
    <Card.Title> {"Card Title"->React.string} </Card.Title>
    <Card.Description> {"Card Description"->React.string} </Card.Description>
    <Card.Action> {"Card Action"->React.string} </Card.Action>
  </Card.Header>
  <Card.Content>
    <p> {"Card Content"->React.string} </p>
  </Card.Content>
  <Card.Footer>
    <p> {"Card Footer"->React.string} </p>
  </Card.Footer>
</Card>

Examples

Size

Use the size=Sm prop to set the size of the card to small. The small size variant uses smaller spacing.

@react.component
let make = () => {
  let featureName = "Scheduled reports"

Image

Add an image before the card header to create a card with an image.

@react.component
let make = () =>
  <Card className="relative mx-auto w-full max-w-sm pt-0">

API Reference

Card

The Card component is the root container for card content.

PropTypeDefault
sizeDefault | SmDefault
classNamestring-

CardHeader

The CardHeader component is used for a title, description, and optional action.

PropTypeDefault
classNamestring-

CardTitle

The CardTitle component is used for the card title.

PropTypeDefault
classNamestring-

CardDescription

The CardDescription component is used for helper text under the title.

PropTypeDefault
classNamestring-

CardAction

The CardAction component places content in the top-right of the header (for example, a button or a badge).

PropTypeDefault
classNamestring-

CardContent

The CardContent component is used for the main card body.

PropTypeDefault
classNamestring-

CardFooter

The CardFooter component is used for actions and secondary content at the bottom of the card.

PropTypeDefault
classNamestring-