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-configurable-accordion

v1.0.4

Published

A simple and configurable accordion component for React

Downloads

4

Readme

React Configurable Accordion

A customizable and animated React accordion component for easily creating toggleable content sections.

Installation

To install the react-configurable-accordion package, use the following npm command:

npm install react-configurable-accordion

Usage

First import the accordion and its styles

import Accordion from "react-configurable-accordion";
import "react-configurable-accordion/dist/style.css";

Then use it in your component

function App() {
  return (
    <>
      <Accordion
        title="Toggle"
        icon={<img src={chevronIcon} alt="accordion-toggle-icon" />}
        accordionStyle={{ borderRadius: "8px" }}
        contentStyle={{ paddingLeft: "0.75rem", paddingRight: "0.75rem" }}
        animationDuration="0.2s"
        animationTimingFunction="ease-in-out"
      >
        {/* The content can be anything */}
        <p>
          Lorem, ipsum dolor sit amet consectetur adipisicing elit. Magnam sed
          illum quod. Neque tempore repudiandae a eligendi ipsam commodi ipsum?
        </p>
      </Accordion>
    </>
  );
}

export default App;

Props

Props

title

  • Type: string
  • Description: The title of the accordion item.

icon

  • Type: React.ReactNode
  • Description: The icon to display next to the title.

isOpen

  • Type: boolean
  • Default: false
  • Description: A boolean to control whether the accordion is initially open or closed.

contentPosition

  • Type: "top" | "bottom"
  • Default: "bottom"
  • Description: The position of the content relative to the title.

rotateIcon

  • Type: boolean
  • Default: true
  • Description: A boolean to control whether the icon should rotate when the accordion is opened.

animate

  • Type: boolean
  • Default: true
  • Description: A boolean to control whether the accordion should animate when opened or closed.

animationDuration

  • Type: string
  • Default: "0.25s"
  • Description: The duration of the animation when the accordion item is opened or closed.

animationTimingFunction

  • Type: string
  • Default: "ease"
  • Description: The timing function to use for the animation.

accordionStyle

  • Type: React.CSSProperties
  • Description: An object of CSS properties to apply to the accordion.

contentStyle

  • Type: React.CSSProperties
  • Description: An object of CSS properties to apply to the content of the accordion item.

maxWidth

  • Type: string
  • Default: "300px"
  • Description: The maximum width of the accordion.
Feel free to customize the content as needed and add any additional sections or details that you think would be helpful for users of your component.