RadCN
Displayreadycomponentready

Card

A flexible content surface with header, title, description, action, content, and footer slots.

Importimport { Card, CardContent, CardHeader, CardTitle } from 'radcn/card'
Preview

Live package example

Render the upstream login/account Card and project form Card with named slots, native forms, package inputs, package buttons, and package Select composition.

Demo and Form

Render the upstream login/account Card and project form Card with named slots, native forms, package inputs, package buttons, and package Select composition.

Preview
Login to your account
Enter your email below to login to your account
Create project
Deploy your new project in one-click.
import { Button } from 'radcn/button'
import { Card, CardAction, CardContent, CardDescription, CardFooter, CardHeader, CardTitle } from 'radcn/card'
import { Input } from 'radcn/input'
import { Label } from 'radcn/label'
import { Select, SelectContent, SelectItem, SelectPortal, SelectTrigger, SelectValue, SelectViewport } from 'radcn/select'

export function CardExamples() {
  return (
    <>
      <Card style="width:min(100%,24rem);">
        <CardHeader>
          <CardTitle>Login to your account</CardTitle>
          <CardDescription>Enter your email below to login to your account</CardDescription>
          <CardAction><Button href="/signup" variant="link">Sign Up</Button></CardAction>
        </CardHeader>
        <form action="/login" method="post">
          <CardContent>
            <Label for="email">Email</Label>
            <Input id="email" name="email" required type="email" placeholder="m@example.com" />
            <Label for="password">Password</Label>
            <Input id="password" name="password" required type="password" />
          </CardContent>
          <CardFooter>
            <Button type="submit" style="width:100%;">Login</Button>
            <Button variant="outline" style="width:100%;">Login with Google</Button>
          </CardFooter>
        </form>
      </Card>

      <Card style="width:min(100%,350px);">
        <CardHeader>
          <CardTitle>Create project</CardTitle>
          <CardDescription>Deploy your new project in one-click.</CardDescription>
        </CardHeader>
        <form action="/projects" method="post">
          <CardContent>
            <Label for="project-name">Name</Label>
            <Input id="project-name" name="project" placeholder="Name of your project" />
            <Label for="framework">Framework</Label>
            <Select defaultOpen id="framework" name="framework">
              <SelectTrigger><SelectValue placeholder="Select" /></SelectTrigger>
              <SelectPortal>
                <SelectContent position="popper">
                  <SelectViewport>
                    <SelectItem value="next">Next.js</SelectItem>
                    <SelectItem value="sveltekit">SvelteKit</SelectItem>
                    <SelectItem value="astro">Astro</SelectItem>
                    <SelectItem value="nuxt">Nuxt.js</SelectItem>
                  </SelectViewport>
                </SelectContent>
              </SelectPortal>
            </Select>
          </CardContent>
          <CardFooter style="justify-content:space-between;">
            <Button variant="outline">Cancel</Button>
            <Button type="submit">Deploy</Button>
          </CardFooter>
        </form>
      </Card>
    </>
  )
}

Installation

Intended future install command. RadCN is private and not published to npm yet, so this snippet documents the target user-facing API rather than something external consumers can run today.

pnpm add radcn # intended future package
import { Card, CardContent, CardHeader, CardTitle } from 'radcn/card'

Theming

RadCN tokens read the resolved theme from the document. Store the user's preference separately, then resolve system preferences to a concrete light or dark theme before setting package tokens.

<html data-radcn-theme-mode="system" data-radcn-theme="dark">
  ...
</html>

Accessibility

  • Card preserves native semantics for the content placed inside it: forms remain forms, labels remain labels, inputs keep their type and required state, and links remain links.
  • CardTitle and CardDescription provide visible structure while apps decide heading levels around the card surface.
  • CardAction is a layout slot; the composed Button or anchor keeps its own accessible role and name.

Customization

  • Card root, header, title, description, action, content, and footer expose data-radcn-card* hooks.
  • className maps to class, and width utilities such as w-full, max-w-sm, and w-[350px] map to class, style, CSS variables, or app CSS.
  • data-slot maps to data-radcn-card* hooks; cn and Tailwind utilities map to RadCN package classes, CSS variables, and app CSS.
  • CardAction, Button variant="link", Button variant="outline", Input type="email", Input type="password", and Select position="popper" compose existing RadCN primitives.

Remix 3 Notes

  • Card owns the surface and slots, not app form state, login behavior, project creation behavior, or Select overlay state.
  • Native form semantics remain app-owned unless a route chooses to compose RadCN Form helpers.
  • Form, Chart, and Carousel Card references are separate resolved clusters; block Card references stay block parity work.
  • The switch registry dependency in card-demo.json is treated as stale metadata because the current card-demo source does not render Switch.
  • vendor source remains read-only evidence and is not imported by RadCN.