Giter Site home page Giter Site logo

ematipico / redux-accordion Goto Github PK

View Code? Open in Web Editor NEW

This project forked from rorykermack/redux-accordion

0.0 3.0 0.0 4.55 MB

A reusable and customisable accordion component for react/redux

License: MIT License

JavaScript 99.41% HTML 0.52% CSS 0.06%

redux-accordion's Introduction

Redux Accordion Header Image

Redux Accordion

Need an accordion for your React and/or Redux project? Look no further. You can have a single or multiple instances running at one. Redux Accordion is a fully featured accordion component, built using react/redux with ECMAScript 6. Simple to set up, simple to use and most importantly hopefully as simple as possible to maintain and build upon.

Installation

npm install redux-accordion

Example

<Accordion
  {...this.props}
  uniqId={'testAccordion'}>

  <AccordionSection
   title="Section 1">
   {*/ Content Goes Here /*}
  </AccordionSection>

  <AccordionSection
   title="Section 2">
   {*/ Content Goes Here /*}
  </AccordionSection>

</Accordion>

Usage

Redux accordion uses a redux store to manage its state. However it also has the option to use local component state.

With the local component state option you can simply run npm install redux-accordion, include Accordion & AccordionSection and your good to go. The second requires you to hook up the actions and reducers to your app.

Sections:

Accordion

<Accordion
  {...this.props}
  uniqId={'testAccordion'}
  singleOpen={true}>

  {*/ Content Goes Here /*}

</Accordion>
  • You can set the uniqId if you want to apply an id to your accordion. This also specifies how this instance is referenced in the reducer (non-component version)
  • You can set singleOpen={true} if you want to limit the accordion to only open a single section at a time

AccordionSection

<AccordionSection
 title="Section 1">
 {*/ Content Goes Here /*}
</AccordionSection>
  • The title dictates what is displayed on the accordion bar
  • You can set openByDefault={true} if you want this section to be open by default

Installation with redux actions & stores

  • Clone git repo or run npm install redux-accordion
  • Connect the actions and reducer into your app (node_modules/redux-accordion/redux)
  • Include Accordion & AccordionSection.
  • Done. Accordions for everyone :)

Contributing

Everyone brings something awesome to the party so please contribute. If you have any suggestions give a shout on twitter to @reduxAccordion

  1. Fork it!
  2. Create your feature branch: git checkout -b my-new-feature
  3. Commit your changes: git commit -am 'Add some feature'
  4. Push to the branch: git push origin my-new-feature
  5. Submit a pull request :D

Credits

Created and maintained by @rorykermack

License

WTFPL (100% Open Source)

redux-accordion's People

Contributors

rorykermack avatar

Watchers

 avatar  avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.