25
Componentregistry:component

Masked Collage Frame

Image cut-outs as an arch, oval, torn paper or museum frame, with a tilt and an overlay slot for layering a modern UI card on top of a classical picture.

Installation

$ npx shadcn@latest add @creative-ui/collage-frame

On an older shadcn CLI, use the URL: npx shadcn@latest add https://ui.krutikraut.com/r/collage-frame.json

Preview

Pre-Raphaelite painting of a woman in robes
Lot 17

Pre-Raphaelite school

Oil painting · 19th century

Est.€ 42.0M
Shape
Tilt-2°

Usage

Example.tsx
import { CollageFrame, CollageFrameOverlay } from "@/components/collage-frame"

export function Feature() {
  return (
    <CollageFrame
      src="https://images.unsplash.com/photo-1576773689115-5cd2b0223523?w=900&q=80&auto=format&fit=crop"
      alt="Pre-Raphaelite painting"
      shape="arch"
      tilt={-3}
      className="aspect-[3/4] w-72"
    >
      <CollageFrameOverlay position="bottom-right" tilt={3}>
        <div className="rounded-xl bg-background p-4 shadow-lg">
          <p className="text-sm font-medium">+24% this quarter</p>
        </div>
      </CollageFrameOverlay>
    </CollageFrame>
  )
}

Props

2 components

<CollageFrame />

PropTypeDefaultDescription
src*string—Image URL.
altstring""Accessible description. Leave empty for decorative images.
shape"arch" | "oval" | "torn" | "museum" | "plain""arch"Cut-out shape.
tiltnumber0Rotation in degrees, for a pasted-down collage feel.
shadowbooleantrueSoft drop shadow under the cut-out.
roughnessnumber0.5Torn edge roughness, 0 to 1. torn only.
seednumber7Seed for the torn edge, so two frames can differ. torn only.
paperColorstring"#f4efe6"Paper colour that shows along a torn edge. torn only.
frameColorstring"#2a2420"Frame colour (dark walnut). Try #b08d4a for gilt. museum only.
matColorstring"#f3efe7"Mat colour. museum only.
frameWidthnumber18Frame thickness in px. museum only.
matWidthnumber24Mat thickness in px. museum only.
fit"cover" | "contain""cover"How the image fills the cut-out.
imageClassNamestring—Class names for the img element.
childrenReact.ReactNode—Overlay content, usually one or more CollageFrameOverlay elements.

Also accepts every div prop, which is spread onto the root element.

<CollageFrameOverlay />

Positions a card or any UI element on top of a CollageFrame.
PropTypeDefaultDescription
position"top-left" | "top-right" | "bottom-left" | "bottom-right" | "bottom" | "center""bottom-left"Where the overlay sits on the frame.
hangnumber24How far the overlay hangs past the frame edge, in px. Use 0 to keep it inside.
tiltnumber0Counter-rotation in degrees. Pass the negative of the frame's tilt to keep the UI level.

Also accepts every div prop, which is spread onto the root element.

Notes

  • Give the frame a size with className: a width plus a height or aspect ratio.
  • The torn edge uses CSS masks and the museum frame uses color-mix(), which need a current evergreen browser.
  • No client JavaScript, so it is safe in React Server Components.

Dependencies

shadcn/utils