0.1.16 • Published 8 years ago

react-responsive-sidebar v0.1.16

Weekly downloads
113
License
ISC
Repository
github
Last release
8 years ago

react-responsive-sidebar npm version

A simple and elegant responsive sidebar component for react

Sidebar SidebarItem

Getting Started

This component works best as the outer most visual component in your app. You may wrap it in data container components, but it is not suggested to nest it within other visual elements for the time being.

import React from 'react';
import { render } from 'react-dom';
import { Sidebar, SidebarItem } from 'react-responsive-sidebar';
import YourAppContent from 'path/to/your/app/content'

const items = [
  <SidebarItem>Dashboard</SidebarItem>,
  <SidebarItem>Profile</SidebarItem>,
  <SidebarItem>Settings</SidebarItem>,
];

render (
  <Sidebar content={items}>
    <YourAppContent />
  </Sidebar>
, document.findElementById("render-target"))

Sidebar

PropertyTypeDefaultDescription
backgroundstring#009688background color of the sidebar
colorstring#ffftext color for sidebar items
backdropbooltrueshow a backdrop when sidebar is opened from collapsed state
closeOnBackdropClickbooltruecloses the sidebar when the backdrop is clicked
widthnumber300width of sidebar
breakPointnumber980breakpoint where the sidebar collapses (px)
toggleIconSizenumber28size of the toggle icon (px)
toggleIconColorstringbackgroundcolor of the icon that toggles the sidebar
contentarrayn/acontent to fill the sidebar with (SidebarItem, SidebarSelector)
onCollapsefuncn/aA function to call when the sidebar collapses/expands. Provides a boolean, true if collapsed, false if expanded.
onOpenfuncn/aA function to call when the sidebar is toggle. Provides a boolean, true of opened, false if closed.
onItemSelectedfuncn/aA function to call when an item is selected. will provide selected items props.
closeOnItemSelectbooltrueSets if the sidebar close when an item is selected
hoverHighlightstringrgba(255,255,255,0.15)Sets hoverHighlight prop on each item, unless directly specified on the item
activeHightlightstringrgba(255,255,255,0.2)Sets activeHightlight prop on each item, unless directly specified on the item

SidebarItem

PropertyTypeDefaultDescription
backgroundstringsidebar.backgroundbackground color, inherited from sidebar if not set manually
colorstringwhitetext and icon color
hrefstringn/awhere to go on click, react-router compatible but not required
leftIconelementn/aIcon used for the left side of the item. (react-icons is a great package for this)
rightIconelementn/aIcon used for the right side of the item. (react-icons is a great package for this)
textAlignstringleftalignment of the title within the item
hoverHighlightstringrgba(255,255,255,0.15)Background color of the item when hovered over
activeHightlightstringrgba(255,255,255,0.2)Background color of the item when in the active state (At its href)
onClickfuncn/aa function to call when the item is clicked
0.1.16

8 years ago

0.1.15

8 years ago

0.1.14

8 years ago

0.1.13

8 years ago

0.1.12

8 years ago

0.1.11

8 years ago

0.1.10

8 years ago

0.1.9

8 years ago

0.1.8

8 years ago

0.1.7

8 years ago

0.1.6

8 years ago

0.1.5

8 years ago

0.1.4

8 years ago

0.1.3

8 years ago

0.1.2

8 years ago

0.1.1

8 years ago

0.1.0

8 years ago