npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

react-responsive-sidebar

v0.1.16

Published

A simple responsive sidebar component for React

Downloads

651

Readme

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

|Property |Type |Default|Description| | -------- | ---- | ----- | --------- | |background|string|#009688|background color of the sidebar| |color|string|#fff|text color for sidebar items| |backdrop|bool|true|show a backdrop when sidebar is opened from collapsed state| |closeOnBackdropClick|bool|true|closes the sidebar when the backdrop is clicked| |width|number|300|width of sidebar| |breakPoint|number|980|breakpoint where the sidebar collapses (px)| |toggleIconSize|number|28|size of the toggle icon (px)| |toggleIconColor|string|background|color of the icon that toggles the sidebar| |content|array|n/a|content to fill the sidebar with (SidebarItem, SidebarSelector)| |onCollapse|func|n/a|A function to call when the sidebar collapses/expands. Provides a boolean, true if collapsed, false if expanded.| |onOpen|func|n/a|A function to call when the sidebar is toggle. Provides a boolean, true of opened, false if closed.| |onItemSelected|func|n/a|A function to call when an item is selected. will provide selected items props.| |closeOnItemSelect|bool|true|Sets if the sidebar close when an item is selected| |hoverHighlight|string|rgba(255,255,255,0.15)|Sets hoverHighlight prop on each item, unless directly specified on the item| |activeHightlight|string|rgba(255,255,255,0.2)|Sets activeHightlight prop on each item, unless directly specified on the item|

SidebarItem

|Property |Type |Default|Description| | -------- |:----:|:-----:| --------- | |background|string|sidebar.background|background color, inherited from sidebar if not set manually| |color|string|white|text and icon color| |href|string|n/a|where to go on click, react-router compatible but not required| |leftIcon|element|n/a|Icon used for the left side of the item. (react-icons is a great package for this)| |rightIcon|element|n/a|Icon used for the right side of the item. (react-icons is a great package for this)| |textAlign|string|left|alignment of the title within the item| |hoverHighlight|string|rgba(255,255,255,0.15)|Background color of the item when hovered over| |activeHightlight|string|rgba(255,255,255,0.2)|Background color of the item when in the active state (At its href)| |onClick|func|n/a|a function to call when the item is clicked|