1.3.1 • Published 9 months ago

@figliolia/bottom-sheet v1.3.1

Weekly downloads
-
License
-
Repository
github
Last release
9 months ago

Bottom Sheet

A responsive bottom sheet for react applications. This bottom sheet will morph into a more standard modal appearance when the screen size is above that of a typical mobile device

Installation

npm i @figliolia/bottom-sheet
# or
yarn add @figliolia/bottom-sheet

Basic Usage

To create a bottom sheet, wrap your content in <BottomSheet/> tags and specify your options:

import { BottomSheet } from "@figliolia/bottom-sheet";

export const BottomSheetForm = ({ open, closeFN }: {
  open: boolean;
  closeFN: () => void;
}) => {
  return (
    <BottomSheet 
      dim 
      notch 
      open={open}
      close={closeFN}
      className="my-bottom-sheet">
      <form>
        <input type="text" placeholder="Enter a value:"/>
        <input type="submit">Submit</button>
      </form>
    </BottomSheet>
  );
}

You've now created a bottom sheet that'll morph into a modal on larger devices!

Options

OptionDefault ValueDescription
dimfalseWhether to dim the background when the bottom sheet is open
notchfalseWhether to display an iOS like swipe indicator on the top of the bottom sheet when viewing on mobile devices
clickOutsidetrueWhether clicking outside the bottom sheet will cause it to close
openfalseA trigger to open/close the bottom sheet
closeundefinedA callback to run when the bottom sheet is closed
classNameundefinedAn optional css class to apply to your bottom sheet
childrenundefinedContent elements you wish to render inside your bottom sheet
onScrollundefinedAn optional callback to execute when your bottom sheet is scrolled

Styling Tips

There are three CSS custom properties that can be accessed to easily theme your bottom sheets

--background: #fff; --notch-color: #d0cece; --backdrop-color: #00000082;

PropertyDefault ValueDescription
--sheet-background#fffThe color of your sheet
--notch-color#d0ceceThe color of the notch. Visible when notch={true}
--backdrop-color#00000082The color of the backdrop behind the sheet. Visible when dim={true}

Browser Support

This package relies on CSS Custom Properties in order to function. For more detailed information on specific browser version support, please reference the CSS Custom Properties support table.

1.2.0

9 months ago

1.1.9

9 months ago

1.2.3

9 months ago

1.3.1

9 months ago

1.2.2

9 months ago

1.3.0

9 months ago

1.2.1

9 months ago

1.1.8

9 months ago

1.1.1

10 months ago

1.1.0

10 months ago

1.1.7

9 months ago

1.1.6

10 months ago

1.1.5

10 months ago

1.1.4

10 months ago

1.1.3

10 months ago

1.0.3

10 months ago

1.0.2

10 months ago

1.0.1

10 months ago

1.0.0

10 months ago