Skip to content

shadcn.io is an independent project built on shadcn/ui

Components

Free

Frame for Radix UI

A tinted shell that groups bordered panels under one header, with a footer below, for settings sections and dashboards. Frame for React on Radix UI.

On this page9 sections

A frame is a tinted shell around one section of a page: a header with a title and a line of description, one or more bordered panels on the page background, and an optional footer under them. Use it for a settings section or a dashboard block that holds more than one surface, such as a plan summary above the payment method.

For one subject with a single body, a Card is the smaller choice. For a list of similar rows, use Item.

Preview width

Installation

Sign in to get your install command
Free with an account. It carries your token, so the CLI installs everything in one go.

Anatomy

Frame anatomy: root, header, title, description, panel, footer

Usage

import {
  Frame, FrameDescription, FrameFooter, FrameHeader, FramePanel,
  FrameTitle,
} from "@/components/ui/frame";

FramePanel is the bordered surface, and the header and footer sit on the shell around it. Add as many panels as the section needs, and each one that follows another gets a small gap above it.

<Frame className="w-full max-w-md">
  <FrameHeader>
    <FrameTitle>Section header</FrameTitle>
    <FrameDescription>Brief description about the section</FrameDescription>
  </FrameHeader>
  <FramePanel>
    <h3 className="font-semibold text-sm">Section title</h3>
    <p className="text-muted-foreground text-sm">Section description</p>
  </FramePanel>
  <FrameFooter>
    <p className="text-muted-foreground text-sm">Footer</p>
  </FrameFooter>
</Frame>

Accessibility

A frame takes no focus and has no keys. Frame renders a section, so the header of FrameHeader and the footer of FrameFooter belong to the frame and never become the page's banner or contentinfo landmarks. The section has no name, so it adds no landmark of its own. FrameTitle renders an h2, which puts the frame in the heading outline. Give it asChild and an h3 child when the frame sits under an h2 of its own.

Demos

Separated panels

Two panels under one header and no footer, each holding a short heading and a line of text. The second panel gets a 4px gap from a rule on Frame that spaces any panel following another, so the stack needs no margins of its own. Use separate panels when one section has two surfaces that shouldn't share a body, like a plan summary and the payment method under it.

Preview width

Billing form

The billing section of a settings page: the invoice email in one panel, the company name and tax ID in a second, and a Save button in FrameFooter. A form wraps the whole Frame, so that one button submits the fields of both panels, and a line beside it confirms the save. Use this layout when one settings section holds more than one group of fields.

Preview width

FAQ

When should I use a Frame instead of a Card?

Use a Frame when one section holds several surfaces: the header and footer sit on a tinted shell, and each FramePanel is a bordered block of its own inside it. A billing section with the plan in one panel and the payment method in another is a typical case.

A Card is one surface with its header, body and footer inside the same border, sized for a single subject like a login form or a pricing plan. When the panels have nothing to do with each other, they are separate subjects, and a grid of cards reads better.

How do I stack several panels in a Frame?

Put the FramePanel parts one after another inside Frame, as the Separated panels demo does. A rule on Frame gives every panel that directly follows another a 4px top margin, so the shell's tint shows between them without margins of your own.

The rule only spaces panel after panel. If you put something else between two panels, give it its own spacing, and keep the header above the first panel and the footer below the last.

Can I set a Frame title without FrameTitle and FrameDescription?

Yes. Pass title and description to FrameHeader as strings, and it renders FrameTitle and FrameDescription for you, in that order. A header whose only child is plain text also renders that text as the title, above a description passed as a prop.

Use the parts themselves when the title needs markup of its own, such as a badge next to the words, or a heading level other than h2.

Is FrameTitle a heading, and how do I change its level?

Yes, it renders an h2, which fits a frame placed right under the page's h1. When the frame sits in a section that has its own h2, give FrameTitle asChild with an h3 inside, and the element takes the title's classes. To change every frame at once, edit the element in components/ui/frame.

The demos title each panel with an h3, one level under the frame's own title, so the outline reads as the section and then its panels.

How do I put a button in the Frame header?

FrameHeader stacks its children in a column, and there is no action part for the corner. Turn it into a row with flex-row items-center justify-between, wrap FrameTitle and FrameDescription in a div, and put the button after that div, so it sits at the end of the header line.

Keep that spot for one small action, such as Edit or View all. Buttons that act on the whole section, like Save, sit better in FrameFooter.

How do I change a Frame's background or corner radius?

Add a class to Frame or FramePanel. The shell is bg-muted/72 with rounded-2xl and p-1, and each panel is bg-background with rounded-xl, a border and a light shadow, so a class like bg-muted on Frame replaces the tint for that one frame.

Change the two radii together: the shell's rounded-2xl is one step above the panels' rounded-xl, with the shell's p-1 padding between them, so each panel's corner curves just inside the shell's. Move both by the same step to keep that, or edit the classes in components/ui/frame to change every frame at once.

API Reference

Frame

<section> data-slot="frame"

PropType
asChild?boolean

Merge props onto the child element instead of rendering a host.

className?string

Merged with the part's classes.

FramePanel

<div> data-slot="frame-panel"

PropType
asChild?boolean

Merge props onto the child element instead of rendering a host.

className?string

Merged with the part's classes.

FrameHeader

<header> data-slot="frame-panel-header"

PropType
description?string

The section's description, rendered as FrameDescription.

title?string

The section's title, rendered as FrameTitle.

asChild?boolean

Merge props onto the child element instead of rendering a host.

className?string

Merged with the part's classes.

FrameTitle

<h2> data-slot="frame-panel-title"

PropType
asChild?boolean

Merge props onto the child element instead of rendering a host.

className?string

Merged with the part's classes.

FrameDescription

<div> data-slot="frame-panel-description"

PropType
asChild?boolean

Merge props onto the child element instead of rendering a host.

className?string

Merged with the part's classes.

FrameFooter

<footer> data-slot="frame-panel-footer"

PropType
asChild?boolean

Merge props onto the child element instead of rendering a host.

className?string

Merged with the part's classes.