Card
Card with thoughtful defaults, semantic styling, and editable source.
Make it yours.
Install the editable source and its dependencies into your React + Tailwind project.
Scroll horizontally for long lines
pnpm dlx shadcn@4.0.8 add http://localhost:3000/r/card.jsonUse it
Scroll horizontally for long lines
"use client";
import {useState} from 'react';
import {Card} from '@/components/jez-ui/ui/card';
import {Badge} from '@/components/jez-ui/ui/badge';
import {Button} from '@/components/jez-ui/ui/button';
export default function Example(){
const [notice,setNotice]=useState('');
return <><Card className="w-full max-w-sm overflow-hidden p-0"><div className="flex h-40 items-end justify-between bg-accent p-6 text-foreground"><span className="text-5xl font-medium tracking-tight">Field<br/>notes.</span><span className="text-3xl">↗</span></div><div className="p-6"><div className="flex items-center justify-between"><h3 className="text-xl">An idea taking shape</h3><Badge tone="positive">Active</Badge></div><p className="mt-3 text-sm leading-relaxed text-muted-foreground">A shared space for the discoveries, sketches, and small details that make the work better.</p><div className="mt-6 flex items-center justify-between border-t border-border pt-4"><span className="text-xs text-muted-foreground">Updated a moment ago</span><Button size="sm" variant="ghost" onClick={()=>setNotice('Project opened.')}>Open project ↗</Button></div></div></Card><p role="status">{notice}</p></>;
}Props & types
Scroll horizontally for long lines
React.HTMLAttributes<HTMLDivElement>Source
View 2 source files
registry/ui/card.tsx
Scroll horizontally for long lines
"use client";
import * as React from "react";
import { cn } from "./utils";
export function Card({
className,
...props
}: React.HTMLAttributes<HTMLDivElement>) {
return (
<div
className={cn(
"rounded-xl border border-border bg-background p-6",
className,
)}
{...props}
/>
);
}
registry/ui/utils.ts
Scroll horizontally for long lines
import { clsx, type ClassValue } from "clsx";
import { twMerge } from "tailwind-merge";
export function cn(...values: ClassValue[]) {
return twMerge(clsx(values));
}
Dependencies
clsx@2.1.1 · tailwind-merge@3.5.0
Accessibility & behaviour
Provide meaningful labels and preserve keyboard focus styles. Check contrast when customising theme colours.
Read the accessibility and performance guide →