Socket
Socket
Sign inDemoInstall

@frontle/bottomsheet

Package Overview
Dependencies
0
Maintainers
2
Versions
12
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @frontle/bottomsheet

Bottom sheet UI available in Vanilla JS


Version published
Maintainers
2
Install size
345 kB
Created

Readme

Source

Frontle Logo

The easiest multi-platform SPA framework.

NPM Version Package License NPM Downloads

Description

Bottom sheet UI available in Vanilla JS

bottomSheetGif

Usage

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();

Install

Frontle

$ frontle install @frontle/bottomsheet --noBuild

Vanilla 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
-->

API

new BottomSheet(parents, html)

Create a bottom sheet object

const bottomSheet = new BottomSheet(
  "#app",
  '<button id="closeButton">close</button>'
);
.sheetClass
.contentsClass
.backgroundClass

Set the css class of a bottom sheet

bottomSheet.sheetClass = 'cssClassName';
bottomSheet.contentsClass = 'cssClassName1 cssClassName2';
bottomSheet.backgroundClass = '';
.height

Set bottom sheet height

bottomSheet.height = 50;
.startY

Set bottom sheet start y position

bottomSheet.startY = 0;
.backgroundClickExit

Set whether bottom sheet can be closed by clicking on bottom sheet background

bottomSheet.backgroundClickExit = true;
.beforeOpen

This lifecycle is executed before the bottom sheet is opened

bottomSheet.beforeOpen = (sheetID) => { console.log('before opened') }
.afterOpen

This lifecycle is executed after the bottom sheet is opened

bottomSheet.afterOpen = (sheetID) => { console.log('after opened') }
.beforeEnd

This lifecycle is executed before the bottom sheet closes

bottomSheet.beforeEnd = (sheetID) => { console.log('before closed') }
.afterEnd

This lifecycle is executed after the bottom sheet is closed

bottomSheet.afterEnd = (sheetID) => { console.log('after closed') }
.open()

Open bottom sheet

const sheetID = await bottomSheet.open();
.close(sheetID)

Close bottom sheet

await bottomSheet.close(sheetID);

People

The original author of @frontle/bottomsheet is MushStory

License

MIT

Keywords

FAQs

Last updated on 03 Jan 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc