SnapEvent
The snap point a sheet settled at, by index into its snapPoints.
Usage
React when a sheet reaches a snap point.
// React when a sheet reaches a snap point.
import { Sheet, Text, signal, type SnapEvent } from 'kuito';
const snapPoints = ['content', '90%'] as const;
const expanded = signal(false);
const open = signal(true);
// index points into snapPoints: 1 is '90%'.
const settled = (event: SnapEvent) => (expanded.value = event.index === 1);
<Sheet
open={open.value}
snapPoints={snapPoints}
onSnap={settled}
onClose={() => (open.value = false)}
>
<Text>{expanded.value ? 'All comments' : 'Top comments'}</Text>
</Sheet>;Type declaration
export interface SnapEvent extends KuitoEvent<'snap'>, IndexPayload {}Members 4
| Name | Type | Required | Description |
|---|---|---|---|
type | "snap" | Yes | — |
target | unknown | Yes | — |
isTrusted | boolean | Yes | — |
index | number | Yes | — |
Generated from the public TypeScript declarations: signatures, props and defaults come from the checked source, descriptions from its JSDoc. No defaults are invented.