Panelcomponent
Panel({ as: Element = "section", children, ...props }: PanelProps): ReactElement| Param | Type | |
|---|---|---|
props | PanelProps | Props for Panel — colour, status, and typography variants plus optional children. required |
.as | BlockElement | Element this <Panel> renders as, e.g. "header" to output a "<header>" Defaults to "section" |
| Return | |
|---|---|
ReactElement | Rendered full-width panel region. |
Full-width vertical region that paints the current surface colour. Use to break a page into stacked
sections. Has zero block-space (Panels butt against each other); set its vertical breathing room
with the padding variant (<Panel padding="large">, <Panel padding="xxlarge"> etc.).
Renders as a <section> by default; pass as="header" etc. for other semantic elements.
A full-width vertical region that paints the current surface colour. Use panels to break a page into stacked bands: each one butts against its neighbours (zero block margin) but carries generous vertical padding, so a page becomes a sequence of coloured sections.
Things to know:
- A panel always spans the full width of its container. To constrain the content inside, compose a
<Block>width="narrow"(orwidth="wide") within it. - Block margin is always zero so panels stack flush; control the vertical breathing room with the
paddingvariant (<Panel padding="large">,<Panel padding="none">). Inline padding is fixed. color=/status=move the tint anchor for the whole panel scope, so the surface, border, and text re-derive together and cascade into nested content.- The top and bottom borders are dropped on the first and last panel so the page doesn't gain stray edge lines.
Usage
Page banded into panels
import { Panel, Block, Title, Paragraph } from "shelving/ui";
<Panel as="header" color="primary">
<Block width="narrow">
<Title>Welcome</Title>
</Block>
</Panel>
<Panel padding="large">
<Block width="narrow">
<Paragraph>Each panel is a full-width band; the inner block constrains the content.</Paragraph>
</Block>
</Panel>Styling
Panel paints from the tint ladder; rebind --panel-tint to recolour the whole scope at once, or reach for a per-property hook for a single change.
| Variable | Styles | Default |
|---|---|---|
--panel-tint | Tint anchor for the panel scope — recolours surface, border, and text together | inherit (flows from color= / status= / parent) |
--panel-background | Surface fill | var(--tint-90) |
--panel-color | Text colour | var(--tint-00) |
--panel-border | Top/bottom border shorthand | var(--panel-stroke) solid var(--tint-80) |
--panel-stroke | Border thickness | var(--stroke-normal) (2px) |
Global tokens it reads: the tint-ladder steps --tint-00 / --tint-80 / --tint-90, plus --stroke-normal. Vertical padding comes from the shared padding variant.
Examples
<Panel><Block width="narrow"><Title>Welcome</Title></Block></Panel>
<Panel padding="xlarge" color="primary"><Title>Welcome</Title></Panel>