FloatingPanel
Floating panel component: a fixed bottom panel dragged by its header and snapped to the nearest anchor on release. All anchor geometry (percentage conversion, nearest anchor, snap decision, drag clamping) consumes the pure functions from @lh-ui/share/core/floating-panel; the viewport height comes from @/adapter/platform (innerHeight on H5, windowHeight on mini-programs), with zero uni API in the component layer. Serves filtering, detail hosting and bottom action scenarios.
Platform differences (registered): the viewport height is read via the platform adapter (
getLhWindowInfo:window.innerHeighton H5,uni.getWindowInfo().windowHeighton mini-programs); dragging is unified as touch events (identical on H5 and MP, coordinates fromtouches[0].clientY); the fixed positioning lives on the root node (the purified output of share styles/floating-panel), the height is carried by an inline style, and the--draggingmodifier disables the transition during the drag for a finger-following feel.
Basic usage
Default anchors are [60, '40%'] (60px and 40% of the viewport height):
<template>
<lh-floating-panel>
<view>Panel content</view>
</lh-floating-panel>
</template>Custom anchors
anchors is an array of heights: a number is px, a string like '40%' is a percentage of the viewport height; after release the panel snaps to the nearest anchor:
<lh-floating-panel :anchors="[120, 320, 560]" @change="onChange" />Controlled step (v-model)
Passing modelValue makes the panel controlled: pushing the step from outside syncs the panel height, and releasing a drag emits update:modelValue / change:
<lh-floating-panel v-model="index" :anchors="[80, 400]" />Header-only dragging
When contentDraggable (true by default) is false, only the header handle area responds to dragging and the content area (e.g. a scrolling list) no longer takes over the gesture:
<lh-floating-panel :content-draggable="false" :anchors="[100, 300]">
<scroll-view scroll-y>Long scrolling content</scroll-view>
</lh-floating-panel>Disabled and safe area
<lh-floating-panel disabled :anchors="[100, 300]" />
<lh-floating-panel :safe-area-inset-bottom="false" :anchors="[100, 300]" />Custom header
The header slot replaces the default handle (the slot content remains the drag area):
<lh-floating-panel :anchors="[100, 300]">
<template #header>
<view>Custom header</view>
</template>
</lh-floating-panel>Props
| Prop | Description | Type | Default |
|---|---|---|---|
| anchors | Snap height array (px numbers or 'percentage' strings) | `(number | string)[]` |
| modelValue | Current snap step index (controlled) | number | — |
| contentDraggable | Content area draggable | boolean | true |
| safeAreaInsetBottom | Bottom safe area inset | boolean | true |
| disabled | Disable dragging | boolean | false |
| customClass | Custom class (forwarded to the root node) | string | — |
| sx | sx quick layout props | LhSxProps | — |
Events
| Event | Description | Callback args |
|---|---|---|
| update:modelValue | Step change (controlled sync) | (index: number) |
| change | Step change after release-snap | (index: number) |
| heightChange | Panel height change (drag tracking + snap) | (height: number) |
Slots
| Slot | Description |
|---|---|
| header | Header drag area (renders the __handle bar by default) |
| default | Panel content |
Accessibility
The root node carries the role="region" semantics; aria-label is produced by share core's getFloatingPanelAria ("Floating panel step i / N" by default), and aria-disabled is set when disabled.

