# Bottom Sheet

## Usage

`BottomSheet` rises from the bottom edge of the viewport to hold mobile-first content: filters, share targets, quick actions, and forms. The panel carries a decorative grab handle, a scrolling content area underneath, and a scrim that dims and blocks the page. It is built on the native `<dialog>` element, so an open sheet keeps focus inside itself, makes the rest of the page inert, and returns focus to whatever opened it when it closes.

The shortest form manages its own state and takes a name and the content:

```vue
<script setup lang="ts">
import { BottomSheet } from '@astryx-vue/core/BottomSheet'
import { ref } from 'vue'

const isOpen = ref(false)
</script>

<template>
  <button type="button" @click="isOpen = true">
    Filters
  </button>
  <BottomSheet v-model:is-open="isOpen" label="Filters">
    <p>Filter controls go here.</p>
  </BottomSheet>
</template>
```

`label` is required and becomes the sheet's accessible name, which a screen reader announces on entry. The panel has no built-in heading, so that name has to come from you. Whether the sheet is open is decided by `isOpen`: leave it unbound and the component owns its state, so Escape, a scrim click, and a downward swipe all close it; bind it and the component renders exactly the bound value while those gestures only emit `openChange(false)` and let the parent decide.

`height` sets how tall the panel is once expanded, and it has three named budgets. `hug` fits the content up to 92% of the viewport, which suits short, bounded content. `capped` is the default at roughly 62% of the viewport, the usual choice for lists. `tall` pins the panel near full height for forms and content that keeps growing. You can also pass a number of pixels or any CSS length, such as `420` or `"min(70vh, 30rem)"`. Whatever the budget, content taller than the visible panel scrolls inside it instead of stretching the page.

`snapPoints` lets someone drag the panel to an intermediate height rather than only fully open or closed. Each stop is the panel's visible height: a number is a viewport fraction (`0.5` is half the screen), `"50%"` means the same thing, and `"320px"` is an absolute height. The panel's own height is always the tallest stop, so `snap-points="[0.5]"` reads as "half a screen or all of it". A stop that is a quarter of the panel or less counts as a peek: it slides the panel partly off-screen instead of reflowing the content into a sliver, and it thins the scrim. Without `snapPoints` the sheet only opens and closes, and dragging it down still dismisses it.

A downward drag closes the sheet, and a fast upward flick expands it to the tallest stop. The scrim's depth follows the panel while it moves, and on release the sheet settles on the nearest stop. Both the handle and, once it is scrolled to the top, the content area can start a drag. Under `prefers-reduced-motion: reduce` the entrance and exit movements collapse to almost nothing, while the position and state changes still happen.

`purpose` controls implicit dismissal, matching `Dialog`. The default `info` allows Escape, a scrim click, and a swipe. `form` allows Escape only, so a stray click on the scrim cannot throw away typed input. `required` blocks every implicit path and announces the sheet as an alert dialog for flows that must end through an explicit choice. When the page behind the sheet should stay usable, set `hasScrim` to `false`: the sheet then opens non-modally, the page keeps scrolling and responding to clicks, and a swipe still dismisses it. A non-modal sheet never takes focus away from the page, so Escape dismisses it while focus is inside the sheet.

`padding` sets the content area's inset on the spacing scale. When omitted, the theme decides, falling back to the `--spacing-4` step (16px) on every logical edge; pass `0` for a content box flush with the panel. The content area publishes the inset it applies: a lone child region that carries its own inset escapes it, and bleed children such as a table or a divider line up with that edge instead of sitting inside it twice.

### Anatomy

- **Sheet panel**: Painted surface that rises from the bottom edge and contains the sheet.
- **Content area**: Padded, scrollable container that presents the caller-provided sheet content.
- **Handle**: Decorative grab affordance and drag region at the top of the panel.
- **Scrim**: Backdrop that dims and blocks the page in a scrim-backed presentation.

## Best practices

| Guidance | Practices |
| --- | --- |
| Do | Reserve it for small screens and momentary tasks: filters, sharing, quick actions, detail previews. Rising from the bottom edge keeps content inside thumb reach. |
| Do | Pick the height that fits the content: `hug` for short bounded content, `capped` for lists, `tall` for forms and content that streams in. |
| Do | Use `purpose="form"` to protect entered data against stray taps while keeping Escape available, and reserve `required` for flows that must end through an explicit action. |
| Do | Write a `label` that says what the sheet holds. It is the only context a screen reader gets when focus moves in. |
| Don't | Let the sheet content run long. Break a long task into steps or move it to a full page instead. |
| Don't | Treat it as the default dialog on desktop. Use `Dialog` when a centered modal is what the task calls for. |
| Don't | Rely on the swipe as the only way out. Escape, a scrim click, and an explicit action button matter just as much. |

## Examples

### Height variants

Compares hug, capped, and tall starting heights for different amounts of content.

```vue
<script setup lang="ts">
import type { BottomSheetHeight } from '@astryx-vue/core/BottomSheet'
import { BottomSheet } from '@astryx-vue/core/BottomSheet'
import { Button } from '@astryx-vue/core/Button'
import { Divider } from '@astryx-vue/core/Divider'
import { Heading } from '@astryx-vue/core/Heading'
import { HStack, VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const descriptions: Record<BottomSheetHeight, string> = {
  hug: 'Hug fits short, bounded content.',
  capped: 'Capped starts at a comfortable mid-height for lists and filters.',
  tall: 'Tall reserves most of the viewport for long or changing content.',
}

const height = ref<BottomSheetHeight | null>(null)
</script>

<template>
  <HStack :gap="2" wrap="wrap">
    <Button label="Open hug" @click="height = 'hug'" />
    <Button label="Open capped" @click="height = 'capped'" />
    <Button label="Open tall" @click="height = 'tall'" />
  </HStack>
  <BottomSheet
    :height="height ?? 'hug'"
    :is-open="height != null"
    :label="`${height ?? 'Hug'} height`"
    @update:is-open="open => { if (!open) height = null }"
  >
    <VStack :gap="4">
      <Heading :level="3">
        {{ height ?? 'Hug' }} height
      </Heading>
      <Divider />
      <Text type="body">
        {{ descriptions[height ?? 'hug'] }}
      </Text>
      <Button label="Close" @click="height = null" />
    </VStack>
  </BottomSheet>
</template>
```

### Mobile keyboard

A tall, scrollable form that keeps focused controls visible above the mobile keyboard.

```vue
<script setup lang="ts">
import { BottomSheet } from '@astryx-vue/core/BottomSheet'
import { Button } from '@astryx-vue/core/Button'
import { Divider } from '@astryx-vue/core/Divider'
import { Heading } from '@astryx-vue/core/Heading'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { TextArea } from '@astryx-vue/core/TextArea'
import { TextInput } from '@astryx-vue/core/TextInput'
import { reactive, ref } from 'vue'

const isOpen = ref(false)
const values = reactive({
  name: '',
  email: '',
  company: '',
  role: '',
  bio: '',
  notes: '',
})

function onSubmit(): void {
  isOpen.value = false
}
</script>

<template>
  <Button label="Edit profile" @click="isOpen = true" />
  <BottomSheet
    v-model:is-open="isOpen"
    height="tall"
    label="Edit profile"
  >
    <form @submit.prevent="onSubmit">
      <VStack :gap="4">
        <Heading :level="3">
          Edit profile
        </Heading>
        <Divider />
        <Text type="supporting" color="secondary">
          Focus fields throughout the form to see them remain visible above the mobile keyboard.
        </Text>
        <TextInput v-model="values.name" label="Name" />
        <TextInput v-model="values.email" label="Email" type="email" />
        <TextInput v-model="values.company" label="Company" />
        <TextInput v-model="values.role" label="Role" />
        <TextArea v-model="values.bio" label="Bio" :rows="5" />
        <TextArea v-model="values.notes" label="Notes" :rows="5" />
        <Button label="Save profile" type="submit" />
      </VStack>
    </form>
  </BottomSheet>
</template>
```

### No scrim

The page stays visible and interactive behind a non-modal sheet.

```vue
<script setup lang="ts">
import { BottomSheet } from '@astryx-vue/core/BottomSheet'
import { Button } from '@astryx-vue/core/Button'
import { Divider } from '@astryx-vue/core/Divider'
import { Heading } from '@astryx-vue/core/Heading'
import { Section } from '@astryx-vue/core/Section'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const isOpen = ref(false)
const backgroundClicks = ref(0)
</script>

<template>
  <Section :padding="4">
    <VStack :gap="3">
      <Heading :level="3">
        Nearby places
      </Heading>
      <Text type="body">
        Background interactions: {{ backgroundClicks }}
      </Text>
      <Button label="Interact with page" variant="secondary" @click="backgroundClicks += 1" />
      <Button label="Show place details" @click="isOpen = true" />
    </VStack>
    <BottomSheet
      v-model:is-open="isOpen"
      :has-scrim="false"
      height="hug"
      label="Place details"
    >
      <VStack :gap="4">
        <Heading :level="3">
          Central Park
        </Heading>
        <Divider />
        <Text type="body">
          The page remains visible and interactive behind this sheet.
        </Text>
        <Button label="Close details" @click="isOpen = false" />
      </VStack>
    </BottomSheet>
  </Section>
</template>
```

### Snap points

Drag-to-resize stops: a half-height working surface, and a peek that slides away and thins the scrim.

```vue
<script setup lang="ts">
import { BottomSheet } from '@astryx-vue/core/BottomSheet'
import { Button } from '@astryx-vue/core/Button'
import { Divider } from '@astryx-vue/core/Divider'
import { Heading } from '@astryx-vue/core/Heading'
import { Icon } from '@astryx-vue/core/Icon'
import { Item } from '@astryx-vue/core/List'
import { HStack, VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const snapPoints = ['96px', '50%']
const isOpen = ref(false)

const steps = [
  { icon: 'pin', label: 'Head northeast on Mission St', detail: 'Toward 3rd St', distance: '350 ft' },
  { icon: 'right', label: 'Turn right onto 3rd St', detail: 'Pass Yerba Buena Gardens on your left', distance: '0.2 mi' },
  { icon: 'up', label: 'Continue onto Kearny St', detail: 'Stay in the right lane', distance: '0.4 mi' },
  { icon: 'left', label: 'Turn left onto Market St', detail: 'Cable car crossing ahead', distance: '0.6 mi' },
  { icon: 'right', label: 'Bear right onto Sutter St', detail: 'Toward the Financial District', distance: '0.3 mi' },
  { icon: 'up', label: 'Continue on Sansome St', detail: 'Four blocks, past Pine St', distance: '0.5 mi' },
  { icon: 'uturn', label: 'Make a U-turn at Washington St', detail: 'Construction detour until March', distance: '150 ft' },
  { icon: 'right', label: 'Turn right onto Battery St', detail: 'Follow signs for the Embarcadero', distance: '0.4 mi' },
  { icon: 'left', label: 'Turn left onto Sacramento St', detail: 'Toward the waterfront', distance: '0.2 mi' },
  { icon: 'right', label: 'Turn right onto The Embarcadero', detail: 'Bay Bridge on your right', distance: '0.5 mi' },
  { icon: 'up', label: 'Continue past Pier 14', detail: 'Ferry terminal signage begins here', distance: '0.3 mi' },
  { icon: 'flag', label: 'Arrive at the Ferry Building', detail: 'Parking garage entrance on Washington St', distance: '—' },
]
</script>

<template>
  <VStack align="start" :gap="3">
    <Text type="body">
      This sheet has two extra stops: half the viewport, and a 96px peek. Drag the handle down to collapse it, then back up — it rests at each stop instead of following your finger.
    </Text>
    <Button label="Show directions" @click="isOpen = true" />
  </VStack>
  <BottomSheet
    v-model:is-open="isOpen"
    height="tall"
    label="Directions to the Ferry Building"
    :snap-points="snapPoints"
  >
    <VStack :gap="4">
      <VStack :gap="1">
        <Heading :level="3">
          Ferry Building
        </Heading>
        <HStack :gap="2">
          <Text type="label">
            18 min
          </Text>
          <Text type="supporting">
            3.7 mi · arrive 9:41 AM
          </Text>
        </HStack>
      </VStack>
      <Divider />
      <VStack :gap="0">
        <Item
          v-for="step in steps"
          :key="step.label"
          :description="step.detail"
          :label="step.label"
        >
          <template #startContent>
            <Icon size="sm">
              <svg v-if="step.icon === 'pin'" fill="none" height="16" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" width="16">
                <path d="M12 21s7-6.2 7-11a7 7 0 1 0-14 0c0 4.8 7 11 7 11Z" stroke-linecap="round" stroke-linejoin="round" />
                <circle cx="12" cy="10" r="2.25" />
              </svg>
              <svg v-else-if="step.icon === 'right'" fill="none" height="16" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" width="16">
                <path d="M4 12h16M14 6l6 6-6 6" stroke-linecap="round" stroke-linejoin="round" />
              </svg>
              <svg v-else-if="step.icon === 'left'" fill="none" height="16" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" width="16">
                <path d="M20 12H4M10 6l-6 6 6 6" stroke-linecap="round" stroke-linejoin="round" />
              </svg>
              <svg v-else-if="step.icon === 'up'" fill="none" height="16" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" width="16">
                <path d="M12 20V4M6 10l6-6 6 6" stroke-linecap="round" stroke-linejoin="round" />
              </svg>
              <svg v-else-if="step.icon === 'uturn'" fill="none" height="16" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" width="16">
                <path d="M9 14 4 9l5-5" stroke-linecap="round" stroke-linejoin="round" />
                <path d="M4 9h9a6 6 0 0 1 0 12H8" stroke-linecap="round" stroke-linejoin="round" />
              </svg>
              <svg v-else fill="none" height="16" stroke="currentColor" stroke-width="1.5" viewBox="0 0 24 24" width="16">
                <path d="M5 21V4h9l-1.5 4.5L14 13H5" stroke-linecap="round" stroke-linejoin="round" />
              </svg>
            </Icon>
          </template>
          <template #endContent>
            <Text type="supporting">
              {{ step.distance }}
            </Text>
          </template>
        </Item>
      </VStack>
      <Divider />
      <Button label="Start" variant="primary" @click="isOpen = false" />
    </VStack>
  </BottomSheet>
</template>
```

### Adaptive dialog

Dialog stays the default. On a coarse pointer at lg and below, the same profile form opens as a bottom sheet.

```vue
<script setup lang="ts">
import type { BottomSheetHeight, BottomSheetPurpose } from '@astryx-vue/core/BottomSheet'
import type { DialogPurpose } from '@astryx-vue/core/Dialog'
import { useMediaQuery } from '@astryx-vue/core'
import { BottomSheet } from '@astryx-vue/core/BottomSheet'
import { Button } from '@astryx-vue/core/Button'
import { Dialog, DialogHeader } from '@astryx-vue/core/Dialog'
import { Heading } from '@astryx-vue/core/Heading'
import { Layout, LayoutContent, LayoutFooter } from '@astryx-vue/core/Layout'
import { HStack, VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { TextArea } from '@astryx-vue/core/TextArea'
import { TextInput } from '@astryx-vue/core/TextInput'
import { ref } from 'vue'

const TOUCH_ORIENTED_LG_QUERY = '(max-width: 1024px) and (pointer: coarse) and (hover: none)'

type AdaptivePresentation = 'dialog' | 'fullscreen' | 'bottom-sheet'

const isOpen = ref(false)
const name = ref('Ruby Cheung')
const email = ref('ruby@example.com')
const notes = ref('')
const isTouchOriented = useMediaQuery(TOUCH_ORIENTED_LG_QUERY)

const purpose: DialogPurpose = 'form'
const touchPresentation: AdaptivePresentation = 'bottom-sheet'
const bottomSheetHeight: BottomSheetHeight = 'tall'

function resolvedPresentation(): AdaptivePresentation {
  return isTouchOriented.value ? touchPresentation : 'dialog'
}
</script>

<template>
  <Button label="Edit profile" @click="isOpen = true" />
  <BottomSheet
    v-if="resolvedPresentation() === 'bottom-sheet'"
    v-model:is-open="isOpen"
    :height="bottomSheetHeight"
    label="Edit profile"
    :purpose="purpose as BottomSheetPurpose"
  >
    <VStack :gap="4">
      <Heading :level="3">
        Edit profile
      </Heading>
      <Text type="supporting" color="secondary">
        Dialog remains the default presentation. This example explicitly opts into a Bottom Sheet only at lg and below when the device has a coarse pointer and no hover. Pass the presentation prop to make tests or unusual environments deterministic.
      </Text>
      <Text type="supporting" color="secondary">
        In Bottom Sheet presentation, purpose="form" blocks scrim clicks and swipe dismissal while preserving Escape. Use this opt-in only when that contract is acceptable; keep AlertDialog/destructive confirmations on Dialog unless a product deliberately chooses otherwise.
      </Text>
      <TextInput v-model="name" label="Name" />
      <TextInput v-model="email" label="Email" type="email" />
      <TextArea v-model="notes" label="Notes" :rows="6" />
      <HStack :gap="2" h-align="end" wrap="wrap">
        <Button label="Cancel" variant="secondary" @click="isOpen = false" />
        <Button label="Save profile" variant="primary" @click="isOpen = false" />
      </HStack>
    </VStack>
  </BottomSheet>
  <Dialog
    v-else
    :is-open="isOpen"
    max-height="75dvh"
    :purpose="purpose"
    :variant="resolvedPresentation() === 'fullscreen' ? 'fullscreen' : 'standard'"
    :width="480"
    @open-change="isOpen = $event"
  >
    <Layout>
      <template #header>
        <DialogHeader title="Edit profile" @open-change="isOpen = $event" />
      </template>
      <LayoutContent>
        <VStack :gap="4">
          <Text type="supporting" color="secondary">
            Dialog remains the default presentation. This example explicitly opts into a Bottom Sheet only at lg and below when the device has a coarse pointer and no hover. Pass the presentation prop to make tests or unusual environments deterministic.
          </Text>
          <Text type="supporting" color="secondary">
            In Bottom Sheet presentation, purpose="form" blocks scrim clicks and swipe dismissal while preserving Escape. Use this opt-in only when that contract is acceptable; keep AlertDialog/destructive confirmations on Dialog unless a product deliberately chooses otherwise.
          </Text>
          <TextInput v-model="name" label="Name" />
          <TextInput v-model="email" label="Email" type="email" />
          <TextArea v-model="notes" label="Notes" :rows="6" />
        </VStack>
      </LayoutContent>
      <template #footer>
        <LayoutFooter>
          <HStack :gap="2" h-align="end" wrap="wrap">
            <Button label="Cancel" variant="secondary" @click="isOpen = false" />
            <Button label="Save profile" variant="primary" @click="isOpen = false" />
          </HStack>
        </LayoutFooter>
      </template>
    </Layout>
  </Dialog>
</template>
```

### Adaptive menu

Project actions use a bottom sheet on a compact touch surface and an anchored menu otherwise.

```vue
<script setup lang="ts">
import { useMediaQuery } from '@astryx-vue/core'
import { DropdownMenu } from '@astryx-vue/core/DropdownMenu'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { computed, ref } from 'vue'

const COMPACT_TOUCH_QUERY = '(max-width: 639px) and (pointer: coarse) and (hover: none)'
const isCompactTouch = useMediaQuery(COMPACT_TOUCH_QUERY)
const lastAction = ref<string | null>(null)

const items = computed(() => [
  'Edit project',
  'Duplicate project',
  'Share project',
  'Archive project',
].map(label => ({
  label,
  onClick: () => {
    lastAction.value = label
  },
})))
</script>

<template>
  <VStack :gap="3">
    <DropdownMenu
      :button="{ label: 'Project actions' }"
      :items="items"
      :presentation="isCompactTouch ? 'bottom-sheet' : 'popover'"
    />
    <Text v-if="lastAction" type="supporting" color="secondary">
      Last action: {{ lastAction }}
    </Text>
  </VStack>
</template>
```

### Multi-select sheet

A multi-selection list stays open in a bottom sheet while choices are toggled.

```vue
<script setup lang="ts">
import { MultiSelector } from '@astryx-vue/core/MultiSelector'
import { ref } from 'vue'

const value = ref<string[]>([])
const options = ['Design', 'Engineering', 'Marketing', 'Operations']
</script>

<template>
  <div class="bottom-sheet-field">
    <MultiSelector
      v-model="value"
      label="Teams"
      :options="options"
      placeholder="Choose teams"
      presentation="bottom-sheet"
      select-all
    />
  </div>
</template>

<style scoped>
.bottom-sheet-field {
  width: 320px;
  max-width: 100%;
}
</style>
```

### Select sheet

A single-selection list opens in a bottom sheet.

```vue
<script setup lang="ts">
import { Selector } from '@astryx-vue/core/Selector'
import { ref } from 'vue'

const value = ref<string | null>(null)
const options = [
  { value: 'design', label: 'Design' },
  { value: 'engineering', label: 'Engineering' },
  { value: 'marketing', label: 'Marketing' },
  { value: 'operations', label: 'Operations' },
]
</script>

<template>
  <div class="bottom-sheet-field">
    <Selector
      v-model="value"
      label="Team"
      :options="options"
      placeholder="Choose a team"
      presentation="bottom-sheet"
    />
  </div>
</template>

<style scoped>
.bottom-sheet-field {
  width: 320px;
  max-width: 100%;
}
</style>
```

### Multi-step switcher

Checkout is two sheets in one dialog. The scrim stays up while the page changes.

```vue
<script setup lang="ts">
import { BottomSheet, BottomSheetSwitcher } from '@astryx-vue/core/BottomSheet'
import { Button } from '@astryx-vue/core/Button'
import { VStack } from '@astryx-vue/core/Stack'
import { Text } from '@astryx-vue/core/Text'
import { ref } from 'vue'

const activeSheet = ref<string | null>(null)
</script>

<template>
  <Button label="Start checkout" @click="activeSheet = 'details'" />
  <BottomSheetSwitcher v-model:active-sheet="activeSheet" label="Checkout">
    <BottomSheet sheet-id="details" label="Details">
      <VStack :gap="3">
        <Text type="body">
          Confirm the order, then continue to payment.
        </Text>
        <Button label="Continue" @click="activeSheet = 'pay'" />
      </VStack>
    </BottomSheet>
    <BottomSheet sheet-id="pay" label="Payment">
      <VStack :gap="3">
        <Text type="body">
          Payment details stay in the same sheet.
        </Text>
        <Button label="Back" variant="secondary" @click="activeSheet = 'details'" />
        <Button label="Done" @click="activeSheet = null" />
      </VStack>
    </BottomSheet>
  </BottomSheetSwitcher>
</template>
```

## Accessibility

The panel is built on the native `<dialog>` element. With a scrim it opens through `showModal()`, which puts it in the top layer, makes the background inert, and confines Tab to the sheet. Without a scrim it opens through `show()`, leaving the page usable. `label` names the sheet through `aria-label`, and `purpose="required"` switches the role to `alertdialog`.

On open, focus lands on the first element with `data-autofocus` inside the panel, or on the panel itself when there is none. On close, focus returns to the element that was focused when the sheet opened — if it is still in the page — or to the element named by `finalFocusRef`. The handoff happens once the exit motion has finished, so focus never lands on a surface that is still sliding away.

Escape closes the sheet unless `purpose` is `required` — a modal sheet confines focus inside itself, while a non-modal one never takes focus from the page, so focus has to be inside the sheet — and an Escape pressed while an input method is composing text cancels the composition instead. Once the content area is scrolled to the top, a downward drag can close the sheet, and at the end of its content an upward drag can expand it; with a `purpose` other than `info` a drag only settles on the nearest stop and never dismisses.

While the content actually overflows, the scrolling area becomes focusable, carries `role="group"`, and is named by the sheet's `label`, so a keyboard user can focus it and scroll with the arrow keys.

## Theming

```css
.my-sheet {
  --astryx-bottom-sheet-background: #ffffff;
  --astryx-bottom-sheet-foreground: #171717;
  --astryx-bottom-sheet-border: #d4d4d4;
  --astryx-bottom-sheet-handle-background: #d4d4d4;
  --astryx-bottom-sheet-scrim: #00000080;
  --astryx-bottom-sheet-shadow: 0 -12px 24px rgb(0 0 0 / 15%);
}
```

The neutral theme adapts to light and dark mode. `class` and `style` land on the panel `<div>`, not on the `<dialog>` that wraps it, so the variables above belong on the panel.

## Props

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `label` | `string` | - | Accessible name for the sheet, and required. It is associated through `aria-label`; the panel has no built-in heading to derive a name from. |
| `v-model:isOpen` | `boolean` | `false` | Controlled open state. Bound, the sheet renders exactly this value and Escape, a scrim click, or a swipe only asks for a change; unbound, the component owns its state. |
| `height` | `BottomSheetHeight \| number \| string` | `'capped'` | How tall the sheet is. Named budgets are hug (fits content, up to 92% of the viewport), capped (about 62%), and tall (about 92%); a number is pixels and a string is used as a CSS length. Content taller than the visible panel scrolls inside it. |
| `snapPoints` | `readonly BottomSheetSnapPoint[]` | - | Extra heights the sheet can rest at when dragged. A number is a viewport fraction, `'50%'` a percentage, and `'320px'` an absolute height; the sheet's own height is always the tallest stop. Without it the sheet only opens and closes. |
| `padding` | `BottomSheetPadding` | - | Inner padding of the content box using the spacing scale. When omitted, the theme decides, falling back to the `--spacing-4` step (16px) on every logical edge; pass `0` for a flush content box. The content box is a container, so a lone child that carries its own inset escapes the padding. |
| `purpose` | `BottomSheetPurpose` | `'info'` | Implicit dismissal, matching `Dialog`. info allows Escape, a scrim click, and a swipe; form allows Escape only; required blocks every implicit path and uses `alertdialog` semantics. |
| `hasScrim` | `boolean` | `true` | Whether to render a scrim and open modally. `true` uses `showModal()`: top layer, focus confinement, page scroll lock, and an inert background. `false` uses `show()`, leaving the page interactive and scrollable. |
| `finalFocusRef` | `HTMLElement \| null` | `null` | Element that receives focus after the sheet closes, replacing the element that was focused when it opened. Use it when the opener can remount or the active element is not a reliable trigger. |
| `isInline` | `boolean` | `false` | Renders the panel in the document flow instead of a `<dialog>`, without a scrim, focus trap, or motion. Used to preview the surface inside a container that is already inert, such as component documentation. |

## Slots

| Name | Description |
| --- | --- |
| `default` | The sheet content, rendered in the scrolling area below the grab handle. |

## Events and template ref

| Name | Signature | Description |
| --- | --- | --- |
| `openChange` | `(isOpen: boolean) => void` | Emitted when the sheet asks to change state: Escape, a scrim click, a swipe dismissal, or a `v-model:isOpen` write. |
| `update:isOpen` | `(isOpen: boolean) => void` | Handled automatically by `v-model:isOpen`; you rarely need it directly. |
| `motionStart` | `(motion: 'entering' \| 'exiting') => void` | Emitted when an entrance or exit motion starts. |
| `motionComplete` | `(motion: 'entering' \| 'exiting') => void` | Emitted when the motion finishes. The exit completion is what closes the `<dialog>` and hands focus back. |
| `snap` | `(visibleHeight: number) => void` | Emitted when a drag settles on a stop, with the sheet's visible height in pixels at that stop. |
| `element` | `HTMLDivElement \| null` | The panel element, exposed through a template ref. `class` and `style` land on this element. |
| `focus()` / `blur()` | `() => void` | Moves focus into or out of the panel. |

## BottomSheetSwitcher

A multi-step flow shares one dialog. `v-model:active-sheet` names the child `BottomSheet` `sheetId` that is current. The scrim stays while the page changes, and the previous sheet remains briefly underneath so the heights can line up. Set `activeSheet` to `null` to close the flow.

| Name | Type | Default | Description |
| --- | --- | --- | --- |
| `activeSheet` | `string \| null` | `null` | The current sheet's `sheetId`. Bind it with `v-model:active-sheet`. |
| `label` | `string` | The current sheet's `label` | Accessible name for the whole flow. |
| `purpose` | `BottomSheetPurpose` | The current sheet's `purpose` | How the whole flow can be dismissed. |
| `hasScrim` | `boolean` | `true` | Whether the flow has one scrim. It stays up across pages. |

- `cancel(event: Event)`: fires before the switcher acts on a native dialog cancel, such as Escape. Call `event.preventDefault()` to keep the flow open.

A child `BottomSheet` with `sheetId` no longer opens its own dialog. The switcher decides which one is visible.

## Native attributes

The root element is the panel <code>&lt;div&gt;</code> (class <code>astryx-bottom-sheet</code>), wrapped in a fixed-position <code>&lt;dialog&gt;</code>.

The following are passed to the panel element:

- HTML attributes.
- <code>aria-*</code> attributes, except <code>aria-label</code> and <code>aria-labelledby</code>, which name the dialog around it.
- <code>data-*</code> attributes.
- <code>class</code>.
- <code>style</code>.
