---
title: "Card"
description: "A surface that groups related content, with optional header and footer."
---

Interactive preview: https://ui.coderocket.app/docs/components/card

## Usage

Get this component from a [saved library export](/docs/export) or the [connected CLI](/docs/agents). The imports below refer to local files installed in your app.

Import `styles/components.css`, then `styles/theme.css` once. Wrap your app in `ThemeScope` from `components/ui/utils` so typography, focus and overlays share the theme. The [installation guide](/docs/export) covers runtime dependencies and React/Next.js setup.

```tsx
import { Card } from './components/ui/card';

<Card title="Project settings" description="Make this workspace your own.">Your content goes here.</Card>
```

## Design system

This component consumes your semantic colors, spacing, typography and shape tokens. Import the compiled styles and your theme once as described in [Export](/docs/export).

## Behavior and accessibility

- Provide meaningful labels for interactive controls.
- Connect action callbacks to your application logic.
- Verify keyboard navigation and contrast in your application.

Status: **experimental** during early access. Sample previews do not send emails, process payments or upload files to a service.

## Source and props

This is the exported source, using the same implementation as the editor.

```tsx
"use client";
import type { HTMLAttributes, ReactNode } from "react";
import { cx } from "./utils";
export function Card({
  title,
  description,
  footer,
  children,
  className,
  ...props
}: Omit<HTMLAttributes<HTMLElement>, "title"> & {
  title?: ReactNode;
  description?: ReactNode;
  footer?: ReactNode;
}) {
  return (
    <section {...props} className={cx("cr-card", className)}>
      {(title || description) && (
        <header className="cr-card-header">
          {title && <h3 className="cr-card-title">{title}</h3>}
          {description && <p className="cr-description">{description}</p>}
        </header>
      )}
      <div className="cr-card-body">{children}</div>
      {footer && <footer className="cr-card-footer">{footer}</footer>}
    </section>
  );
}
```
