Components

State Panel ​

State panels replace a content region when there is nothing to show or the intended content cannot be rendered. Use an Alert instead when the surrounding interface remains usable and the message is supplementary.

Empty States ​

Use the default empty variant for a valid absence of content. Explain what is missing and, when useful, place the next step in the actions slot.

Variants ​

The variant communicates why the content region was replaced. empty is the default for a valid absence of content. Use info for explanatory states, success for a completed outcome, warning when the person should review something, and error when the intended content failed. Each variant sets the semantic colour and fallback icon.

Icons ​

Set icon to a name registered through the Icon registry when a state needs a more specific glyph. For fully custom rendered content, including an inline SVG, use the icon slot; the slot takes precedence over the icon property. Use hide-icon when the heading and message are sufficient without one.

Sizes ​

Use the default size for ordinary panels and slide-outs. sm provides a compact replacement state for smaller regions, while lg suits a prominent content region. The size scales the icon, type, spacing, details, copy controls, and default-sized action buttons together.

Error States and Details ​

Use the error variant when the panel replaces content that failed to load or render. Technical information belongs in the details slot, while the default slot stays safe and useful for the person using the interface. Set copyable to add a compact copy button inside the details area. Its icon changes to a check after success, the result is announced, and failures remain visibly explained.

Scrolling Details ​

Large diagnostic output scrolls once it reaches the details area's maximum height. The copy control remains inset within the scrolling content, so a native scrollbar only affects its alignment when one is present.

Use announce="polite" for an asynchronous state change that can wait and announce="assertive" only for an urgent failure. Static states should keep the default announce="off" value.

API ​

Slots ​

NameDescription
titleCustom heading content. Takes precedence over the heading property.
iconCustom icon. The component supplies a variant icon by default.
(default)State description or other primary content.
detailsOptional content inside the collapsible details region.
actionsOptional buttons or links.

Attributes & Properties ​

NameDescription
announceType PkStatePanelAnnouncement
Default off
copiedLabel copied-labelType string
Default Details copied.
copyableType boolean
Default false
copyErrorLabel copy-error-labelType string
Default Copy failed. Select the details and copy them manually.
copyLabel copy-labelType string
Default Copy details
detailsLabel details-labelType string
Default Details
detailsOpen details-openType boolean
Default false
headingType string
headingLevel heading-levelType PkStatePanelHeadingLevel
Default 2
hideIcon hide-iconType boolean
Default false
iconRegistered icon name. A custom icon slot takes precedence.
Type string
sizeOverall density, including typography, icons, spacing, details, and actions.
Type PkStatePanelSize
Default default
variantSemantic colour and fallback icon for the replacement state.
Type PkStatePanelVariant
Default empty

Methods ​

NameDescription
copyDetails()Copy the plain text assigned to the details slot.

Events ​

NameDescription
pk-copyEmitted when the details are copied successfully.
pk-copy-errorEmitted when the details cannot be copied.

CSS Custom Properties ​

NameDescription
--pk-state-panel-accentVariant accent colour.
--pk-state-panel-body-colorPrimary content colour.
--pk-state-panel-content-widthMaximum content width.
--pk-state-panel-details-max-heightMaximum height of diagnostic details.
--pk-state-panel-icon-backgroundIcon container background.
--pk-state-panel-icon-radiusIcon container radius.
--pk-state-panel-icon-shell-sizeIcon container width and height.
--pk-state-panel-icon-sizeIcon width and height.
--pk-state-panel-min-heightMinimum component height.
--pk-state-panel-paddingComponent padding.
--pk-state-panel-title-colorHeading colour.
--pk-state-panel-title-sizeHeading font size.

CSS Parts ​

NameDescriptionCSS selector
actionsActions wrapper.::part(actions)
baseCentered state container.::part(base)
bodyDefault content wrapper.::part(body)
copy-buttonCopy-details button.::part(copy-button)
copy-statusCopy result status.::part(copy-status)
detailsCollapsible details element.::part(details)
details-contentDetails content wrapper.::part(details-content)
details-summaryDetails disclosure label.::part(details-summary)
iconIcon wrapper.::part(icon)
icon-shellIcon background container.::part(icon-shell)
titleState heading.::part(title)

Dependencies ​

This component registers the following elements when it loads.

NameDescription
pk-copy-buttonCompact copy-details action.
pk-icon—
Edit this page
Last updated: Oct 7, 2026, 2:27 PM