Panel
A styled container component for structured content with optional header, body, and footer sections.
A styled container component for structured content with optional header, body, and footer sections.
npm install @vrembem/panel@use "@vrembem/panel";Panel uses design token CSS variables in a reference and fallback pattern. Variables are referenced in the component's styles but are not directly defined; instead, they are provided with sensible fallbacks.
| Variable | Fallback |
|---|---|
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
Copied! | Copied! |
There are no variables that match your search.
Panel is a highly composable container component that comes with a variety of elements. The most basic implementation being panel and a panel__body element:
Basic panel example.
<div class="panel">
<div class="panel__body">
...
</div>
</div>The panel component comes with a variety of elements to help fit a wide range of use cases and applications. You can mix and match these elements within the panel component as needed.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed libero nulla, suscipit consectetur lectus eu, rhoncus eleifend erat. Suspendisse neque dui, ornare non molestie in, rhoncus id lectus.
<div class="panel box-shadow-xl">
<div class="panel__header">
<h2 class="panel__title">...</h2>
<button class="button">...</button>
</div>
<div class="panel__body">
...
</div>
<div class="panel__footer">
...
</div>
</div>Use box-shadow-[key] utilities to increase the elevation of a panel. This can be useful for modal dialogs or popovers.
Available Elements
panel__container
panel__header
panel__titlepanel__bodypanel__footerThe panel__container element is an optional scrollable container that separates content scrolling from the panel's background and border styles, preventing overscroll visual issues.
It's also possible to create collapsable panels by using the <details> for the root .panel and <summary> for the panel__header element.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed libero nulla, suscipit consectetur lectus eu, rhoncus eleifend erat. Suspendisse neque dui, ornare non molestie in, rhoncus id lectus.
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Sed libero nulla, suscipit consectetur lectus eu, rhoncus eleifend erat. Suspendisse neque dui, ornare non molestie in, rhoncus id lectus.
<details class="panel">
<summary class="panel__header">
<h2 class="panel__title">...</h2>
</summary>
<div class="panel__body">
...
</div>
</details>There are cases where a panel needs to be focusable. For these instances, apply tabindex="0" to the panel element itself. Focus ring styles are applied to panels for the :focus-visible state.
This panel can be focused by clicking or using keyboard navigation. To see :focus-visible styles, click on this panel and press the shift key.
<div class="panel" tabindex="0">
...
</div>