Outline cards
Five cards that keep a calm body and put all of the character in the frame: an offset ring, a dashed edge, a double frame, a thick border and corner brackets. Each frame is drawn from tokens, so it follows your theme in light and dark.
Installation
The styled layer is free and installs like any other ai2 component.
Run the following command
npx shadcn@latest add @ai2/card-outlineDependencies, the @ai2/tokens theme and the component file are installed together.
Copy the source
components/ui/card-outline.tsx"use client"
import type * as React from "react"
import { cn } from "@/lib/utils"
/* Outline card family: 5 cards where the border leads. The body stays calm and the whole difference lives in the frame (ring, dashed, double line, thick, corner brackets). Colour comes ONLY from semantic tokens, transparency through color-mix. size = the padding plus radius scale (the same as card-styled). */
export type StyledSize = "sm" | "md" | "lg" | "xl"
const radii: Record<StyledSize, string> = {
sm: "rounded-lg",
md: "rounded-xl",
lg: "rounded-2xl",
xl: "rounded-2xl",
}
const pads: Record<StyledSize, string> = {
sm: "p-4",
md: "p-5",
lg: "p-6",
xl: "p-8",
}
type Props = React.ComponentProps<"div"> & { size?: StyledSize }
const shell = "relative w-64 bg-card text-card-foreground"
const defaultBody = (
<div className="flex flex-col gap-1">
<span className="text-sm font-semibold text-foreground">Card title</span>
<span className="text-xs leading-relaxed text-muted-foreground">
A short description that shows how content sits inside the card.
</span>
</div>
)
/* Ring: ince kenarlik + disinda primary halka ve offset bosluk. */
export function RingCard({ className, size = "md", children, ...props }: Props) {
return (
<div
data-slot="styled-card"
className={cn(
shell,
"border border-border ring-2 ring-primary/40 ring-offset-2 ring-offset-background",
radii[size],
pads[size],
className
)}
{...props}
>
{children ?? defaultBody}
</div>
)
}
/* Dashed: a dashed border plus a light token surface. For empty or placeholder areas. */
export function DashedCard({ className, size = "md", children, ...props }: Props) {
return (
<div
data-slot="styled-card"
className={cn(
shell,
"border-2 border-dashed border-[color-mix(in_oklab,var(--color-foreground)_22%,transparent)] bg-surface-2/40",
radii[size],
pads[size],
className
)}
{...props}
>
{children ?? defaultBody}
</div>
)
}
/* Double: an inner border plus an outer line. The double-frame effect is built with outline, so the layout does not shift. */
export function DoubleCard({ className, size = "md", children, ...props }: Props) {
return (
<div
data-slot="styled-card"
className={cn(
shell,
"border border-border outline outline-1 outline-offset-[3px] outline-[color-mix(in_oklab,var(--color-foreground)_18%,transparent)]",
radii[size],
pads[size],
className
)}
{...props}
>
{children ?? defaultBody}
</div>
)
}
/* Thick: a thick, high-contrast border. The card reads like a block. */
export function ThickCard({ className, size = "md", children, ...props }: Props) {
return (
<div
data-slot="styled-card"
className={cn(
shell,
"border-4 border-[color-mix(in_oklab,var(--color-foreground)_30%,transparent)]",
radii[size],
pads[size],
className
)}
{...props}
>
{children ?? defaultBody}
</div>
)
}
/* Corner: no border, only token brackets at the four corners. A technical/HUD
look. */
export function CornerCard({ className, size = "md", children, ...props }: Props) {
const bracket =
"pointer-events-none absolute size-4 border-primary"
return (
<div
data-slot="styled-card"
className={cn(shell, "border border-transparent", radii[size], pads[size], className)}
{...props}
>
<span aria-hidden="true" className={cn(bracket, "left-0 top-0 border-l-2 border-t-2")} />
<span aria-hidden="true" className={cn(bracket, "right-0 top-0 border-r-2 border-t-2")} />
<span aria-hidden="true" className={cn(bracket, "bottom-0 left-0 border-b-2 border-l-2")} />
<span aria-hidden="true" className={cn(bracket, "bottom-0 right-0 border-b-2 border-r-2")} />
{children ?? defaultBody}
</div>
)
}Manual installs skip the @ai2/tokens theme, so add the token CSS from the theming guide or the tone colors will be missing.
Variations
5 takes on the same idea. Each is its own export, and every one accepts a size prop (sm, md, lg, xl) aligned to the base Button scale.
Ring
A thin border with an offset primary ring around it.
import { RingCard } from "@/components/ui/card-outline"
<RingCard />Dashed
A dashed border for empty or placeholder regions.
import { DashedCard } from "@/components/ui/card-outline"
<DashedCard />Double
An inner border plus an offset outline for a double frame.
import { DoubleCard } from "@/components/ui/card-outline"
<DoubleCard />Thick
A heavy, high-contrast border that reads as a block.
import { ThickCard } from "@/components/ui/card-outline"
<ThickCard />Corner
No border at all, just four token corner brackets.
import { CornerCard } from "@/components/ui/card-outline"
<CornerCard />ai2 Outline cards: 5 styled variations on the token system
The ai2 Outline cards are a set of 5 decorative button variations from the styled layer of the @ai2 design system, built around border-forward card frames on a calm body. They are free and MIT licensed, and every color comes from a semantic token, so they theme with the rest of ai2 in light and dark.
Motion runs on framer-motion: the frames are static, so no animation runs by default. The styled layer is opt-in, so the dependency only lands if you use it; the base components stay lean. Under reduced motion, the cards look and behave exactly the same.
What is in the ai2 Outline cards?
5 exports in one file: Ring, Dashed, Double, Thick and Corner. Each renders a native button and takes a size prop (sm, md, lg, xl) aligned to the base Button. They are separate from the base Button on purpose: the base keeps its clean variant, tone and size axes, while the styled layer carries the effects.
You own the file. Copy the one category file and you have all 5 variations, with no runtime dependency on ai2 itself.
Why use it
- On-system by construction: Every color resolves to an ai2 semantic token, so the buttons follow your theme in light and dark with no extra work.
- Effect without the sprawl: The decorations live in a dedicated styled file, so the base Button keeps its clean, predictable API.
- Accessible and honest: Each renders a real button element, keeps a visible focus ring, and respects prefers-reduced-motion.
Features
- Token-driven color: No hardcoded hex or oklch; the look recolors with your theme tokens.
- framer-motion: the frames are static, so no animation runs by default.
- Reduced-motion aware: Under prefers-reduced-motion, the cards look and behave exactly the same.
- Size aligned to the base: Every variation takes sm, md, lg and xl matching the base Button height scale, so styled and base buttons line up in a row.
Production tips
- Use it for emphasis, not everywhere: Styled buttons draw the eye. Reserve them for the one action you want people to take on a screen, and use the base Button for the rest.
- Keep labels as verbs: The decoration adds weight, so a clear action label keeps the button scannable.
- Pick one variation per surface: The variations share a family; using two different ones in the same view competes for attention.
Works with the rest of ai2
The Outline cards sit alongside the base Button and the rest of the @ai2 registry. They share the same token file, so a styled action next to a base button or a badge stays visually consistent in both modes.