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-collapser

v1.5.10

Published

πŸ„β€β™‚οΈ β€’ fully controlled β€’ zero dependencies β€’ works out of the box β€’ other features

Downloads

334

Readme

πŸ„β€β™‚οΈ React-Collapser

Easy, fast and lightweight React collapse component for your <App />
Fully controlled, zero dependencies, works out of the box, has advanced features.
Made with functional components, hooks and latest React.

npm bundle size Build Status David Β  Storybook

Install

yarn add react-collapser
npm i react-collapser

Usage

import * as React from 'react'
import { Collapser, Trigger, Panel } from 'react-collapser'

<Collapser>
  <Trigger>About dogs</Trigger>
  <Panel>
    A dog is a type of domesticated animal. Known for its
    loyalty and faithfulness, it can be found as a welcome guest
    in many households across the world.
  </Panel>
</Collapser>

If you need default styles for collapser:

import 'react-collapser/dist/default-styles.css'

All possible variations of use on storybook

Why

Average size of most popular accordion packages are between 6.9 - 44.3kb (minified).
Most of their features are not in demand. Made with oldfashion classes.

Examples

react-collapser demo

Features

API

Collapser

| Property | Description | Type | Default | | ---------- | ----------------------------------------------- | ------- | ------------- | | alwaysOpen | Collapser have first always opened panel | Boolean | false | | alwaysOpen | Collapser have one always opened panel | Number | 0 | | reveal | Reveal all nested panels and triggers | Boolean | false | | controlled | Collpaser becomes fully controlled by this prop | Boolean | false | | animated | Initiate default animation | Boolean | false | | disabled | Disable whole collapser | Boolean | false | | onChange | Return state of collapser | Event | {activeIndex} |

Trigger / Panel

| Property | Description | Type | Default | | ---------- | --------------------------------------------------- | ------- | ------- | | controlled | Panel or Trigger component becomes fully controlled | Boolean | false | | disabled | Disable Trigger and linked to this Panel component | Boolean | false |

Β 


Β 

Development

yarn start - run Storybook for development on http://localhost:7000

yarn build - run Rollup to compile production build
yarn build-story - build Storybook for development

Made with:
https://github.com/toastyboost/storybook-starter
https://github.com/toastyboost/rollup-boilerplate

TODO

  • [ ] add tests
  • [ ] add typescript
  • [ ] resolve case with childs between trigger and panel
  • [ ] link features and story book
  • [ ] add gifs to most important features
  • [ ] add star motivation
  • [ ] add knobs
  • [ ] remove antd
  • [ ] add Docs addon to storybook
  • [ ] add labels in titles to duplicate states
  • [ ] add links from props table to storybook
  • [ ] add eslint ignore
  • [ ] auto copy styles to dist while build