Unified UI

Card

A versatile container for grouping related content and actions with slot-based composition.

Basic

A versatile container for grouping related content and actions.

Card Title

Card subtitle text

This is the main content area of the card. It can contain any content you need.

Installation

Install the component via the CLI in one command.

npx @work-rjkashyap/unified-ui add card
pnpm dlx @work-rjkashyap/unified-ui add card
npx @work-rjkashyap/unified-ui add card
bunx @work-rjkashyap/unified-ui add card

If you haven't initialized your project yet, run npx @work-rjkashyap/unified-ui init first. See the CLI docs for details.

Or install the full package

Use this approach if you prefer to install the entire design system as a dependency instead of copying individual components.

npm install @work-rjkashyap/unified-ui
pnpm add @work-rjkashyap/unified-ui
yarn add @work-rjkashyap/unified-ui
bun add @work-rjkashyap/unified-ui

Anatomy

import {
	Card,
	CardHeader,
	CardBody,
	CardFooter,
	Button,
	Badge,
} from "@work-rjkashyap/unified-ui";

Variants

Default

The standard card with a subtle background and border.

Default Card

Subtle background with a standard border. Blends into the page naturally.

Outlined

Transparent background with a stronger border. Use when the card sits on a colored or complex background.

Outlined Card

Transparent background with a stronger border for contrast.

Elevated

Raised card with shadow to draw attention or lift content above the page surface.

Elevated Card

Uses shadow to create depth and visual prominence.

Interactive

Clickable card with hover lift animation, focus ring, and cursor pointer. Ideal for navigation cards.

All Variants Side by Side

default

Standard card

outlined

Stronger border

elevated

With shadow

interactive

Hover me!

Slot Composition

Cards use a slot-based pattern with CardHeader, CardBody, and CardFooter sub-components. Each slot automatically inherits the card's padding setting via React context.

Full Composition

Project Settings

Manage your project configuration

Update your project name, description, and visibility settings. Changes are saved automatically.

Body Only

A simple card with only a body slot. No header or footer needed.

Without Borders on Slots

No Border Header

The header and footer borders can be removed independently.

Padding

The padding prop controls the internal spacing of all slot sub-components. Padding is applied to the slots, not the card root, which allows edge-to-edge images or content.

Compact (p-4)

Default padding for dense UIs and smaller cards.

Comfortable (p-6)

More generous padding for prominent content cards.

The CardFooter supports horizontal alignment of its content via the align prop.

align="end" (default)

align="between"

Step 2 of 4

align="start"

Full Width

This card stretches to fill its container width using the fullWidth prop.

Polymorphic Rendering

The Card root accepts an as prop for polymorphic rendering. This is especially useful with the interactive variant.

{
	/* As a link */
}
<Card variant="interactive" as="a" href="/project/123">
	<CardBody>Click to view project</CardBody>
</Card>;

{
	/* As a Next.js Link */
}
import Link from "next/link";

<Card variant="interactive" as={Link} href="/project/123">
	<CardBody>Navigate to project</CardBody>
</Card>;

{
	/* As a button */
}
<Card variant="interactive" as="button" onClick={handleClick}>
	<CardBody>Clickable card</CardBody>
</Card>;

Props

Card

PropTypeDefaultDescription
variant"default" | "outlined" | "elevated" | "interactive""default"Visual variant of the card.
padding"compact" | "comfortable""compact"Padding scale for slot sub-components.
fullWidthbooleanfalseWhether the card stretches to fill its container.
asElementType"div"The HTML element or component to render as.
classNamestringAdditional CSS classes.

CardHeader

PropTypeDefaultDescription
borderedbooleantrueWhether to show a bottom border separator.
classNamestringAdditional CSS classes.

CardBody

PropTypeDefaultDescription
classNamestringAdditional CSS classes.

CardFooter

PropTypeDefaultDescription
borderedbooleantrueWhether to show a top border separator.
align"start" | "center" | "end" | "between""end"Horizontal alignment of footer content.
classNamestringAdditional CSS classes.

Accessibility

  • Interactive variant includes a visible focus ring for keyboard navigation.
  • When used as a link (as="a"), the card supports standard link semantics.
  • Content within cards should maintain proper heading hierarchy — don't skip from h2 to h4.
  • The interactive variant removes text decoration for anchor usage.

On this page