FloatingPanel
A fixed bottom floating panel: anchors (anchors) accept numeric px values and 'percentage' strings (converted against the viewport height). The header and content area (contentDraggable) drag with the finger (computeDragHeight + --dragging disables transitions), and on release the panel snaps to the nearest anchor (resolveSnapIndex). The anchor index supports a controlled modelValue; when unmanaged, an internal state is used as fallback.
Basic Usage
The default anchors are [60, '40%'] (40% is converted against the viewport height); the drag handle snaps between the lowest and highest anchors:
<script setup lang="ts">
import { ref } from 'vue'
import { LhFloatingPanel } from '@lh-ui/vue3'
// Unmanaged: the anchor index is kept inside the component; the change callback receives the index
const anchorIndex = ref(0)
</script>
<template>
<LhFloatingPanel @change="(i) => (anchorIndex = i)">
<div>Panel content</div>
</LhFloatingPanel>
</template>Controlled anchors (v-model)
Passing modelValue makes it controlled: on release only update:modelValue / change are emitted, and the anchor is up to the consumer; if the consumer does not update, the panel springs back to the current anchor:
<LhFloatingPanel v-model="anchorIndex" :anchors="[60, '40%']" />Custom anchors
Numbers and percentages can be mixed; they are converted, sorted ascending and deduplicated internally:
<LhFloatingPanel :anchors="[80, '30%', '70%']" />Header slot and options
The header slot overrides the default handle (the drag gesture still binds to the header); with contentDraggable=false only the header is draggable while the content area scrolls normally; safeAreaInsetBottom=false removes the bottom safe-area padding; disabled disables dragging:
<LhFloatingPanel :content-draggable="false">
<template #header>
<div class="custom-handle">Drag me to expand</div>
</template>
<div>Content</div>
</LhFloatingPanel>API
FloatingPanel Props
| Prop | Description | Type | Default |
|---|---|---|---|
| anchors | Snap height array (numeric px or 'percentage' strings; converted / sorted / deduplicated automatically) | (number | string)[] | [60, '40%'] |
| modelValue | Current anchor index (controlled; falls back to internal state when not passed) | number | — |
| contentDraggable | Content area draggable (when false, only the header is draggable) | boolean | true |
| safeAreaInsetBottom | Bottom safe-area padding (adds the --safe-area modifier) | boolean | true |
| disabled | Disable dragging | boolean | false |
| sx | sx quick-layout props | LhSxProps | — |
FloatingPanel Events
| Event | Description | Callback |
|---|---|---|
| update:modelValue | Anchor index change (v-model hook) | (index: number) |
| change | Anchor index change after a release snap | (anchorIndex: number) |
| heightChange | Panel height change (both drag-follow and snap paths) | (height: number) |
FloatingPanel Slots
| Slot | Description | Scoped props |
|---|---|---|
| header | Drag handle area (renders the __handle indicator bar by default; the drag gesture always binds to the header) | — |
| default | Panel content | — |
Accessibility
The root node's aria-label is generated by getFloatingPanelAria (custom first, otherwise "Floating panel, anchor i of N"); when disabled, the --disabled modifier cuts off pointer events.

