0.4.1 • Published 2 years ago

@codeparticle/react-sidenav v0.4.1

Weekly downloads
76
License
ISC
Repository
github
Last release
2 years ago

This is a generic sidenav component.

It accepts a variety of props and is fully customizable.

import React, { Fragment } from 'react';
import Sidenav from '@codeparticle/react-sidenav';

const App = () => {
  return (
    <Fragment>
      <Sidenav
        backgroundColor='red'
        fixed={true}
        isOpen={true}
      >
        Sidenav content
      </Sidenav>
      <p>
        Basic usage
      </p>
    </Fragment>
  );
};

export default App;
Proptypedefaultdescription
animateWidthboolfalseIf true, animates the width of the sidenav instead of the left attribute
backgroundColorstring#FFFFFFBackground color of the sidenav container
classNamestringnoneClass name for the container
classNamesToIgnoreOutsideClickarray(string)[]If this className is in the click event path, the click will not close the sidenav
closeButtonColorstring#FFFFFFColor of the default close button icon
closeButtonIconReact ElementnoneDefines the icon to use for the close button
fixedbooleanfalseIf true, the sidenav will be fixed positioned instead of relative
hasCloseButtonbooleanfalseIf true, the side panel will have a close button
isOpenbooleanfalseToggle this property to open/close sidenav
onStateChangefuncnoneCallback function for when user clicks on the outside of the sidenav or clicks on the trigger
rightbooleanfalseIf true, the sidenav will appear on the right side of the screen instead of left
transitionSpeedstring0.3sSpeed for the css transition when closing/opening
triggerReact ElementnoneTrigger element for the sidenav. This takes precedence over triggerIcon
triggerIconReact ElementnoneIf this property is set, there will be a trigger button with this element inside of it
widthstring300pxWidth of the sidenamv
zIndexnumber10zIndex of the sidenav

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.