shadcn-templ 2.0 beta. Switch to templUI v1
1.7k

Card

Displays a card with header, content, and footer.

Login to your account
Enter your email below to login to your account
package examples import (

Installation

shadcn-templ add card

Usage

import "github.com/axadrn/shadcn-templ/v2/components/card"
@card.Card() {	@card.Header() {		@card.Title() {			Card Title		}		@card.Description() {			Card Description		}		@card.Action() {			Card Action		}	}	@card.Content() {		<p>Card Content</p>	}	@card.Footer() {		<p>Card Footer</p>	}}

Composition

Use the following composition to build a Card:

card.Card├── card.Header│   ├── card.Title│   ├── card.Description│   └── card.Action├── card.Content└── card.Footer

Size

Use the Size: card.SizeSm prop to set the size of the card to small. The small size variant uses smaller spacing.

Scheduled reports
Weekly snapshots. No more manual exports.
  • Choose a schedule (daily, or weekly).
  • Send to channels or specific teammates.
  • Include charts, tables, and key metrics.
package examples import (

Spacing

In addition to the Size prop, you can use the --card-spacing CSS variable to control the spacing between sections and the inset of card parts.

Login to your account
Enter your email below to login to your account
package examples import (

Use negative margins with -mx-(--card-spacing) to make content go edge to edge while keeping it aligned with the card inset. When the edge-to-edge content sits above a footer, use -mb-(--card-spacing) on card.Content to remove the section gap.

Terms of Service
Review the terms before accepting the agreement.

These terms govern your use of the workspace, including access to shared documents, project files, and collaboration tools.

You are responsible for the content you upload and for ensuring that your team has the appropriate permissions to view or edit it.

We may update features or limits as the service evolves. When those changes materially affect your workflow, we will notify your workspace administrators.

By continuing, you agree to keep your account credentials secure and to follow your organization's acceptable use policies.

package examples import (

Image

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

Event cover
Featured
Design systems meetup
A practical talk on component APIs, accessibility, and shipping faster.
package examples import (

API Reference

Card

The Card component is the root container for card content.

Prop Type Default
Size SizeDefault | SizeSm SizeDefault
Class string -

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

Prop Type Default
Class string -

Title

The card.Title component is used for the card title.

Prop Type Default
Class string -

Description

The card.Description component is used for helper text under the title.

Prop Type Default
Class string -

Action

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

Prop Type Default
Class string -

Content

The card.Content component is used for the main card body.

Prop Type Default
Class string -

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

Prop Type Default
Class string -