Lightweight containers that optionally collapse their content.
Panels are used for lightweight viewing or editing of content. They can be used in longer forms to group similar content. There is some overlap between cards and panels, but a panel includes a freeform content pane, whereas cards are typically shown in groups with one focused topic and associated action per card. In addition, cards often use imagery to enhance their appearance whereas panels optionally include a simple icon to represent the topic.
Basic Panel
The core components of a panel are a single line header and some detailed content. For example, a data table in an application's dashboard.
At minimum, panels include a PanelHeader and a PanelContent component.
<Panel>
<PanelHeadertitle="Basic Panel"/>
<PanelContent>Here is some nice content.</PanelContent>
</Panel>
Collapsible Panel
A collapsed panel displays summary information. Interaction with the panel header toggles the visibility of the panel content.
Collapsible Panels may be displayed in a sequence to form creation flows. Steps in the process are contained within the panels.
To enable Collapse on the PanelContent, pass the enableCollapse prop.
<PanelenableCollapse>
<PanelHeadertitle="Collapsible Panel"/>
<PanelContent>Here is some nice content.</PanelContent>
</Panel>
Default the panel state to open by passing the expanded prop.
<PanelenableCollapseexpanded>
<PanelHeadertitle="Expanded Panel"/>
<PanelContent>Here is some nice content.</PanelContent>
</Panel>
Panel Icon
A visual representation of the panel contents.
An icon component or svg may be passed in the icon prop.
Note: If the icon is necessary to understand the panel contents in addition to the panel title, include the iconLabel prop, ex: iconLabel="Review details".
<PanelContent>Here is some informational content.</PanelContent>
</Panel>
Header Customizations
Title Variant & Hierarchy
Define titleVariant as any valid <Typography> variant to customize the title style.
The default title element rendered is <h4>. Use the titleComponent prop to correct the semantic hierarchy as needed for the document outline. For example, if the panel follows an <h2> headline, set titleComponent="h3".
<PanelContent>Here is some informational content.</PanelContent>
</Panel>
Extended Header
Add any nodes as children to <PanelHeader> to display an extended header, which will remain visible when the panel is collapsed and be included if a custom palette is provided.
<>
<PanelenableCollapse>
<PanelHeadertitle="Information"icon={<Info/>}>
<Typographycolor="textSecondary">
Cotton candy donut lemon drops gingerbread wafer.
</Typography>
</PanelHeader>
<PanelContent>
<Dividermargin={{ bottom:2}}/>
<Typography>Here is some informational content.</Typography>