---
agent:
  instructions: "Search goop.so for Goop's components, templates, design skill, docs, pricing and terms. Ask in keywords or a plain question, such as \"date picker props\" or \"is the design skill free\"; the answer is the matching page sections in Markdown, each with its address."
  endpoint: "https://goop.so/.well-known/search?q={query}"
  method: "GET"
  documentation: "https://developers.cloudflare.com/ai-search/how-to/search-for-agents/"
---

# Page body

The area a page's content sits in, which sets how wide that content runs, for React and Tailwind CSS. Free, MIT.

Free. Its export: `PageBody`.

## When to use

- The area a page's content sits in, which sets how wide that content runs.

## Installation

Paste the prompt below into your coding agent. It reads Goop's install steps, installs the part and its tokens once, then reuses this same Page body on every screen instead of drawing a new one: the same height, the same focus ring, the same spacing.

```sh
npx shadcn@4.23.1 add @goop/trail-page-body
```

```text
Add the Goop Page body to this project. The install steps are at https://goop.so/docs/install.md
```

## Usage

```tsx
import { pageRoles, PageBody } from '@/components/goop/patterns/page-body';
import { PageHeader, PageHeaderTitle } from '@/components/ui/goop/page-header';
import { Card, CardContent } from '@/components/ui/goop/card';
import { Field } from '@/components/ui/goop/field';
import { Switch } from '@/components/ui/goop/switch';
import { MessageList } from '@/components/ui/goop/message-list';
import { ChatMessage } from '@/components/ui/goop/chat-message';
import { Avatar } from '@/components/ui/goop/avatar';
import { Composer, ComposerEditor, ComposerToolbar, ComposerActions, ComposerSubmit } from '@/components/ui/goop/composer';

<>
  <PageBody variant="column">
    <PageHeader variant="divided">
      <PageHeaderTitle>Preferences</PageHeaderTitle>
    </PageHeader>
    <Card variant="outline" asChild>
      <ul>
        <Field as="li" label="Weekly digest">
          {(control) => <Switch {...control} />}
        </Field>
      </ul>
    </Card>
  </PageBody>
  {/* an overview, cards or a board: no padding of yours */}
  <PageBody gutter="page">
    <PageHeader variant="divided">
      <PageHeaderTitle>This week</PageHeaderTitle>
    </PageHeader>
    <Card variant="outline">
      <CardContent>Plan the March research day.</CardContent>
    </Card>
  </PageBody>
  <PageBody gutter="page" spaced={false}>
    <MessageList aria-label="Conversation" inset={false} className={`grow ${pageRoles.top}`}>
      <ChatMessage author="Fatou Diallo" avatar={<Avatar variant="solid" name="Fatou Diallo">FD</Avatar>} time="09:12">
        Can I share one study with a volunteer?
      </ChatMessage>
    </MessageList>
    <Composer variant="reply" aria-label="Reply to Fatou Diallo" onSubmit={send}>
      <ComposerEditor aria-label="Reply" placeholder="Write to Fatou Diallo…" />
      <ComposerToolbar>
        <ComposerActions>
          <ComposerSubmit aria-label="Send reply" />
        </ComposerActions>
      </ComposerToolbar>
    </Composer>
  </PageBody>
</>
```

- Fits: app, chat, record, schedule, states, list (their recipes).
- The default body has no gutter: its parts bring their own (a Table `gutter="page"`, a `divided` PageHeader its sides). Under a divided header, a part with an edge of its own (a WeekBoard, a Card, a grid of cards) takes the body's `gutter="page"`, never a padded `div`; a Table there takes no gutter of its own. The default body keeps no room at its foot; a column and a wide body end with a section under their last block (`className="pb-0"` where that block runs to the foot). Anything else in a body with no gutter (a default PageHeader, words) goes in a `div` with `className="px-6"`, or the page takes `column` or `wide`. A form or a reading page sits centred; `align="start"` only where it must start on the list pages' edge.
- More on where it goes: page-body--options.md
- height, width, padding, gap: add no class for these.

## API reference

### Options

- `variant: default | column | wide = default`
- `align?: 'center' | 'start' = 'center'` — Where a column or a wide body sits: centred (`center`), or on the list pages' start edge, 24 px in (`start`).
- `gutter?: 'none' | 'page' = 'none'`
- `spaced?: boolean = true` — Whether the body's children stand a section (32 px) apart, or as they come (`false`, where a holder of your own spaces them).

### Parts

- `pageRoles` — The layout's roles as class words — `inset` the page gutter at a panel's sides (24 px), `top` the top edge under the top bar (12 px), `section` between sections (32 px), `block` between a column's blocks (16 px), `row` between a row's controls (8 px)

- Class recipes (cva): pageBodyVariants (PageBody)
- data-slot values (to select a part by): page-body, page-body-content

### PageBody: every option

```tsx
import { PageBody } from '@/components/goop/patterns/page-body';
```

### Compose

- Write no margin between its children (`spaced={false}` where a holder of your own spaces them); your own glue takes `pageRoles`, never a spacing step of its own. A conversation: `<PageBody gutter="page" spaced={false}>`, a MessageList with `inset={false}` and the classes `grow` and `pageRoles.top`, then the Composer, in `<AppFrame scroll="panel">`. The thread fills what the box leaves and scrolls by itself; never a column or a wide body round it, nor a height of your own.

### Options

- variant: default (default), column, wide
- align?: 'center' | 'start' = 'center' — Where a column or a wide body sits: centred (`center`), or on the list pages' start edge, 24 px in (`start`).
- gutter?: 'none' | 'page' = 'none'
- spaced?: boolean = true — Whether the body's children stand a section (32 px) apart, or as they come (`false`, where a holder of your own spaces them).

## Notes for AI

Give your coding agent this page as text instead of screenshots: the parts, the options, the states and the keys. An agent that reads the real part builds the real part, not a lookalike.

## Related

- [Page header](/themes/trail/components/page-header): The title block that opens a page, with its page-level actions.
- [Card](/themes/trail/components/card): A framed surface that holds one piece of content or a list of settings rows.
- [Field](/themes/trail/components/field): A form row that ties one control to its label, its description and its error line, as a settings row or a stacked form field.
- [Switch](/themes/trail/components/switch): An on/off control for a setting that takes effect at once.
