Ghostcn
Skip to Content
ComponentsPrimitives

Card

A composable content card with optional heading, description and footer.

Install

npx ghostcn@1.4.0 add card --skip-existing

Usage

Use body for escaped text, or a trusted Handlebars partial block for rich template content. See Compose publication blocks for a nested button example.

{{> "components/card"
    heading="From the editor"
    description="A note about this issue."
    body="Thanks for reading."
}}

Component options

ParameterBehavior
variantVisual treatment; unknown values fall back to default. Values: default, secondary, outline. Default: default.
sizeComponent scale; unknown values fall back to default. Values: sm, default, lg. Default: default.
headingOptional card heading (h3).
descriptionOptional introductory text.
bodyEscaped text body when called as an ordinary partial.
footerOptional escaped footer text.

Customize this instance

{{> "components/card"
    heading="From the editor"
    description="A note about this issue."
    body="Thanks for reading."
    class="rounded-2xl bg-card text-card-foreground shadow-sm"
}}

Styling parameters

ParameterTarget
classComponent root — .ghcn-ui-card
titleClass.ghcn-ui-card__title
descriptionClass.ghcn-ui-card__description
contentClass.ghcn-ui-card__content
footerClass.ghcn-ui-card__footer

Styling parameters affect only elements that render. See Style component instances for specificity, dark mode, and preserving customizations.

Installed files

  • partials/components/card.hbs
  • assets/css/components/card.css

View the registry source

Edit this page on GitHub

Was this helpful?

On this page