Components
- Accordion
- Alert
- Alert Dialog
- Autocomplete
- Avatar
- Badge
- Breadcrumb
- Button
- Card
- Checkbox
- Checkbox Group
- Collapsible
- Combobox
- CommandNew
- Dialog
- Empty
- Field
- Fieldset
- Form
- Frame
- Group
- Input
- Input Group
- Kbd
- Label
- Menu
- Meter
- Number Field
- Pagination
- Popover
- Preview Card
- Progress
- Radio Group
- Scroll Area
- Select
- Separator
- Sheet
- Skeleton
- Slider
- Spinner
- Switch
- Table
- Tabs
- Textarea
- Toast
- Toggle
- Toggle Group
- Toolbar
- Tooltip
Resources
Card
A content container for grouping related information.
Create project
Deploy your new project in one-click.
import { Button } from "@/components/ui/button";
import {
Card,
CardDescription,
CardFooter,
CardHeader,
CardPanel,
CardTitle,
} from "@/components/ui/card";
import { Field, FieldLabel } from "@/components/ui/field";
import { Form } from "@/components/ui/form";
import { Input } from "@/components/ui/input";
import {
Select,
SelectItem,
SelectPopup,
SelectTrigger,
SelectValue,
} from "@/components/ui/select";
const frameworkOptions = [
{ label: "Next.js", value: "next" },
{ label: "Vite", value: "vite" },
{ label: "Remix", value: "remix" },
{ label: "Astro", value: "astro" },
];
export default function Particle() {
return (
<Card className="w-full max-w-xs">
<CardHeader>
<CardTitle>Create project</CardTitle>
<CardDescription>Deploy your new project in one-click.</CardDescription>
</CardHeader>
<Form>
<CardPanel>
<div className="flex flex-col gap-4">
<Field>
<FieldLabel>Name</FieldLabel>
<Input placeholder="Name of your project" type="text" />
</Field>
<Field>
<FieldLabel>Framework</FieldLabel>
<Select defaultValue="next" items={frameworkOptions}>
<SelectTrigger>
<SelectValue />
</SelectTrigger>
<SelectPopup>
{frameworkOptions.map(({ label, value }) => (
<SelectItem key={value} value={value}>
{label}
</SelectItem>
))}
</SelectPopup>
</Select>
</Field>
</div>
</CardPanel>
<CardFooter>
<Button className="w-full" type="submit">
Deploy
</Button>
</CardFooter>
</Form>
</Card>
);
}
Installation
pnpm dlx shadcn@latest add @coss/card
Usage
import {
Card,
CardDescription,
CardFooter,
CardHeader,
CardPanel,
CardTitle,
} from "@/components/ui/card"<Card>
<CardHeader>
<CardTitle>Title</CardTitle>
<CardDescription>Description</CardDescription>
</CardHeader>
<CardPanel>Content</CardPanel>
<CardFooter>Footer</CardFooter>
</Card>API Reference
This is a custom component using Base UI's useRender hook, not a direct Base UI wrapper.
Card
Root container for the card. Supports the render prop.
| Prop | Type | Default | Description |
|---|---|---|---|
render | React.ReactElement | - | Render as a different element |
CardHeader
Header section container. Supports the render prop.
CardTitle
Title text for the card. Supports the render prop.
CardDescription
Description text for the card. Supports the render prop.
CardAction
Container for action buttons in the header. Automatically positions to the right. Supports the render prop.
CardPanel
Main content area of the card. Also exported as CardContent. Supports the render prop.
CardFooter
Footer section for the card. Supports the render prop.