Layout
Card
A quiet container. Header, content, and footer included.
FOUNDATION / LAYOUT
Card
Your next project
A little room for your next idea. Composable from the first line.
Interactive preview. Real components.View docs
Use it in your project
Install oscl-ui from npm and import oscl-ui/styles.css once. See installation.
card-example.tsx
import { Card, CardHeader, CardContent } from "oscl-ui";
<Card>
<CardHeader>Your workspace</CardHeader>
<CardContent>A little room for your next idea.</CardContent>
</Card>Accessibility
Keep visible labels and keyboard focus. Supply an accessible name to icon-only actions. Try this preview with Tab, Enter, Space, and Escape where appropriate.
The source, in full
This is the actual source from the isolated OSCL package used by this website. Native props and TypeScript declarations are included in the npm package.
card.tsx
"use client";
import { forwardRef } from "react";
import type { HTMLAttributes } from "react";
export const Card = forwardRef<HTMLDivElement, HTMLAttributes<HTMLDivElement>>(function Card({ className = "", ...props }, ref) {
return <div {...props} ref={ref} className={`oscl-card ${className}`} />;
});
export function CardHeader({ className = "", ...props }: HTMLAttributes<HTMLDivElement>) {
return <div {...props} className={`oscl-card-header ${className}`} />;
}
export function CardContent({ className = "", ...props }: HTMLAttributes<HTMLDivElement>) {
return <div {...props} className={`oscl-card-content ${className}`} />;
}
export function CardFooter({ className = "", ...props }: HTMLAttributes<HTMLDivElement>) {
return <div {...props} className={`oscl-card-footer ${className}`} />;
}