Card
Static container extracted from the mockup’s .card and .panel. Card supplies the border, padding, and elevation. CardHeader and CardContent supply the layout inside.
Radius is 8px (rounded-lg), not the mockup’s 14px, because the system caps control and surface radii at 8px. The only elevation is shadow-sm: one step above the page.
Interactive Preview
Section titled “Interactive Preview”React Cardlive
Svelte Cardlive
Account overview
Hadir 182, warning 9, info 4.
Solid Cardlive
Account overview
Hadir 182, warning 9, info 4.
import { Card, CardHeader, CardContent } from "@/components/ui/card";
<Card> <CardHeader title="Account overview"> <span className="text-xs text-muted">This month</span> </CardHeader> <CardContent> <p>Hadir 182, warning 9, info 4.</p> </CardContent></Card><script lang="ts"> import Card from "@/components/ui/card.svelte"; import CardHeader from "@/components/ui/card-header.svelte"; import CardContent from "@/components/ui/card-content.svelte";</script>
<Card> <CardHeader title="Account overview"> <span class="text-xs text-muted">This month</span> </CardHeader> <CardContent> <p>Hadir 182, warning 9, info 4.</p> </CardContent></Card>import { Card, CardHeader, CardContent } from "@/components/ui/card";
<Card> <CardHeader title="Account overview"> <span class="text-xs text-muted">This month</span> </CardHeader> <CardContent> <p>Hadir 182, warning 9, info 4.</p> </CardContent></Card>Installation
Section titled “Installation”npx @glaceon/cli add card --framework react # or svelte, solidCard is CSS-only. No Zag machine is needed.
bun add clsx tailwind-mergeThen copy the source for your framework:
import type { HTMLAttributes, ReactNode } from "react"import { cn } from "@/lib/cn"
export interface CardProps extends HTMLAttributes<HTMLDivElement> { /** `surface-2` matches the mockup's `.panel`, `surface` matches its `.card`. */ surface?: "surface" | "surface-2"}
export interface CardHeaderProps extends HTMLAttributes<HTMLDivElement> { /** Renders the mockup's `.card h3` typography. */ title?: string children?: ReactNode}
const cardBase = "grid gap-3 rounded-lg border border-line p-4 shadow-sm"const cardSurfaces: Record<NonNullable<CardProps["surface"]>, string> = { surface: "bg-surface", "surface-2": "bg-surface-2",}
export function Card({ surface = "surface", className, ...props }: CardProps) { return <div {...props} className={cn(cardBase, cardSurfaces[surface], className)} />}
export function CardHeader({ title, className, children, ...props }: CardHeaderProps) { return ( <div {...props} className={cn("flex flex-wrap items-baseline justify-between gap-2", className)} > {title ? <h3 className="text-[15px] font-extrabold text-ink">{title}</h3> : null} {children} </div> )}
export function CardContent({ className, ...props }: HTMLAttributes<HTMLDivElement>) { return <div {...props} className={cn("grid gap-2 text-sm text-muted", className)} />}<script lang="ts"> import type { Snippet } from "svelte" import { cn } from "@/lib/cn"
interface Props { surface?: "surface" | "surface-2" class?: string children?: Snippet [key: string]: unknown }
const { surface = "surface", class: className, children, ...rest }: Props = $props()
const cardBase = "grid gap-3 rounded-lg border border-line p-4 shadow-sm" const cardSurfaces = { surface: "bg-surface", "surface-2": "bg-surface-2" }</script>
<div {...rest} class={cn(cardBase, cardSurfaces[surface], className)}> {@render children?.()}</div><script lang="ts"> import type { Snippet } from "svelte" import { cn } from "@/lib/cn"
interface Props { title?: string class?: string children?: Snippet }
const { title = undefined, class: className, children }: Props = $props()
const headerClass = "flex flex-wrap items-baseline justify-between gap-2"</script>
<div class={cn(headerClass, className)}> {#if title} <h3 class="text-[15px] font-extrabold text-ink">{title}</h3> {/if} {@render children?.()}</div><script lang="ts"> import type { Snippet } from "svelte" import { cn } from "@/lib/cn"
interface Props { class?: string children?: Snippet }
const { class: className, children }: Props = $props()
const contentClass = "grid gap-2 text-sm text-muted"</script>
<div class={cn(contentClass, className)}> {@render children?.()}</div>import { splitProps, Show, type JSX } from "solid-js"import { cn } from "@/lib/cn"
export interface CardProps extends JSX.HTMLAttributes<HTMLDivElement> { /** `surface-2` matches the mockup's `.panel`, `surface` matches its `.card`. */ surface?: "surface" | "surface-2"}
export interface CardHeaderProps extends JSX.HTMLAttributes<HTMLDivElement> { /** Renders the mockup's `.card h3` typography. */ title?: string children?: JSX.Element}
const cardBase = "grid gap-3 rounded-lg border border-line p-4 shadow-sm"const cardSurfaces: Record<NonNullable<CardProps["surface"]>, string> = { surface: "bg-surface", "surface-2": "bg-surface-2",}
export function Card(props: CardProps) { const [local, rest] = splitProps(props, ["surface", "class"]) return <div {...rest} class={cn(cardBase, cardSurfaces[local.surface ?? "surface"], local.class)} />}
export function CardHeader(props: CardHeaderProps) { const [local, rest] = splitProps(props, ["title", "class", "children"]) return ( <div {...rest} class={cn("flex flex-wrap items-baseline justify-between gap-2", local.class)}> <Show when={local.title}> <h3 class="text-[15px] font-extrabold text-ink">{local.title}</h3> </Show> {local.children} </div> )}
export function CardContent(props: JSX.HTMLAttributes<HTMLDivElement>) { const [local, rest] = splitProps(props, ["class"]) return <div {...rest} class={cn("grid gap-2 text-sm text-muted", local.class)} />}Surfaces
Section titled “Surfaces”The mockup ships two containers with the same border and padding, differing only in fill.
| Prop value | Background | Mockup source |
|---|---|---|
surface="surface" |
--surface |
.card |
surface="surface-2" |
--surface-2 |
.panel |
API Reference (Props)
Section titled “API Reference (Props)”Card
| Prop | Type | Default | Description |
|---|---|---|---|
surface |
"surface" | "surface-2" |
"surface" |
Background fill. |
class / className |
string |
undefined |
Extra classes, appended last. |
CardHeader
| Prop | Type | Default | Description |
|---|---|---|---|
title |
string |
undefined |
Renders as an <h3> at the mockup’s .card h3 size. |
class / className |
string |
undefined |
Extra classes, appended last. |
CardContent
| Prop | Type | Default | Description |
|---|---|---|---|
class / className |
string |
undefined |
Extra classes, appended last. |