Card

Card

Flexible container components for displaying content in a bordered box.

Card content goes here
1234567891011121314
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" ) templ CardDefault() { @popui.Card() { @popui.CardContent() { Card content goes here } } }

With Header

Cards can include a header with avatar, title, and subtitle using the CardHeader component.

J

John Doe

Software Engineer

This card includes a header with an avatar and title information.
1234567891011121314151617181920212223
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" ) templ CardWithHeader() { @popui.Card() { @popui.CardHeader(props.CardHeader{ Title: "John Doe", Subtitle: "Software Engineer", }) { @popui.Avatar(props.Avatar{ Size: "lg", Initial: "J", }) } @popui.CardContent() { This card includes a header with an avatar and title information. } } }

Disabled State

Cards can be disabled to indicate they are not interactive.

Disabled Card

Cannot be interacted with

This card is disabled.
123456789101112131415161718
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" ) templ CardDisabled() { @popui.Card(props.Card{Disabled: true}) { @popui.CardHeader(props.CardHeader{ Title: "Disabled Card", Subtitle: "Cannot be interacted with", }) @popui.CardContent() { This card is disabled. } } }

As Link

Cards can act as clickable links by providing an Href prop, rendering as an anchor element.

12345678910111213141516171819202122232425
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" ) templ CardAsLink() { @popui.Card(props.Card{ Href: "/profile", }) { @popui.CardHeader(props.CardHeader{ Title: "Clickable Card", Subtitle: "Click anywhere to navigate", }) { @popui.Avatar(props.Avatar{ Size: "lg", Initial: "C", }) } @popui.CardContent() { This entire card is clickable. } } }

Progress Bar

CardProgressBar displays progress with a visual indicator and optional counter.

Logo

Usage Statistics

Track your API consumption

API Requests ยท This month

7500 / 10000
123456789101112131415161718192021222324252627282930
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" ) templ CardProgressBar() { @popui.Card() { @popui.CardHeader(props.CardHeader{ Title: "Usage Statistics", Subtitle: "Track your API consumption", }) { @popui.Avatar(props.Avatar{ Size: "lg", }) { @popui.Image(props.Image{ Src: "https://i.pravatar.cc/150?img=68", Alt: "Logo", }) } } @popui.CardProgressBar(props.CardProgressBar{ Title: "API Requests", Subtitle: "This month", Current: 7500, Total: 10000, }) } }

Dashboard

CardDashboard displays multiple metrics in a grid layout.

Monthly Overview

Key performance metrics

  • Revenue

    $12.5k

  • Orders

    243

  • Customers

    89

12345678910111213141516171819202122232425262728293031
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" ) templ CardDashboard() { @popui.Card() { @popui.CardHeader(props.CardHeader{ Title: "Monthly Overview", Subtitle: "Key performance metrics", }) @popui.CardContent() { @popui.CardDashboard() { @popui.CardDashboardItem(props.CardDashboardItem{ Label: "Revenue", Value: "$12.5k", }) @popui.CardDashboardItem(props.CardDashboardItem{ Label: "Orders", Value: "243", }) @popui.CardDashboardItem(props.CardDashboardItem{ Label: "Customers", Value: "89", }) } } } }

File Card

CardFile provides a container for displaying file information.

dni_back_already_stored.png

Descargar
123456789101112131415161718192021
package showcase import ( popui "github.com/invopop/popui/go" "github.com/invopop/popui/go/props" "github.com/invopop/popui/icons" ) templ CardFile() { @popui.CardFile() { @popui.CardFileInfo(props.CardFileInfo{ Label: "dni_back_already_stored.png", }) { <img src="https://upload.wikimedia.org/wikipedia/commons/thumb/8/89/Spanish_ID_card_%28back_side%29.webp/473px-Spanish_ID_card_%28back_side%29.webp.png?20210720095942" height="32" width="50"/> } @popui.AnchorButton(props.AnchorButton{Variant: "transparent"}) { @icons.Download() Descargar } } }

API Reference

Card

Main container component for displaying content in a bordered box.

NameTypeDefaultDescription
ID string-Unique identifier for the card element
Class string-Additional CSS classes to merge with card styles
Attributes templ.Attributes-Additional HTML attributes (data-*, aria-*, etc.)
Href templ.SafeURL-URL to navigate to when card is clicked (renders as anchor)
Disabled boolfalseDisables the card and applies disabled styling

CardContent

Content container for cards with consistent padding and text styling.

NameTypeDefaultDescription
ID string-Unique identifier for the content element
Class string-Additional CSS classes to merge with content styles
Attributes templ.Attributes-Additional HTML attributes

CardHeader

Header component for cards. Expects Avatar or other content as children.

NameTypeDefaultDescription
ID string-Unique identifier for the header element
Class string-Additional CSS classes to merge with header styles
Attributes templ.Attributes-Additional HTML attributes
Title string-Main title text
Subtitle string-Secondary subtitle text

CardProgressBar

Displays progress with a visual bar and optional counter.

NameTypeDefaultDescription
ID string-Unique identifier for the progress bar element
Class string-Additional CSS classes to merge with progress bar styles
Attributes templ.Attributes-Additional HTML attributes
Title string-Main title text
Subtitle string-Secondary subtitle text
Current int640Current progress value
Total int640Total/maximum value for progress
HideCounter boolfalseHides the numeric counter display

CardDashboard

Grid layout for displaying multiple metrics. Expects CardDashboardItem components as children.

NameTypeDefaultDescription
ID string-Unique identifier for the dashboard element
Class string-Additional CSS classes to merge with dashboard styles
Attributes templ.Attributes-Additional HTML attributes

CardDashboardItem

Individual metric item for CardDashboard.

NameTypeDefaultDescription
ID string-Unique identifier for the item element
Class string-Additional CSS classes to merge with item styles
Attributes templ.Attributes-Additional HTML attributes
Label string-Label text for the metric
Value string-Value text for the metric

CardFile

Container for displaying file information. Expects CardFileInfo and action buttons as children.

NameTypeDefaultDescription
ID string-Unique identifier for the file card element
Class string-Additional CSS classes to merge with file card styles
Attributes templ.Attributes-Additional HTML attributes

CardFileInfo

Structured layout for file information within CardFile (icon, name, etc.).

NameTypeDefaultDescription
ID string-Unique identifier for the file info element
Class string-Additional CSS classes to merge with file info styles
Attributes templ.Attributes-Additional HTML attributes
Label string-File name or label text to display