CraftUI

Panel

A layered surface with a header, title, actions, content and footer.

Harbor

Last played on May 15

A survival world with three players and a very large lighthouse.

Installation

npx shadcn@latest add @runqora/craft-panel

Usage

import {
  Panel,
  PanelContent,
  PanelHeader,
  PanelTitle,
} from "@/components/craft/panel";

<Panel>
  <PanelHeader>
    <PanelTitle>Harbor</PanelTitle>
  </PanelHeader>
  <PanelContent>A survival world.</PanelContent>
</Panel>;

Every part is optional, so a panel can be only PanelContent. It has no client code, so it works in React Server Components with no boundary.

Examples

Variants

surface

A panel with the surface surface.

raised

A panel with the raised surface.

sunken

A panel with the sunken surface.

light

A panel with the light surface.

Props

Prop

Type

Each part also accepts every attribute of the element it renders: <div> for most parts, <h3> for PanelTitle and <p> for PanelDescription.

Accessibility

  • PanelTitle renders an <h3>. If that doesn't fit your page's heading order, render your own heading inside PanelHeader.
  • A panel has no role of its own. When it's a landmark on your page, add role and a label, or wrap it in a <section>.

Customization

Panels read their padding from --craft-space, on any level you set it.

<Panel className="[--craft-space:2rem]">...</Panel>

Dependencies

  • class-variance-authority
  • shadcn's utils, and craft-theme

Source

On this page