---
title: Frame for Astro
description: Frame components for a subtle raised surface.
sidebar:
    label: Frame
    badge: new
seo:
    title: Frame Component for Astro
    description: Add a frame around components to create a subtle raised surface.
related:
    - /components/card
    - /components/section
---

`FramePanel` adds a subtle raised surface to a single element. `Frame` groups several panels (and optional header or footer) inside one muted shell.

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

<Frame class="w-full max-w-md">
  <FrameHeader>
    <FrameTitle>Section header</FrameTitle>
    <FrameDescription>
      Files and notes for the next content review
    </FrameDescription>
  </FrameHeader>
  <FramePanel>
    <h2 class="text-sm font-semibold">Section title</h2>
    <p class="text-muted-foreground text-sm">Section description</p>
  </FramePanel>
  <FrameFooter>
    <p class="text-muted-foreground text-sm">Footer</p>
  </FrameFooter>
</Frame>
```

## Installation

### Command

```sh
bunx --bun shadcn@latest add @gnostic/frame
```

### Manual

Complete the [Installation guide](/docs/installation) first. Then copy the component files below.

No extra packages are required.

#### src/components/ui/frame/frame-description.astro

```astro
---
/**
 * Supporting text under a frame title.
 */
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"

type Props = HTMLAttributes<"div">

const { class: className, ...props } = Astro.props
---

<div
  data-slot="frame-panel-description"
  class={cn("text-muted-foreground text-sm", className)}
  {...props}
>
  <slot />
</div>
```

#### src/components/ui/frame/frame-footer.astro

```astro
---
/**
 * Footer band for actions or secondary text.
 */
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"

type Props = HTMLAttributes<"footer">

const { class: className, ...props } = Astro.props
---

<footer
  data-slot="frame-panel-footer"
  class={cn("px-5 py-4", className)}
  {...props}
>
  <slot />
</footer>
```

#### src/components/ui/frame/frame-header.astro

```astro
---
/**
 * Header band for a frame title and description.
 */
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"

type Props = HTMLAttributes<"header">

const { class: className, ...props } = Astro.props
---

<header
  data-slot="frame-panel-header"
  class={cn("flex flex-col px-5 py-4", className)}
  {...props}
>
  <slot />
</header>
```

#### src/components/ui/frame/frame-panel.astro

```astro
---
/**
 * Raised surface inside a frame. Stacked panels keep a small gap.
 */
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"

type Props = HTMLAttributes<"div">

const { class: className, ...props } = Astro.props
---

<div
  data-slot="frame-panel"
  class={cn(
    "relative rounded-xl border bg-background bg-clip-padding p-5 shadow-xs/5 before:pointer-events-none before:absolute before:inset-0 before:rounded-[calc(var(--radius-xl)-1px)] before:shadow-[0_1px_--theme(--color-black/4%)] dark:before:shadow-[0_-1px_--theme(--color-white/6%)]",
    className,
  )}
  {...props}
>
  <slot />
</div>
```

#### src/components/ui/frame/frame-title.astro

```astro
---
/**
 * Title text for a frame header.
 */
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"

type Props = HTMLAttributes<"div">

const { class: className, ...props } = Astro.props
---

<div
  data-slot="frame-panel-title"
  class={cn("text-sm font-semibold", className)}
  {...props}
>
  <slot />
</div>
```

#### src/components/ui/frame/frame.astro

```astro
---
/**
 * Muted shell that groups a header, panels, and a footer.
 * Panel spacing follows the Coss UI frame styles.
 */
import type { HTMLAttributes } from "astro/types"

import { cn } from "cn"

type Props = HTMLAttributes<"div">

const { class: className, ...props } = Astro.props
---

<div
  data-slot="frame"
  class={cn(
    "relative flex flex-col rounded-2xl bg-muted/72 p-1",
    "*:[[data-slot=frame-panel]+[data-slot=frame-panel]]:mt-1",
    className,
  )}
  {...props}
>
  <slot />
</div>
```

#### src/components/ui/frame/index.ts

```ts
export { default as Frame } from './frame.astro'
export { default as FrameDescription } from './frame-description.astro'
export { default as FrameFooter } from './frame-footer.astro'
export { default as FrameHeader } from './frame-header.astro'
export { default as FramePanel } from './frame-panel.astro'
export { default as FrameTitle } from './frame-title.astro'
```

Component classes use the preset configured during project setup. Select the same preset in the docs before copying Manual source. To change installed component classes, edit or reinstall their source. See [Theming](/docs/theming) for details.


## Usage

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

<Frame>
  <FrameHeader>
    <FrameTitle>Title</FrameTitle>
    <FrameDescription>Description</FrameDescription>
  </FrameHeader>
  <FramePanel>Content</FramePanel>
  <FrameFooter>Footer</FrameFooter>
</Frame>
```

## Composition

```text
Frame
├── FrameHeader
│   ├── FrameTitle
│   └── FrameDescription
├── FramePanel
└── FrameFooter
```

## Examples

### Framed icon

Use `FramePanel` around an icon to make it stand out.

```astro
---
import { Image } from "astro:assets"
import {
  Frame,
  FrameHeader,
  FrameTitle,
  FrameFooter,
  FrameDescription,
  FramePanel,
} from "@/components/ui/frame"
import FlameIcon from "@lucide/astro/icons/flame"

import winterLandscape from "@/assets/images/winter-landscape-orion.png"
import { Button } from "@/components/ui/button"
---

<Frame class="grid grid-cols-2 @max-sm:grid-cols-1 gap-2">
  <Image
    src={winterLandscape}
    alt="Winter landscape"
    fit="cover"
    layout="constrained"
    class="size-full rounded-[calc(var(--radius-2xl)-1px)] @sm:rounded-e-none"
  />
  <div class="flex flex-col">
    <FrameHeader class="grid grid-cols-3">
      <div class="col-span-2">
        <FrameTitle>Winter is Coming</FrameTitle>
        <FrameDescription>
          Prepare for solitude in the frozen landscape.
        </FrameDescription>
      </div>
      <div class="col-span-1 justify-self-end-safe">
        <FlameIcon class="text-muted-foreground/64 size-5" />
      </div>
    </FrameHeader>
    <FramePanel>
      <p class="text-sm">
        An alien world awaits your arrival. What was once uninhabitable is now
        home. You are the first of your species to arrive on this planet. Make
        the most of it.
      </p>
      <div class="flex justify-end mt-auto">
        <Button variant="ghost">Explore the world</Button>
      </div>
    </FramePanel>
  </div>
</Frame>
```

See the [card examples](/ui/components/card) for `CardFrame`, which clips a card into a framed shell.

## When to use Frame

Use `FramePanel` alone when one raised surface is enough, as in the framed icon example. Use `Frame` when multiple panels should sit together in one outer surface.

## Keyboard and behavior

Frame supplies layout, not selection or disclosure behavior. Use semantic headings and actual buttons inside the parts. The page still owns heading levels and landmarks.

## Theme and layout

With `Frame`, the outer muted shell and inner panels share border and radius tokens. A lone `FramePanel` uses the panel tokens only. Check panel edges and spacing when content includes a table or a card with its own border. Avoid stacking unnecessary surfaces.
