Install with your agent
npx shadcn@4.23.1 add @goop/trail-page-bodyPage body
FreeThe area a page's content sits in, which sets how wide that content runs, for React and Tailwind CSS. Free, MIT.
What an agent sees
- pageRolesThe layout's roles as class words —
insetthe page gutter at a panel's sides (24 px),topthe top edge under the top bar (12 px),sectionbetween sections (32 px),blockbetween a column's blocks (16 px),rowbetween a row's controls (8 px)
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>
</>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.
Terminal
npx shadcn@4.23.1 add @goop/trail-page-bodyPROMPT
Add the Goop Page body to this project. The install steps are at https://goop.so/docs/install.mdUsage
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", adividedPageHeader 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'sgutter="page", never a paddeddiv; 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 adivwithclassName="px-6", or the page takescolumnorwide. 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
| Option | Type | What it does |
|---|---|---|
| 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). |
| Part | What it is |
|---|---|
| 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 takespageRoles, never a spacing step of its own. A conversation:<PageBody gutter="page" spaced={false}>, a MessageList withinset={false}and the classesgrowandpageRoles.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.
goop.so/themes/trail/components/page-body.md · the page as Markdown