COMPONENT · 04NEW

Frame

A box with registration marks on its four corners, for anything from a card to a whole page section. An optional header holds a back button, any title content and a three-dot menu, and can fold the content into itself.

  • @ui-sdk/react
  • lucide-react

Example

A whole page section. Press the title to fold it into the header; Back and the menu work without folding it.

Last action: Nothing yet

Press the title, or focus it and press Enter or Space, to fold the content. Back and the menu sit beside the title, so pressing them never folds it.

FrameHeader is optional and takes any children. Put FrameBack first for a back button, FrameTitle in the middle (it fills the free space and truncates long text), and FrameMenu last for a three-dot menu of FrameMenuItem, FrameMenuSeparator and FrameSubmenu. height sets its minimum height and defaults to the frame's size. The title is Text's overline; size on FrameTitle takes any Text size (default "xs").

Collapsing

Add collapsible to let the user fold the content into the header by pressing the title. It starts open; use defaultOpen={false} to start closed, or open with onOpenChange to control it. Without collapsible, the title is plain text and the content always shows.

Items
3 items
Total
$84.00

Sizes

size="sm" fits cards and list items, "lg" page sections: it scales the corner marks, the content padding and the header height. A frame without a header is just the box.

No header: just the box and its corners.

Taller header, larger title

Without collapsible, the title is plain text.

Colors

color takes any intent color of the theme. "primary", the default, is the plain card with primary corners; every other color ("warning", "error", "info", "success", "secondary", "muted") colors the corners and lays a light wash of itself over the background and borders. Use "warning" for things that need attention and "error" for failures or destructive sections.

Primary

The default: card background, primary corners.

3 products have fewer than 5 units left.

Order 4190 was declined by the card issuer.

Installation

npx shadcn@latest add https://lanzate-ui.vercel.app/r/frame.json

Usage

import {
  Frame,
  FrameBack,
  FrameContent,
  FrameHeader,
  FrameMenu,
  FrameMenuItem,
  FrameTitle,
} from "@/components/ui/frame"

<Frame size="lg" collapsible>
  <FrameHeader>
    <FrameBack onClick={goBack} />
    <FrameTitle>Orders</FrameTitle>
    <FrameMenu label="Order actions" onAction={run}>
      <FrameMenuItem value="edit">Edit</FrameMenuItem>
    </FrameMenu>
  </FrameHeader>
  <FrameContent>…</FrameContent>
</Frame>

API

PropTypeDefaultDescription
Frame size"sm" | "md" | "lg""md"Scales the corner marks, the content padding and the default header height: sm for cards, lg for page sections.
Frame color"primary" | "error" | "warning" | "info" | "success" | "secondary" | "muted""primary"Color of the corner marks. Every color but primary also tints the background and borders.
Frame collapsiblebooleanfalseMakes FrameTitle a button that shows and hides FrameContent.
Frame openbooleanWhether the content is shown, when controlled. Pair it with onOpenChange.
Frame defaultOpenbooleantrueWhether the content is shown at first, when uncontrolled.
Frame onOpenChange(open: boolean, details) => voidRuns when the user shows or hides the content.
FrameHeader height"sm" | "md" | "lg"the frame's sizeHeight of the header. Back and menu buttons scale with it and keep the same gap on every side. Its children are free content.
FrameTitle childrenReactNodeTitle content: text, icons, badges. Fills the space between back and menu, and truncates.
FrameTitle size"2xs" | "xs" | "sm" | "md" | "lg" | "xl" | "2xl" | "display" | "inherit""xs"Text size of the title, from Text's scale. Pair a large size with a taller FrameHeader height.
FrameBack labelstring"Back"Accessible name of the back button. It is the registry Button (square, ghost), so it takes onClick, tooltip, color and the rest of its props.
FrameMenu labelstringAccessible name of the three-dot button. Required: screen readers and agents find the menu by it.
FrameMenu onAction(value: string) => voidRuns for every item in the menu and its submenus, with the item's value.
FrameMenuItem iconReactNodeDecorative icon before the item text. Also on FrameSubmenuTrigger.
FrameContent classNamestringClasses for the padded box around the content.