Introducing PrimeReact v11-alpha 🎉Discover Now
styledPanel

Panel

Panel is a container component with optional collapsible content.

Wireless Headphones$79.00
Phone Case$15.00
Shipping$5.99
Total$99.99
preview

Usage#

import { Panel } from '@primereact/ui/panel';
<Panel.Root>
    <Panel.Header>
        <Panel.Title />
        <Panel.Trigger>
            <Panel.Indicator />
        </Panel.Trigger>
    </Panel.Header>
    <Panel.Content />
    <Panel.Footer />
</Panel.Root>

Examples#

Basic#

A container with a collapsible header and scrollable content body.

Order Summary
Wireless Headphones$79.00
Phone Case$15.00
Shipping$5.99
Total$99.99
basic-demo

Toggleable#

Use Panel.Trigger inside the header to make the panel collapsible. The defaultOpen prop sets the initial state, and content visibility is animated by default.

Order Summary
Wireless Headphones$79.00
Phone Case$15.00
Shipping$5.99
Total$99.99
toggleable-demo

Controlled#

Control panel state from outside with the open and onOpenChange props.

Order Summary
Wireless Headphones$79.00
Phone Case$15.00
Shipping$5.99
Total$99.99
toggleable-controlled-demo

Indicator#

Panel.Indicator supports conditional rendering based on panel state. Use the match prop to render content only when the state matches.

<Panel.Header>
    <Panel.Title>Header</Panel.Title>
    <Panel.Trigger>
        <Panel.Indicator match="open">
            <Minus />
        </Panel.Indicator>
        <Panel.Indicator match="closed">
            <Plus />
        </Panel.Indicator>
    </Panel.Trigger>
</Panel.Header>

Available values: open, closed. Without the match prop, the indicator renders in all states.

Match open / closed

Order Summary
Wireless Headphones$79.00
Phone Case$15.00
Shipping$5.99
Total$99.99

CSS-only with data attributes

Order Summary
Wireless Headphones$79.00
Phone Case$15.00
Shipping$5.99
Total$99.99
indicator-demo

Template#

Customize the header with custom layouts such as avatars, action buttons, and additional metadata alongside Panel.Trigger.

A
Amy Elsner

Product designer focused on accessible interfaces, scalable design systems and modern frontend workflows. Passionate about creating intuitive user experiences that balance usability, consistency and performance across platforms. Currently exploring AI-assisted UI tooling, component architecture and developer experience improvements to streamline design-to-development collaboration and build more maintainable products.

Updated 2 hours ago
template-demo

API#

Sub-Components#

See Primitive API for PanelRoot, PanelHeader, PanelTrigger, PanelTitle, PanelIndicator, PanelContent, and PanelFooter component documentation.

Hooks#

See Headless API for usePanel hook documentation.

Accessibility#

See Panel Primitive for WAI-ARIA compliance details and keyboard support.