The easiest multi-platform SPA framework.
Bottom sheet UI available in Vanilla JS
import { BottomSheet } from "../../browser_modules/@frontle/bottomsheet/index.js";
const bottomSheet = new BottomSheet(
"#app",
'<button id="closeButton">close</button>'
);
bottomSheet.height = 100;
bottomSheet.startY = -50;
bottomSheet.beforeOpen = (sheetId) => {
document.querySelector("#closeButton").onclick = () => {
bottomSheet.close(sheetId);
};
};
bottomSheet.open();Frontle
$ frontle install @frontle/bottomsheet --noBuildVanilla JS
<script src="https://cdn.jsdelivr.net/npm/@frontle/bottomsheet@1.0.3/dist/frontle_bottomsheet.min.js"></script>
<!-- sourcemap
https://cdn.jsdelivr.net/npm/@frontle/bottomsheet@1.0.3/dist/frontle_bottomsheet.min.js.map
-->Create a bottom sheet object
const bottomSheet = new BottomSheet(
"#app",
'<button id="closeButton">close</button>'
);Set the css class of a bottom sheet
bottomSheet.sheetClass = 'cssClassName';
bottomSheet.contentsClass = 'cssClassName1 cssClassName2';
bottomSheet.backgroundClass = '';Set bottom sheet height
bottomSheet.height = 50;Set bottom sheet start y position
bottomSheet.startY = 0;Set whether bottom sheet can be closed by clicking on bottom sheet background
bottomSheet.backgroundClickExit = true;This lifecycle is executed before the bottom sheet is opened
bottomSheet.beforeOpen = (sheetID) => { console.log('before opened') }This lifecycle is executed after the bottom sheet is opened
bottomSheet.afterOpen = (sheetID) => { console.log('after opened') }This lifecycle is executed before the bottom sheet closes
bottomSheet.beforeEnd = (sheetID) => { console.log('before closed') }This lifecycle is executed after the bottom sheet is closed
bottomSheet.afterEnd = (sheetID) => { console.log('after closed') }Open bottom sheet
const sheetID = await bottomSheet.open();Close bottom sheet
await bottomSheet.close(sheetID);The original author of @frontle/bottomsheet is MushStory

