Installation
- Bundle
- CDN
How it works
Attach a globalwindow.onSheetEvent function once, somewhere in your app. The native side calls it with the value of the tapped row, or null if the user dismissed the sheet. Then trigger the sheet with despia('actionsheet://?...').
items must be a JSON string, not an object. Each item needs both label (the displayed text) and value (the stable identifier passed to your callback, so prefer 'delete' over 'Delete Post').
window.onSheetEvent is a single global hook. If you have multiple call sites, reassign it right before each despia() call so the correct handler runs.
Icons
Icons are platform-specific. PassiconIos (an SF Symbol name) and iconAndroid (a Material drawable resource name) on the same item, the native side picks the right one per platform.
Destructive actions
Setdestructive: true on any item to render that row in red. Use this for delete, remove, leave, and other irreversible actions, the styling is the visual cue iOS users expect before tapping.
Force a theme
By default the sheet follows the operating system appearance. Passtheme: 'light' or theme: 'dark' to override.
light, dark, and system. Omit the param to default to system.
Resources
NPM Package
despia-native