1.0.9 • Published 3 years ago

react-simple-offcanvas v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
3 years ago

React Simple Offcanvas

React component for adding a hidden sidebars to your project. Simply this is a Bootstrap 5 Offcanvas component but without installing any dependencies.

NPM npm bundle size GitHub

Install

npm

npm i react-simple-offcanvas

Yarn

yarn add react-simple-offcanvas

Usage

import React from 'react'
import { OffcanvasProvider, Trigger, Offcanvas } from 'react-simple-offcanvas'

export default function App() {
  return (
    <OffcanvasProvider { /* Provider props */ }>
      <Trigger { /* Trigger props */ } />
      <Offcanvas { /* Offcanvas props */ } />
    </OffcanvasProvider>
  )
}

1. Provider Props

PropTypeOptionsDescriptionDefault
onOpenFunctionOptionalCallback function that is triggered when the Offcanvas is opened-
onCloseFunctionOptionalCallback function that is triggered when the Offcanvas is closed-

2. Trigger Props

PropTypeOptionsDescriptionDefault
componentStringOptionalRender Component button | divbutton
classNameStringOptionalCSS className applied to the Trigger Blockoffcanvas-trigger
stylesCSSPropertiesOptionalInline style{}
childrenReactNodeOptionalComponent children-

3. Offcanvas Props

PropTypeOptionsDescriptionDefault
titleStringOptionalOffcanvas Title (h5 Tag)Offcanvas Title
positionStringOptionalleft | right | top | bottomright
backdropbooleanOptionalApply a backdrop on body while offcanvas is opentrue
allowClickAwaybooleanOptionalCloses the offcanvas when user click outsidetrue
allowEscbooleanOptionalCloses the offcanvas when escape key is pressedtrue
allowScrollbooleanOptionalAllow body scrolling while offcanvas is opentrue
classNameStringOptionalCSS className applied to the Offcanvas Blocksimple-offcanvas
stylesCSSPropertiesOptionalInline style{}
childrenReactNodeOptionalComponent ChildrenSome text as placeholder

Edit react-simple-offcanvas

License

MIT © awran5