# Elements: Layout, structure and containers, further examples

> Plainkit 0.28.0. Generated by scripts/build-skills.mjs from core/dist/elements/api.full.json. Do not edit: change the source and run the generator.

The element sections in `elements-layout.md` show the first example of each element; these are the rest.

## `pk-app-frame`

Example: One module, no search

```html
<pk-app-frame brand="Acme" nav='[{"id":"home","title":"Home","href":"#home","icon":"home"},{"id":"orders","title":"Orders","href":"#orders","badge":3,"children":[{"id":"open","title":"Open","href":"#open"},{"id":"shipped","title":"Shipped","href":"#shipped"}]},{"id":"reports","title":"Reports","href":"#reports"}]' current-id="home"><pk-page-header heading="Home"></pk-page-header></pk-app-frame>
```

## `pk-app-shell`

Example: Contain: the one child fills the body

```html
<pk-app-shell contain><pk-card heading="Fills the body"><p>With contain the single child takes the height of the body with no wrapper, and @container page queries answer to the body width.</p></pk-card></pk-app-shell>
```

Example: Back link

```html
<pk-app-shell back-href="#invoices" back-label="Back to Invoices"><pk-button slot="header" variant="ghost">Edit</pk-button><pk-stack><pk-page-header heading="Invoice 1042"></pk-page-header><p>The page title is the page's own pk-page-header; the back link goes to the list.</p></pk-stack></pk-app-shell>
```

## `pk-canvas`

Example: Millimetre rulers with an adaptive grid

```html
<pk-canvas label="Sign layout" unit="mm" rulers auto-grid pan-x="60" pan-y="48"><pk-card data-surface-selected><h3>Sign</h3><p>Zoom: the grid and the rulers keep their spacing readable.</p></pk-card></pk-canvas>
```

Example: Pan and zoom surface with a grid

```html
<pk-canvas label="Artboard" grid="20"><pk-card data-surface-selected><h3>Page</h3><p>Drag the ground, or use Ctrl and the wheel to zoom.</p></pk-card></pk-canvas>
```

## `pk-card`

Example: Error tone with a footer

```html
<pk-card heading="Sync failed" tone="error">
  <p>The channel rejected the update.</p>
  <pk-button slot="footer" size="mini">Retry</pk-button>
</pk-card>
```

Example: Media, horizontal

```html
<pk-card heading="Widget 1" orientation="horizontal">
  <svg slot="media" viewBox="0 0 4 3" role="img" aria-label="Cover"><rect width="4" height="3" fill="currentColor" opacity="0.15"></rect></svg>
  <p>First printing, near mint.</p>
</pk-card>
```

## `pk-cluster`

Example: Spread to the ends

```html
<pk-cluster justify="between"><span>Left</span><pk-button>Right</pk-button></pk-cluster>
```

Example: Vertical

```html
<pk-cluster direction="vertical" gap="xs" align="start"><pk-badge>First</pk-badge><pk-badge>Second</pk-badge></pk-cluster>
```

## `pk-container`

Example: Scrolling region

```html
<pk-container size="lg" padding="none" scroll="both" label="Example output" fill>
  <pre>function greet(name) {
  return `Hello, ${name}!`;
}

console.log(greet('world'));</pre>
</pk-container>
```

## `pk-cta-band`

Example: Neutral, start aligned

```html
<pk-cta-band>
  <h2 slot="heading">Questions before you buy?</h2>
  <p>Talk to a person on the team.</p>
  <span slot="actions"><pk-button block href="#contact">Contact us</pk-button></span>
</pk-cta-band>
```

## `pk-design-surface`

Example: Hidden and empty nodes on a phone frame

```html
<pk-design-surface label="Phone canvas" width="phone">
  <pk-stack gap="md">
    <pk-text>A visible paragraph.</pk-text>
    <pk-text data-surface-hidden>A hidden paragraph.</pk-text>
    <pk-stack data-surface-empty></pk-stack>
  </pk-stack>
</pk-design-surface>
```

Example: Empty page

```html
<pk-design-surface label="Blank canvas">
  <span slot="empty">Drag an element here.</span>
</pk-design-surface>
```

## `pk-detail-layout`

Example: Sidebar first, two-up once collapsed

```html
<pk-detail-layout sidebar-first sidebar-two-up>
  <p>Main content.</p>
  <pk-card slot="sidebar"><h3>Total</h3><p>$412.00</p></pk-card>
  <pk-card slot="sidebar"><h3>Items</h3><p>3</p></pk-card>
</pk-detail-layout>
```

Example: Record page with phone tabs

```html
<pk-detail-layout>
  <pk-card heading="Details" data-pk-section="details"><p>Name, SKU</p></pk-card>
  <pk-card heading="Pricing" data-pk-section="pricing"><p>Price, cost</p></pk-card>
  <pk-card slot="sidebar" heading="Status" data-pk-section="details"><p>Active</p></pk-card>
  <pk-card slot="sidebar" heading="Channels" data-pk-section="pricing"><p>Web, store</p></pk-card>
</pk-detail-layout>
```

Example: Phone tabs without the Next button

```html
<pk-detail-layout hide-next>
  <pk-card heading="Details" data-pk-section="details"><p>Name, SKU</p></pk-card>
  <pk-card heading="Pricing" data-pk-section="pricing"><p>Price, cost</p></pk-card>
</pk-detail-layout>
```

Example: Tabs from the page header

```html
<pk-page-header heading="Order 1042" tabs='[{"value":"details","label":"Details"},{"value":"pricing","label":"Pricing"}]'></pk-page-header>
<pk-detail-layout hide-tabs section="pricing">
  <pk-card heading="Details" data-pk-section="details"><p>Name, SKU</p></pk-card>
  <pk-card heading="Pricing" data-pk-section="pricing"><p>Price, cost</p></pk-card>
</pk-detail-layout>
```

## `pk-divider`

Example: Plain

```html
<pk-divider></pk-divider>
```

## `pk-doc-page`

Example: Static slotted mode: plain markup, no script (the current item is the one marked aria-current)

```html
<pk-doc-page><pk-side-nav slot="nav" label="Guides"><pk-nav-item href="#a">Getting started</pk-nav-item><pk-nav-item href="#b" current aria-current="page">Theming</pk-nav-item></pk-side-nav><pk-toc slot="aside" for="#static-ex" levels="h2" heading="On this page"></pk-toc><h2>Theming</h2><div class="prose" id="static-ex"><h2 id="tokens">Tokens</h2><p>Shown as written.</p></div></pk-doc-page>
```

Example: Home as cards, with a breadcrumb

```html
<pk-doc-page config='{"level":2,"breadcrumb":true,"home":{"title":"Guides","summary":"Pick a guide.","cards":true},"items":[{"id":"start","title":"Getting started","summary":"Get the files and build a first page."},{"id":"theme","title":"Theming","summary":"Tokens and themes."},{"id":"logs","title":"Logging","summary":"Levels, scopes and routes."}]}'></pk-doc-page>
```

## `pk-dock`

Example: Tab groups and a bottom panel

```html
<pk-dock label="Project workspace">
  <div slot="files" data-heading="Files" data-group="left" class="stack"><span>app.js</span><span>README.md</span></div>
  <div slot="outline" data-heading="Outline" data-group="left" class="stack"><span>run()</span><span>render()</span></div>
  <div slot="editor" data-heading="Editor" class="stack"><span>Choose Files or Outline to switch the left tab.</span></div>
  <div slot="log" data-heading="Log" data-group="bottom" class="stack"><span>Ready.</span></div>
</pk-dock>
```

Example: Declared panels and a centre

```html
<pk-dock label="Declared workspace">
  <div slot="palette" data-heading="Palette" data-group="left" data-open="false">Palette</div>
  <div slot="canvas" data-heading="Canvas" data-group="center">The centre</div>
  <div slot="props" data-heading="Properties" data-group="right" data-closable="false" data-collapsible="false">Always there</div>
  <div slot="notes" data-heading="Notes" data-group="right" data-float>Floats from the start</div>
</pk-dock>
```

Example: Persisted layout

```html
<pk-dock label="Workspace with a saved layout" persist-key="gallery-demo">
  <div slot="tools" data-heading="Toolbox" data-group="left" class="stack"><span>Select</span><span>Rectangle</span></div>
  <div slot="canvas" data-heading="Canvas" class="stack"><span>Resize a separator or move a tab, then reload the page: the arrangement comes back.</span></div>
  <div slot="props" data-heading="Properties" data-group="right" class="stack"><span>Width 120</span><span>Height 80</span></div>
</pk-dock>
```

## `pk-grid`

Example: Uneven tracks

```html
<pk-grid tracks="minmax(0, 1.5fr) minmax(0, 1fr)"><pk-card heading="Main">1.5 parts</pk-card><pk-card heading="Side">1 part</pk-card></pk-grid>
```

Example: Auto columns

```html
<pk-grid min="10rem"><pk-card heading="One">A</pk-card><pk-card heading="Two">B</pk-card><pk-card heading="Three">C</pk-card><pk-card heading="Four">D</pk-card></pk-grid>
```

Example: A 2:1 split

```html
<pk-grid ratio="2:1"><pk-card heading="Main">Wide</pk-card><pk-card heading="Side">Narrow</pk-card></pk-grid>
```

Example: At most three columns

```html
<pk-grid columns="3" min="8rem" gap="lg"><pk-card heading="A">1</pk-card><pk-card heading="B">2</pk-card><pk-card heading="C">3</pk-card><pk-card heading="D">4</pk-card></pk-grid>
```

Example: A sticky section nav beside a long article

```html
<pk-grid ratio="1:3" sticky-first><pk-card heading="On this page"><pk-text>Overview</pk-text><pk-text>Details</pk-text></pk-card><pk-card heading="Article"><pk-text>A long article scrolls past the nav, which stays in view.</pk-text></pk-card></pk-grid>
```

## `pk-heading`

Example: Level and look decoupled

```html
<pk-heading level="1">Page title</pk-heading><pk-heading level="2" variant="h4">A quiet section heading</pk-heading><pk-heading level="3" variant="h1">A section that must look bigger than its outline level</pk-heading>
```

Example: Tone and weight

```html
<pk-heading level="2" tone="muted" weight="medium">Archived</pk-heading>
```

Example: Truncated

```html
<pk-heading level="3" truncate>A very long record title that will not fit in a narrow card header</pk-heading>
```

## `pk-list`

Example: Ordered

```html
<pk-list ordered label="Setup steps"><span>Create an account.</span><span>Verify the email address.</span><span>Add a payment method.</span></pk-list>
```

Example: Checklist marker

```html
<pk-list marker="check" label="Included"><span>Free returns within 30 days.</span><span>Two-day shipping.</span><span>24/7 support.</span></pk-list>
```

Example: Dense, no marker

```html
<pk-list marker="none" dense label="Tags"><span>Backend</span><span>Billing</span><span>Urgent</span></pk-list>
```

## `pk-master-detail-page`

Example: Things and their record (set config, load and mountDetail from script: an inline script cannot run under this site's CSP, so wire it the way pk-list-page's load is wired)

```html
<pk-master-detail-page id="things" record-id="2"></pk-master-detail-page>
```

## `pk-not-found-page`

Example: Custom text with a Go home action

```html
<pk-not-found-page heading="We can't find that page" description="It may have moved or you may not have access." label="Go home"></pk-not-found-page>
```

## `pk-page-header`

Example: Sticky only from a width up

```html
<pk-page-header heading="Phone and up" level="2" sticky sticky-from="phone"></pk-page-header>
<pk-page-header heading="Tablet and up" level="2" sticky sticky-from="tablet"></pk-page-header>
```

Example: Page: crumbs, title and actions

```html
<pk-page-header heading="PO 1042" level="2">
  <pk-breadcrumb slot="breadcrumb">
    <a href="#">Stock</a>
    <a href="#">Purchase orders</a>
    <span aria-current="page">PO 1042</span>
  </pk-breadcrumb>
  <pk-button slot="actions" icon-name="import" collapse="phone">Receive</pk-button>
  <pk-button slot="actions" variant="ghost" icon-name="document" collapse="phone">Print</pk-button>
</pk-page-header>
```

Example: Crumbs from data, home crumb and back link

```html
<pk-page-header heading="PO 1042" level="2" back-link home-href="#" crumbs='[{"label":"Stock","href":"#"},{"label":"Purchase orders","href":"#"},{"label":"PO 1042"}]'>
  <pk-button slot="actions" icon-name="import" collapse="phone">Receive</pk-button>
</pk-page-header>
```

Example: Section: title, action and note

```html
<pk-page-header variant="section" heading="Stock movements">
  <pk-button slot="actions" size="mini" variant="ghost" icon-name="refresh" collapse="phone">Refresh</pk-button>
  <span slot="meta">Latest 50 · in 40 / out 28</span>
</pk-page-header>
```

Example: Actions in an overflow menu

```html
<pk-page-header variant="record" actions-overflow="phone">
  <pk-badge>Open</pk-badge>
  <span>Acme Supply</span>
  <pk-button slot="actions" size="mini" icon-name="import">Receive</pk-button>
  <pk-button slot="actions" size="mini" variant="ghost" icon-name="document">Print</pk-button>
  <pk-button slot="actions" size="mini" variant="ghost" disabled>Archive</pk-button>
</pk-page-header>
```

Example: Record: home crumb, chips, actions and docked tabs

```html
<pk-page-header variant="record" sticky>
  <pk-breadcrumb slot="breadcrumb">
    <a href="#" aria-label="Dashboard"><pk-icon name="dashboard"></pk-icon></a>
    <a href="#">Products</a>
    <span aria-current="page" role="heading" aria-level="1">Blue mug</span>
  </pk-breadcrumb>
  <pk-badge variant="ok">Active</pk-badge>
  <pk-badge variant="muted">On hand 1</pk-badge>
  <pk-button slot="actions" size="mini" icon-name="save" collapse="phone">Save</pk-button>
  <pk-tabs slot="tabs">
    <pk-tab value="details">Details</pk-tab>
    <pk-tab value="history">History</pk-tab>
  </pk-tabs>
</pk-page-header>
```

Example: Record: a long title wrapped on a phone (wrap-title)

```html
<pk-page-header variant="record" wrap-title home-href="#" home-label="Home" crumbs='[{"label":"Purchase orders","href":"#"},{"label":"Purchase order 1042 for the north warehouse refit, the second delivery of shelving, racking, lighting and spare fittings"}]'>
  <pk-badge>Open</pk-badge>
  <pk-badge variant="ok">Paid in full</pk-badge>
  <pk-button slot="actions" variant="primary" size="mini">Receive goods</pk-button>
</pk-page-header>
```

Example: Record: a long title cut to one line

```html
<pk-page-header variant="record" home-href="#" home-label="Home" crumbs='[{"label":"Purchase orders","href":"#"},{"label":"Purchase order 1042 for the north warehouse refit, the second delivery of shelving, racking, lighting and spare fittings"}]'>
  <pk-badge>Open</pk-badge>
  <pk-badge variant="ok">Paid in full</pk-badge>
  <pk-badge variant="warn">Late</pk-badge>
  <pk-button slot="actions" variant="primary" size="mini">Receive goods</pk-button>
</pk-page-header>
```

Example: Record: status chips and actions

```html
<pk-page-header variant="record">
  <pk-badge>Open</pk-badge>
  <span>Acme Supply</span>
  <pk-button slot="actions" size="mini" variant="ghost" icon-name="document" collapse="phone">Print</pk-button>
  <pk-button slot="actions" size="mini" icon-name="import" collapse="phone">Receive</pk-button>
</pk-page-header>
```

Example: Spacious: opt back into the multi-row breakdown

```html
<pk-page-header spacious>
  <pk-breadcrumb slot="breadcrumb">
    <a href="#">Products</a>
    <span aria-current="page" role="heading" aria-level="1">A very long product name that would crowd the actions off a single row</span>
  </pk-breadcrumb>
  <pk-badge variant="ok">Active</pk-badge>
  <pk-badge variant="muted">On hand 1</pk-badge>
  <pk-badge variant="warn">Backordered</pk-badge>
  <pk-button slot="actions" size="mini" variant="ghost" icon-name="document" collapse="phone">Print</pk-button>
  <pk-button slot="actions" size="mini" icon-name="save" collapse="phone">Save</pk-button>
  <span slot="meta">Updated moments ago</span>
</pk-page-header>
```

## `pk-page-shell`

Example: A whole-page error state

```html
<pk-page-shell heading="Orders" state="error" state-heading="Could not load orders" state-description="The request failed.">
  <pk-card heading="Orders">Hidden while the error shows.</pk-card>
</pk-page-shell>
```

## `pk-record-page`

Example: Sections around the fields (main-before, main-after, side-after)

```html
<pk-record-page id="product-sections" config='{"heading":"Product","title":"Trailhead jacket","fields":[{"key":"name","label":"Name","required":true},{"key":"sku","label":"SKU"},{"key":"status","label":"Status","kind":"select","options":["Draft","Active","Retired"]},{"key":"notes","label":"Notes","kind":"textarea"}],"values":{"name":"Trailhead jacket","sku":"TJ-204","status":"Active","notes":"Waterproof shell."},"sidebar":[{"heading":"Publishing","fields":["status"]}]}'><pk-card slot="main-after" heading="Activity">Created by the import on 3 March.</pk-card><pk-card slot="side-after" heading="Related">Two open orders.</pk-card></pk-record-page>
```

## `pk-sortable`

Example: Horizontal, accepting an external drop

```html
<pk-sortable label="Pinned tags" orientation="horizontal" accept-external>
  <pk-sortable-item value="urgent">Urgent</pk-sortable-item>
  <pk-sortable-item value="review">Needs review</pk-sortable-item>
</pk-sortable>
```

## `pk-splitter`

Example: Stacked

```html
<pk-splitter orientation="vertical" size="60" label="Resize the console"><div slot="start">Editor</div><div slot="end">Console</div></pk-splitter>
```

## `pk-stack`

Example: With dividers

```html
<pk-stack gap="sm" dividers><div>Profile</div><div>Billing</div><div>Notifications</div></pk-stack>
```

## `pk-states-page`

Example: Error, with Retry

```html
<pk-states-page state="error" heading="Could not load orders" description="The request timed out."></pk-states-page>
```

Example: Empty

```html
<pk-states-page state="empty" heading="No orders yet" description="Orders appear here once a customer checks out."></pk-states-page>
```

## `pk-text`

Example: Inline runs

```html
<pk-text>Status: <pk-text inline weight="semibold" tone="positive">Paid</pk-text>, due <pk-text inline tone="muted">14 June</pk-text>.</pk-text>
```

Example: Lead text under a heading

```html
<h2>Billing</h2><pk-text variant="lead">Invoices, payment methods and the billing contact.</pk-text>
```

Example: Variants

```html
<pk-text variant="eyebrow">Revenue</pk-text><pk-text variant="h3" font="mono">$48,210.00</pk-text><pk-text size="meta" tone="muted">Up 12% on last month</pk-text>
```

Example: Truncated

```html
<pk-text truncate>A very long file name that will not fit in a narrow column - quarterly-report-final-v3-reviewed.pdf</pk-text>
```

Example: Keeps line breaks

```html
<pk-text white-space="pre-wrap">Line one
Line two, kept.</pk-text>
```

Example: Inline code

```html
<pk-text>Run <code>npm install</code> and set <code>PORT=4000</code> before starting the server.</pk-text>
```

## `pk-toolbar`

Example: Title only

```html
<pk-toolbar heading="Recent activity"></pk-toolbar>
```

## `pk-workspace`

Example: A wide nav pane

```html
<pk-workspace nav-width="lg" nav-label="Tables">
  <pk-tree slot="nav" label="Tables"><pk-tree-item label="quarterly_revenue_by_region_and_product_line"></pk-tree-item><pk-tree-item label="customers"></pk-tree-item></pk-tree>
  <div class="stack"><h2>Tables</h2><p>nav-width takes sm, md, lg, xl or a CSS length. A tree label that is still too long is cut with an ellipsis and shows its full text as a tooltip.</p></div>
</pk-workspace>
```

Example: With a docked aside

```html
<pk-workspace aside-open nav-label="Files" aside-label="Outline">
  <div slot="nav" class="stack"><a href="#app">app.js</a><a href="#readme">README.md</a></div>
  <div class="stack"><h2>app.js</h2><p>The aside is a docked column on a wide screen, floats over the main pane on a tablet and is its own pane on a phone.</p></div>
  <div slot="aside" class="stack"><h3>Outline</h3><p>run()</p></div>
</pk-workspace>
```
