import * as React from "react"; import {cn} from "@/lib/utilities"; import styles from "./card.module.css"; /** * Represents the shared styling props supported by the Card root container. * * @remarks * Extends native `
` attributes so cards can participate in semantic layouts, * landmarks, and custom event handling while exposing a documented class override. */ interface CardProps extends React.HTMLAttributes { /** * Additional CSS classes merged with the default card surface styles. */ className?: string; } /** * Represents the shared styling props supported by card layout sections. * * @remarks * Use these props for presentational card regions such as headers, content blocks, * action rows, and footers. All standard `
` attributes continue to work. */ interface CardSectionProps extends React.HTMLAttributes { /** * Additional CSS classes merged with the section's default spacing styles. */ className?: string; } /** * A card container for grouping related content into a bordered surface. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a styled `
` with the library's card border, background, and shadow. * Compose it with {@link CardHeader}, {@link CardContent}, and {@link CardFooter} * to create structured panels without depending on a Base UI primitive. * * @example * ```tsx * * * Team activity * Latest changes across your workspace. * * {children} * Updated 2 minutes ago * * ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const Card = React.forwardRef(({className, ...props}, ref) => (
)); Card.displayName = "Card"; /** * A header region for card titles, descriptions, and top-level actions. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a `
` with vertical spacing tuned for leading card content. * Place {@link CardTitle}, {@link CardDescription}, and optional controls inside it. * * @example * ```tsx * * Revenue * Monthly recurring revenue overview. * * ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const CardHeader = React.forwardRef(({className, ...props}, ref) => (
)); CardHeader.displayName = "CardHeader"; /** * A prominent title slot for the primary heading inside a card. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a styled `
` for visual hierarchy. Provide semantic heading elements * inside it when the surrounding document outline requires explicit heading levels. * * @example * ```tsx * Security overview * ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const CardTitle = React.forwardRef(({className, ...props}, ref) => (
)); CardTitle.displayName = "CardTitle"; /** * A muted text block for supporting information beneath a card title. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a styled `
` intended for secondary copy, helper messaging, or status * summaries that contextualize the main card heading. * * @example * ```tsx * Track response times and alert volume in one place. * ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const CardDescription = React.forwardRef(({className, ...props}, ref) => (
)); CardDescription.displayName = "CardDescription"; /** * A compact action slot aligned alongside card header content. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a `
` positioned for buttons, menus, or status badges that should sit * at the top edge of the card without disturbing header spacing. * * @example * ```tsx * * * * ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const CardAction = React.forwardRef(({className, ...props}, ref) => (
)); CardAction.displayName = "CardAction"; /** * The main content region for card body content. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a `
` with interior spacing optimized for text, forms, charts, or any * other primary card content placed between the header and footer. * * @example * ```tsx * *

Your subscription renews on March 31.

*
* ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const CardContent = React.forwardRef(({className, ...props}, ref) => (
)); CardContent.displayName = "CardContent"; /** * A footer region for actions, summaries, or secondary metadata. * * @remarks * **Rendering Context**: Server- and client-compatible presentational component. * * Renders a flex-enabled `
` that sits at the bottom of the card and is commonly * used for buttons, timestamps, totals, or other closing UI elements. * * @example * ```tsx * * * * ``` * * @see {@link https://base-ui.com/react/overview Base UI documentation} */ const CardFooter = React.forwardRef(({className, ...props}, ref) => (
)); CardFooter.displayName = "CardFooter"; export {Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle};