# Panel

> A plain surface for forms, details and any other composed content.

- Category: Cards
- Import: `import { Panel } from "@sagui/ui";`
- Page: /components/panel

```tsx
import { Button, Panel, PanelContent, PanelDescription, PanelFooter, PanelHeader, PanelTitle } from "@sagui/ui";

export function Hero() {
  return (
    <Panel className="max-w-md">
      <PanelHeader>
        <PanelTitle>Banking</PanelTitle>
        <PanelDescription>Account ending 4821</PanelDescription>
      </PanelHeader>
      <PanelContent>Payments settle within two business days.</PanelContent>
      <PanelFooter>
        <Button variant="outline">Change account</Button>
      </PanelFooter>
    </Panel>
  );
}
```

## When to use

- Grouping a form or a block of details on a page.
- A dashboard section with a title and a chart or table inside.

## When not to use

- Use card for a titled summary with media, a byline or a quick look.
- Use metric-card for a single number with context.

## Installation

Install the package and import the styles once. The [installation guide](/docs/installation) covers the Tailwind setup.

```bash
npm install @sagui/ui
```

## Usage

```tsx
import { Button, Panel, PanelContent, PanelDescription, PanelFooter, PanelHeader, PanelTitle } from "@sagui/ui";

<Panel>
  <PanelHeader>
    <PanelTitle>Banking</PanelTitle>
    <PanelDescription>Account ending 4821</PanelDescription>
  </PanelHeader>
  <PanelContent>Payments settle within two business days.</PanelContent>
  <PanelFooter>
    <Button variant="outline">Change account</Button>
  </PanelFooter>
</Panel>
```

`elevation` is `flat` (default), `resting` or `raised`. Use elevation only when the panel must lift off its surroundings. Leave out PanelFooter when there are no actions.

## Examples

### Raised

```tsx
import { Panel, PanelContent, PanelHeader, PanelTitle } from "@sagui/ui";

export function Raised() {
  return (
    <Panel elevation="raised" className="max-w-md">
      <PanelHeader>
        <PanelTitle>Shipping address</PanelTitle>
      </PanelHeader>
      <PanelContent>1200 Congress Ave, Austin, TX 78701</PanelContent>
    </Panel>
  );
}
```

## Accessibility

- Panel renders a `section` and PanelTitle an `h2`. Pass `aria-labelledby` with the title's id so the section is named.
