Skip to Content

Bevel Frame

Picture frame for inside a card: small rounded corners with a thin white outline at low opacity inside the edge in dark mode. Give it a height or aspect ratio; it clips what is inside.

Installation

pnpm dlx shadcn@latest add @01orbital/bevel-frame

Usage

import { BevelFrame } from "@/components/media/bevel-frame"
import {
  Card,
  CardDescription,
  CardHeader,
  CardTitle,
} from "@/components/ui/card"

// The copy: change text here, not in the markup.
const COPY = {
  title: "Layered currents",
  description:
    "A picture well with small corners; in dark mode a hairline sits inside the edge.",
  image: "https://01orbital.dev/art/kit/layered-currents-553717.png",
  imageAlt: "A painting of scattered blue and coral dots",
} as const

// The frame does the clipping; the Card around it only supplies the 8px gutter.
export default function BevelFrameDemo() {
  return (
    <Card className="w-full max-w-sm rounded-lg p-2 pb-6">
      <BevelFrame>
        <img
          src={COPY.image}
          alt={COPY.imageAlt}
          className="h-56 w-full object-cover"
        />
      </BevelFrame>
      <CardHeader className="gap-2">
        <CardTitle>{COPY.title}</CardTitle>
        <CardDescription>{COPY.description}</CardDescription>
      </CardHeader>
    </Card>
  )
}

This example installs with everything it uses:

pnpm dlx shadcn@latest add @01orbital/bevel-frame-demo

API reference

A picture well for inside a card. Clips its content to small rounded corners. In dark mode, a 1px white outline at 10% opacity sits inside the edge.

Give it a height or an aspect ratio. A scene placed with absolute inset-0 adds no height of its own.

It accepts the HTML attributes of the element it renders.

Dependencies

npm: cn. The CLI installs it for you.

Used in blocks

6 blocks are built with Bevel Frame:

Last updated on