# Depth

Shadows show which surfaces sit above others. This chapter covers the shadow scale and when to use each step.

Depth has two layers. A palette of six shadows holds the values. Components never read the palette. Each component reads a role instead, so every card, button and menu of the same kind casts the same shadow.

## Installation

```bash
npm install @kushagradhawan/kookie-ui
```

## Roles

```css
var(--surface-chrome)         /* A raised card, a chatbar, a shell pane */
var(--control-chrome)         /* A raised button, chip, segmented indicator */
var(--field-chrome)           /* A raised field: text field, text area, select trigger, raised segmented control */
var(--control-chrome-active)  /* The same control while pressed */
var(--grip-chrome)            /* A switch or slider thumb */
var(--control-light)          /* An optional light on a raised control */
var(--floating-chrome)        /* A popover, menu, combobox or select list */
var(--dialog-chrome)          /* A dialog or an overlay pane */
```

`--control-light` is `none` by default. Set it to a gradient to add light, and it lands as a `background-image` on a raised control.

A dialog is a surface that covers the page, so `--dialog-chrome` is the surface shadow.

```css
.my-panel {
  box-shadow: var(--surface-chrome);
}
```

## Fields

A text field, text area or select trigger is the surface colour with `--field-chrome`: the hairline and 1px drop of a raised button, without its blur, so a panel of fields stays light. Hover moves the fill one step. Focus draws the focus ring. Disabled drops the shadow for a faint edge.

```css
var(--field-fill)
var(--field-fill-hover)
var(--field-fill-disabled)
var(--field-edge-disabled)
```

## Palette

The palette is for your own blocks. No step draws a ring, so add a border when an element needs an edge.

```css
var(--shadow-1)  /* An inset well */
var(--shadow-2)  /* A small drop */
var(--shadow-3)  /* A floating drop */
var(--shadow-4)  /* A surface drop */
var(--shadow-5)  /* A wide drop */
var(--shadow-6)  /* The deepest drop */
```

## Dark Mode

Every role and palette step has a dark value. In dark mode a raised control also draws a faint inner edge, because a drop shadow is hard to see on a dark page.

```tsx
<Theme appearance="dark"><YourApp /></Theme>
```
