Unkey
ComponentsCards

Card

A flexible container component for grouping related content with optional header, footer, and content sections.

Basic Usage

import { Card, CardContent } from "@unkey/ui";
 
export default function MyComponent() {
  return (
    <Card>
      <CardContent>
        <p>Your content goes here</p>
      </CardContent>
    </Card>
  );
}

Examples

Basic Card

A simple card with just content.

This is a basic card with just content. Perfect for simple layouts where you only need a container with consistent styling.

Card with Header

Card with a title and description in the header.

Card Title

This card has a header with a title and description. Great for introducing content sections.

Your main content goes here. The header provides clear context for what this card contains.

Card with action buttons in the footer.

This card includes a footer section with actions. The footer has a border separator and consistent spacing.

Complete Card

Card with header, content, and footer sections.

Complete Card Example

This card demonstrates all components working together: header, content, and footer.

This is the main content area where you can place any content you need.

Item 1
Item 2
Last updated: 2 hours ago

Metric Card

Specialized card for displaying metrics with MetricCardTitle.

Total API Calls

1,234,567

This month+12.5%
This week+8.2%

Card Grid

Multiple cards in a responsive grid layout.

API Keys

Manage your API keys

Create and manage API keys for your applications.

Analytics

View usage analytics

Requests

45.2K

Success Rate

99.9%

Settings

Configure your workspace

Update your workspace settings and preferences.

Components

The Card system is composed of several subcomponents:

  • Card: The main container
  • CardHeader: Container for title and description
  • CardTitle: Main heading text (h2 element)
  • MetricCardTitle: Title specifically for metrics (p element)
  • CardDescription: Subtitle or description text
  • CardContent: Main content area
  • CardFooter: Footer area with border separator

Props

Card

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedCard content

CardHeader

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedHeader content

CardTitle

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedTitle text

MetricCardTitle

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedMetric title text

CardDescription

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedDescription text

CardContent

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedMain content

CardFooter

PropTypeDefaultDescription
classNamestringundefinedAdditional CSS classes
childrenReact.ReactNodeundefinedFooter content

Features

  • Composable architecture for flexible layouts
  • Consistent styling with design system
  • Built-in spacing and typography
  • Responsive design
  • Border and background styling
  • Accessible semantic structure

Best Practices

  • Use CardTitle for main headings and MetricCardTitle for numeric metrics
  • Include CardDescription to provide context for the card content
  • Use CardFooter for actions or additional information
  • Combine components based on your content needs
  • Apply consistent spacing using the default padding

Accessibility

  • Uses semantic HTML elements (h2 for CardTitle, p for descriptions)
  • Maintains proper heading hierarchy
  • Provides sufficient color contrast
  • Supports keyboard navigation
  • Screen reader friendly structure

On this page