# Elements: Data display, media and code, 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-data-display.md` show the first example of each element; these are the rest.

## `pk-avatar`

Example: No name or image

```html
<pk-avatar colour="muted"></pk-avatar>
<pk-avatar colour="muted" size="lg" shape="square"></pk-avatar>
```

## `pk-badge`

Example: Status dots

```html
<pk-badge dot variant="ok">Online</pk-badge>
<pk-badge dot variant="warn">Syncing</pk-badge>
```

## `pk-chart`

Example: Donut and stack

```html
<pk-chart kind="donut" caption="Channels">
  <table><thead><tr><th>Channel</th><th>Orders</th></tr></thead>
  <tbody><tr><th scope="row">Web</th><td>52</td></tr><tr><th scope="row">Market</th><td>31</td></tr></tbody></table>
</pk-chart>
```

## `pk-code-view`

Example: Highlighted lines

```html
<pk-code-view label="order.js" highlight="2-3">function total(items) {
    const sum = items.reduce((a, i) => a + i.qty, 0);
    return sum;
}</pk-code-view>
```

Example: A slice starting at line 120, height capped

```html
<pk-code-view label="log.txt" start="120" max-height="6rem">one
two
three
four
five
six</pk-code-view>
```

Example: Long lines scroll sideways

```html
<pk-code-view label="long.txt">const message = 'This line is longer than the box, so it scrolls sideways and the numbers stay put.';
short</pk-code-view>
```

## `pk-data-table`

Example: Preset search (from a link) and no Select all offer

```html
<pk-data-table selectable select-page-only columns='[{"key":"sku","label":"SKU"}]' search="acme" no-results='{"heading":"Nothing matches acme"}'></pk-data-table>
```

Example: Page size, add button, labels and empty states (set load from script)

```html
<pk-data-table selectable columns='[{"key":"sku","label":"SKU"},{"key":"name","label":"Name"}]' page-size="10" add-label="+ Add product" search-label="Find a product" label="Products" empty='{"heading":"No products yet"}' no-results='{"heading":"No product matches"}'></pk-data-table>
```

## `pk-field-list`

Example: Stacked, dense

```html
<pk-field-list layout="stacked" dense>
  <dt>Cost</dt><dd>$2.10</dd>
</pk-field-list>
```

Example: Data-driven items

```html
<pk-field-list heading="Order" items='[{"label":"Order","value":"A-1042"},{"label":"PO","value":""},{"label":"Tracking","value":"1Z999","href":"#"}]'></pk-field-list>
```

Example: Data-driven items, show-empty

```html
<pk-field-list heading="Order" show-empty items='[{"label":"Order","value":"A-1042"},{"label":"PO","value":""},{"label":"Tracking","value":"1Z999","href":"#"}]'></pk-field-list>
```

## `pk-frame`

Example: Full width

```html
<pk-frame title="Wide preview" preset="full" html='<!doctype html><body>A full-width sandboxed document</body>'></pk-frame>
```

## `pk-gallery`

Example: Two controls only

```html
<pk-gallery control="button,badge"></pk-gallery>
```

Example: The full gallery at a fixed height

```html
<pk-gallery chrome="full" height="560"></pk-gallery>
```

## `pk-heat-map`

Example: One dominant item

```html
<pk-heat-map label="One dominant item" items='[{"id":"a","label":"Platform","value":520,"severity":"danger"},{"id":"b","label":"Web","value":160},{"id":"c","label":"Mobile","value":120,"severity":"warning"},{"id":"d","label":"Docs","value":80,"severity":"success"}]'></pk-heat-map>
```

Example: Boxes as links

```html
<pk-heat-map label="Boxes as links" items='[{"id":"a","label":"Open","value":24,"severity":"warning","href":"#open"},{"id":"b","label":"Blocked","value":9,"severity":"danger","href":"#blocked"},{"id":"c","label":"Done","value":31,"severity":"success","href":"#done"}]'></pk-heat-map>
```

Example: Data table instead of the map

```html
<pk-heat-map label="Issues by area" show-table items='[{"id":"billing","label":"Billing","value":42,"severity":"warning"},{"id":"auth","label":"Sign-in","value":31,"severity":"danger"},{"id":"search","label":"Search","value":24},{"id":"reports","label":"Reports","value":18,"severity":"info"}]'></pk-heat-map>
```

Example: From a table

```html
<pk-heat-map label="Issues by area"><table><thead><tr><th>Area</th><th>Count</th><th>Severity</th></tr></thead><tbody><tr><td><a href="#billing">Billing</a></td><td>42</td><td>warning</td></tr><tr><td>Sign-in</td><td>31</td><td>danger</td></tr><tr><td>Search</td><td>24</td><td></td></tr><tr><td>Docs</td><td>12</td><td>success</td></tr></tbody></table></pk-heat-map>
```

Example: Rows layout, stable order

```html
<pk-heat-map label="Queues" layout="rows" value-format="compact" items='[{"id":"a","label":"Inbox","value":1200,"severity":"warning"},{"id":"b","label":"Review","value":800},{"id":"c","label":"Blocked","value":300,"severity":"danger"},{"id":"d","label":"Done","value":2100,"severity":"success"}]'></pk-heat-map>
```

Example: Intensity scale

```html
<pk-heat-map label="Errors per service" scale="intensity" max-items="5" items='[{"id":0,"label":"Auth","value":40,"intensity":0.9},{"id":1,"label":"Billing","value":30,"intensity":0.55},{"id":2,"label":"Search","value":24,"intensity":0.3},{"id":3,"label":"Reports","value":18,"intensity":0.15},{"id":4,"label":"Docs","value":10,"intensity":0.05},{"id":5,"label":"API","value":8,"intensity":0.7},{"id":6,"label":"Admin","value":4,"intensity":0.2}]'></pk-heat-map>
```

Example: Grouped by team

```html
<pk-heat-map label="Issues by team and area" group-by items='[{"id":"pay","label":"Payments","children":[{"id":"p1","label":"Invoices","value":30,"severity":"warning"},{"id":"p2","label":"Refunds","value":10},{"id":"p3","label":"Tax","value":20,"severity":"danger"}]},{"id":"acc","label":"Accounts","children":[{"id":"a1","label":"Sign-in","value":40,"severity":"danger"},{"id":"a2","label":"Profile","value":20}]},{"id":"web","label":"Web","children":[{"id":"w1","label":"Search","value":24},{"id":"w2","label":"Docs","value":12,"severity":"success"}]}]'></pk-heat-map>
```

## `pk-icon`

Example: Size steps

```html
<pk-icon name="search" size="sm"></pk-icon> <pk-icon name="search"></pk-icon> <pk-icon name="search" size="lg"></pk-icon> <pk-icon name="search" size="xl"></pk-icon>
```

## `pk-image-gallery`

Example: Read-only, two fixed columns

```html
<pk-image-gallery columns="2" primary="1" images='[{"src":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAmklEQVR42gXBIQ4AIAgAQB/GD/yBP6DQ2Cw2N4uNzUJjs9iINqLP8i4BvUxR6CJ5pTPIFukmScAvcxS+yF75DLbFulkStJdblHaxeW1nNFtNd5ME/eUepV/sXvsZ3VbX3SXBfHlGmRen13nGtDV1T0kgL0sUuShe5QyxJbpFEujLGkUvqlc9Q22pbpUE9rJFsYvm1c4wW6bb5AMXIGmBJ4HH0wAAAABJRU5ErkJggg==","alt":"Front view"},{"src":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAiklEQVR42gXBEQIAMAgAwD0xSZLJZJJM4jiO4ziOe9bu1giMwhiMwwRMwhRMw2rBVmzDduzATuzCblwlVEplVE4VVElVVE0rZafutJ2+M3bmztrZe4Wc0BN2wk/EiTxRJ/osl+t63a779bie1+t632XCpmzG5mzBlmzF1rxUnupTe+pP42k+raf9PlY/aGHmDWEHAAAAAElFTkSuQmCC","alt":"Back view"},{"src":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAm0lEQVR42gXBkRIAIAwA0H1iFmZhNky6ZJiFWXeTolEWRaP9T+9BcUxuNyfdneHudG85FWdQPJPfzUv3Z/g7/VtexRuUwBR2C9LDGeHO8FZQCQYlMsXdovR4RrwzvhVVokFJTGm3JD2dke5MbyWVZFCQCXdD6XgG3olvoQoalMyUd8vS8xn5zvxWVskGpTLV3ar0eka9s75VVap9GM1xYYXoGKsAAAAASUVORK5CYII=","alt":"Detail"}]'></pk-image-gallery>
```

Example: Editable without the add tile: make primary, remove and reorder, the host supplies its own add control (a real Blazor InputFile, say) elsewhere

```html
<pk-image-gallery editable hide-add images='[{"src":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAmklEQVR42gXBIQ4AIAgAQB/GD/yBP6DQ2Cw2N4uNzUJjs9iINqLP8i4BvUxR6CJ5pTPIFukmScAvcxS+yF75DLbFulkStJdblHaxeW1nNFtNd5ME/eUepV/sXvsZ3VbX3SXBfHlGmRen13nGtDV1T0kgL0sUuShe5QyxJbpFEujLGkUvqlc9Q22pbpUE9rJFsYvm1c4wW6bb5AMXIGmBJ4HH0wAAAABJRU5ErkJggg==","alt":"Front view","primary":true},{"src":"data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAAAgAAAAICAIAAABLbSncAAAAiklEQVR42gXBEQIAMAgAwD0xSZLJZJJM4jiO4ziOe9bu1giMwhiMwwRMwhRMw2rBVmzDduzATuzCblwlVEplVE4VVElVVE0rZafutJ2+M3bmztrZe4Wc0BN2wk/EiTxRJ/osl+t63a779bie1+t632XCpmzG5mzBlmzF1rxUnupTe+pP42k+raf9PlY/aGHmDWEHAAAAAElFTkSuQmCC","alt":"Back view","status":"Staged"}]'></pk-image-gallery>
```

## `pk-list-group`

Example: Dense results with an indent

```html
<pk-list-group variant="action" dense label="Outline">
  <button type="button">function render</button>
  <button type="button" data-depth="1">const rows</button>
  <button type="button" data-depth="2">const cells</button>
</pk-list-group>
```

Example: Checklist

```html
<pk-list-group checklist label="Receiving">
  <label><input type="checkbox"> Count boxes</label>
  <label><input type="checkbox" checked> Check slip</label>
</pk-list-group>
```

## `pk-local-time`

Example: Relative and another locale

```html
<p>Updated <pk-local-time datetime="2026-01-01T00:00:00Z" format="relative"></pk-local-time></p>
<p><pk-local-time datetime="2026-09-19T14:30:00Z" locale="de-DE" time-zone="Europe/Berlin"></pk-local-time></p>
```

## `pk-log`

Example: Empty, with its own text

```html
<pk-log label="Server log">Waiting for the first line.</pk-log>
```

## `pk-quote`

Example: Large, with a source

```html
<pk-quote size="large" cite="https://example.com/review/42">
  <blockquote><p>The simplest setup we have shipped.</p></blockquote>
  <span slot="name">Sam Lee</span>
  <span slot="role">Head of Product</span>
</pk-quote>
```

## `pk-specimen`

Example: Radius, shadow and layer

```html
<pk-specimen token="--radius-md"></pk-specimen>
<pk-specimen token="--shadow-card"></pk-specimen>
<pk-specimen token="--z-sticky">Sticky header</pk-specimen>
```

## `pk-stat`

Example: Change and trend

```html
<pk-stat label="Sales, September" value="$18,420" delta="12.5" versus="last month" values='[12,15,14,17,18]'></pk-stat>
<pk-stat label="Return rate" value="2.1%" delta="-0.4" invert></pk-stat>
```

Example: Change in points

```html
<pk-stat label="Quality score" value="87" delta="4" delta-unit="points" versus="last run"></pk-stat>
```

Example: Dashboard tile as a button

```html
<pk-stat tile interactive label="Open orders" value="12"></pk-stat>
```

## `pk-swatch`

Example: A literal colour

```html
<pk-swatch value="#4e93e3" compare="#ffffff"></pk-swatch>
<pk-swatch value="#ffe08a" compare="#1e1e1e" large></pk-swatch>
```

## `pk-table`

Example: Raw table with compact columns

```html
<pk-table label="Lines"><table><thead><tr><th>Name</th><th width="sm">Amount</th><th width="fit"><span class="u-sr-only">Actions</span></th></tr></thead><tbody><tr><td>Bracket</td><td>4.00</td><td><pk-button size="mini" variant="ghost">Remove</pk-button></td></tr></tbody></table></pk-table>
```

Example: Header help and action

```html
<pk-table label="Stock" columns='[{"key":"sku","label":"SKU","sortable":true},{"key":"qty","label":"Qty","type":"number"}]'
  rows='[{"id":1,"sku":"AC-001","qty":12},{"id":2,"sku":"AC-002","qty":0}]'>
  <pk-button slot="header-sku" size="mini" variant="ghost" icon-name="info" aria-label="About SKU"></pk-button>
  <pk-button slot="header-qty" size="mini" variant="ghost" icon-name="filter" aria-label="Filter quantity"></pk-button>
</pk-table>
```

Example: Totals footer

```html
<pk-table label="Invoice lines" cards columns='[{"key":"item","label":"Item"},{"key":"qty","label":"Qty","type":"number"},{"key":"total","label":"Total","type":"number"}]'
  rows='[{"id":1,"item":"Bracket","qty":4,"total":"40.00"},{"id":2,"item":"Hinge","qty":6,"total":"27.00"}]'>
  <span slot="foot">Total 67.00 for 10 items</span>
</pk-table>
```

Example: Card title column

```html
<pk-table label="Products" cards columns='[{"key":"name","label":"Product","title":true},{"key":"sku","label":"SKU"},{"key":"qty","label":"Qty","type":"number"}]'
  rows='[{"id":1,"name":"Cordless drill with two batteries and a carrying case","sku":"AC-1000","qty":12},{"id":2,"name":"Claw hammer","sku":"AC-1001","qty":40}]'></pk-table>
```

Example: Row links

```html
<pk-table label="Orders" row-href-template="#order-{id}" columns='[{"key":"po","label":"PO"},{"key":"customer","label":"Customer"}]'
  rows='[{"id":"A-1","po":"PO 1001","customer":"Acme"},{"id":"B-2","po":"PO 1002","customer":"Globex"}]'></pk-table>
```

Example: Date-time column on one line

```html
<pk-table label="Activity" columns='[{"key":"event","label":"Event"},{"key":"when","label":"When","noWrap":true}]'
  rows='[{"id":1,"event":"Invoice paid","when":"Aug 29, 2026, 3:51 PM"}]'></pk-table>
```

Example: Sortable, selectable table

```html
<pk-table id="t1" label="Products" caption="Stock by product" striped hover selectable
  columns='[{"key":"sku","label":"SKU","sortable":true},{"key":"price","label":"Price","type":"number","sortable":true}]'
  rows='[{"id":1,"sku":"AC-001","price":"$4.99"},{"id":2,"sku":"AC-002","price":"$3.99"}]'>
  <pk-button slot="bulk" size="mini" variant="ghost">Archive</pk-button>
</pk-table>
```

Example: Select all rows of a paged list

```html
<pk-table label="Orders" manual selectable total="112" selected='["1","2"]' columns='[{"key":"po","label":"PO"}]' rows='[{"id":1,"po":"PO 1042"},{"id":2,"po":"PO 1043"}]'>
  <pk-button slot="bulk" size="mini" variant="ghost">Export</pk-button>
</pk-table>
```

Example: Page selection only (no Select all offer)

```html
<pk-table label="Approvals" manual selectable select-page-only total="112" selected='["1","2"]' columns='[{"key":"po","label":"PO"}]' rows='[{"id":1,"po":"PO 1042"},{"id":2,"po":"PO 1043"}]'>
  <pk-button slot="bulk" size="mini" variant="ghost">Approve</pk-button>
</pk-table>
```

Example: Empty and loading

```html
<pk-table label="Empty" columns='[{"key":"sku","label":"SKU"}]' empty-text="No products yet"></pk-table>
<pk-table label="Loading" loading columns='[{"key":"sku","label":"SKU"}]'></pk-table>
```

Example: Expandable rows

```html
<pk-table label="POs" expandable columns='[{"key":"po","label":"PO"}]' rows='[{"id":1,"po":"PO 1042"},{"id":2,"po":"PO 1043"}]'>
  <p slot="detail-1">3 lines: Widget 1 x 20.</p>
</pk-table>
```

Example: Host-controlled expansion and several panels per row (issue 1219)

```html
<pk-table label="POs" expandable expander="none" expanded='["1","2.notes"]' columns='[{"key":"po","label":"PO"},{"key":"status","label":"Status"}]' rows='[{"id":1,"po":"PO 1042","status":"Open"},{"id":2,"po":"PO 1043","status":"Held"}]'>
  <p slot="detail-1">3 lines: Widget 1 x 20.</p>
  <p slot="detail-2.lines">1 line: Widget 2 x 4.</p>
  <p slot="detail-2.notes">Held for credit review.</p>
</pk-table>
```

Example: Row tone and indent (issue 1019)

```html
<pk-table label="Orders" cards columns='[{"key":"po","label":"PO"},{"key":"state","label":"State"}]' rows='[{"id":1,"po":"PO 1042","state":"Shipped","tone":"positive"},{"id":2,"po":"PO 1043","state":"Late: needs a call","tone":"warning"},{"id":3,"po":"PO 1043-A","state":"Split from 1043","indent":1},{"id":4,"po":"PO 1044","state":"Open"}]'></pk-table>
```

Example: Editable cells

```html
<pk-table label="Stock" editable columns='[{"key":"sku","label":"SKU"},{"key":"qty","label":"Qty","type":"number","editor":"number","required":true,"min":0},{"key":"status","label":"Status","editor":"select","options":["Active","Draft","Retired"]},{"key":"due","label":"Due","type":"date","editor":"date","min":"2026-01-01"},{"key":"note","label":"Note","editor":"textarea","shed":2},{"key":"owner","label":"Owner","editor":"combobox","shed":1,"free":true,"options":["Ana","Ben","Chi"]},{"key":"listed","label":"Listed"}]'
  rows='[{"id":1,"sku":"AC-001","qty":12,"status":"Active","due":"2026-03-05","note":"Reorder in May","owner":"Ana"},{"id":2,"sku":"AC-002","qty":0,"status":"Draft","due":"2026-04-01","note":"","owner":"Ben"}]'>
  <pk-switch slot="cell-1-listed" tabindex="-1" checked><span class="u-sr-only">Listed, row 1</span></pk-switch>
  <pk-switch slot="cell-2-listed" tabindex="-1"><span class="u-sr-only">Listed, row 2</span></pk-switch>
</pk-table>
```

Example: Row context menu (issue #586)

```html
<pk-context-menu><pk-table id="t-ctx" label="Products" selectable columns='[{"key":"sku","label":"SKU"}]' rows='[{"id":1,"sku":"AC-001"},{"id":2,"sku":"AC-002"}]'></pk-table>
  <pk-menu-item slot="menu" value="select">Select row</pk-menu-item>
  <pk-menu-item slot="menu" value="deselect" disabled>Deselect row</pk-menu-item>
</pk-context-menu>
```
