Card

A group box on the grouped card surface with the platform’s card corner.

content

Apple: Boxes

· Base UI: element

Storage

iPhone Storage

52.4 GB of 128 GB used

x
import { Button } from "@applecn/ui/components/button"
import {
  Card,
  CardContent,
  CardDescription,
  CardFooter,
  CardHeader,
  CardTitle,
} from "@applecn/ui/components/card"
import { Progress } from "@applecn/ui/components/progress"

export default function CardBasic() {
  return (
    <div className="rounded-4xl bg-grouped-background-1 p-4">
      <Card className="max-w-sm">
        <CardHeader>
          <CardTitle>iPhone Storage</CardTitle>
          <CardDescription>52.4 GB of 128 GB used</CardDescription>
        </CardHeader>
        <CardContent>
          <Progress value={41} aria-label="Storage used" />
        </CardContent>
        <CardFooter>
          <Button size="small" variant="tinted">
            Manage Storage
          </Button>
        </CardFooter>
      </Card>
    </div>
  )
}

Install

From the registry this site publishes, with dependencies resolved by the CLI.

npx shadcn@latest add https://applecn.vercel.app/r/card.json

Source

packages/ui/src/components/card.tsx

import { cn } from "cn"
import type { ComponentProps } from "react"

/** A group box: content on the grouped card surface with the platform's card corner (26 pt on iOS 26, 10 on macOS, 17 on the web). */
function Card({ className, ...props }: ComponentProps<"div">) {
  return (
    <div
      data-slot="card"
      className={cn(
        "flex flex-col gap-3 rounded-card bg-card p-4 text-label",
        className
      )}
      {...props}
    />
  )
}

function CardHeader({ className, ...props }: ComponentProps<"div">) {
  return (
    <div
      data-slot="card-header"
      className={cn("flex flex-col gap-0.5", className)}
      {...props}
    />
  )
}

function CardTitle({ className, ...props }: ComponentProps<"h3">) {
  return (
    <h3
      data-slot="card-title"
      className={cn("type-headline text-label", className)}
      {...props}
    />
  )
}

function CardDescription({ className, ...props }: ComponentProps<"p">) {
  return (
    <p
      data-slot="card-description"
      className={cn("type-footnote text-label-2", className)}
      {...props}
    />
  )
}

function CardContent({ className, ...props }: ComponentProps<"div">) {
  return (
    <div
      data-slot="card-content"
      className={cn("type-body", className)}
      {...props}
    />
  )
}

function CardFooter({ className, ...props }: ComponentProps<"div">) {
  return (
    <div
      data-slot="card-footer"
      className={cn("flex items-center gap-2", className)}
      {...props}
    />
  )
}

export { Card, CardContent, CardDescription, CardFooter, CardHeader, CardTitle }