• Stars
    star
    242
  • Rank 167,048 (Top 4 %)
  • Language
    JavaScript
  • License
    MIT License
  • Created over 9 years ago
  • Updated almost 2 years ago

Reviews

There are no reviews yet. Be the first to send feedback to the community and the maintainers!

Repository Details

Accessible react accordion component

react-sanfona

NPM info

Travis build status Depfu

React accordion component

giphy 1

Usage

Install via NPM:

npm install react-sanfona

Then:

import { Accordion, AccordionItem } from 'react-sanfona';

…

  render() {
    return (
      <Accordion>
        {[1, 2, 3, 4, 5].map(item => {
          return (
            <AccordionItem title={`Item ${item}`} expanded={item === 1}>
              <div>
                {`Item ${item} content`}
              </div>
            </AccordionItem>
          );
        })}
      </Accordion>
    );
  }

…

options / PropTypes

Accordion

Property Type Description Default
allowMultiple Boolean Allow multiple items to be open at the same time. false
isHovered Boolean Allow expanding an element after the mouse hovers an item. false
openNextAccordionItem Boolean Opens the next accordion item after the previous one is closed. Defaults first one as active and applies for each accordion item except the last one. false
className String Custom classname applied to root element null
style Object Inline styles applied to root element null
onChange Function Triggered when component updates and passes new state as an argument null
rootTag String Custom HTML tag used for root element 'div'
duration Number Open/close transition duration in milliseconds 300
easing String Open/close transition easing 'ease'

AccordionItem

Property Type Description Default
title String/ Object Text or Object to display in header. null
expanded Boolean If item body should be expanded or not false
onExpand Function Callback for when item is expanded null
onClose Function Callback for when item closes null
className String Custom classname applied to root item element null
bodyClassName String Custom classname applied to the accordion item body null
expandedClassName String Custom classname applied when accordion is expanded null
titleClassName String Custom classname applied to accordion item header text null
disabled Boolean If item should be disabled or not false
disabledClassName String Custom classname applied to accordion item header text when item is disabled null
rootTag String Custom HTML tag used for root element 'div'
titleTag String Custom HTML tag used for title element 'h3'
bodyTag String Custom HTML tag used for body element 'div'
duration Number Open/close transition duration in milliseconds 300
easing String Open/close transition easing 'ease'
slug String Slug key to allow indexing by a string

Styling with classnames

Classname Targets
react-sanfona Accordion container
react-sanfona-item AccordionItem container
react-sanfona-item-expanded AccordionItem container when expanded
react-sanfona-item-title AccordionItem header text
react-sanfona-item-body AccordionItem body container
react-sanfona-item-body-wrapper AccordionItem body children wrapper
react-sanfona-item-disabled AccordionItem is disabled

development

npm install

npm start // served on localhost:8080

npm test

More Repositories

1

react-viewport-slider

react-viewport-slider is a react component (obviously) that displays a sequence of contents using 100% of the viewport with and height.
JavaScript
146
star
2

canvas

Classe PHP para manipulação de imagens
PHP
69
star
3

twitter-bootstrap-admin

Admin interface using twitter bootstrap.
HTML
59
star
4

canvas2

New canvas PHP Class.
PHP
34
star
5

defprogramming.com

JavaScript
30
star
6

viewport-slider

ViewportSlider is a pure JavaScript implementation of Apple's product page showcase
JavaScript
26
star
7

vazajato.me

Página listando todas as reportagens publicadas até agora na #VazaJato.
JavaScript
23
star
8

umaescolhamuitodificil.com

Gráfico interativo mostrando a relação das frases de Bolsonaro durante a pandemia do novo coronavírus com o número de casos e mortes.
JavaScript
20
star
9

jquery-sticky-column

jQuery plugin that allow you add sticky sidebars to your content.
JavaScript
16
star
10

react-component-starter-kit

This is supposed to be a simple starter-kit for creating Open Source React Components
JavaScript
14
star
11

no-js

no-js aims to be a set of components for web apps and sites (such as modals, lightbox, tabs and menus) written purely using CSS, with no JavaScript.
CSS
10
star
12

defprogramming

Django app to show quotes about coding and programming.
Python
9
star
13

release

Release is a JavaScript plugin that enables the execution of an action after the user keeps the mouse pressed for a custom amount of time.
JavaScript
6
star
14

fillintheblanks

Javascript Fill In The Blanks generator
JavaScript
4
star
15

placar-do-impeachment

Saiba como seu deputado votaria se o impeachment de Jair Bolsonaro fosse hoje. Cobre seu representante.
JavaScript
4
star
16

tooltip.js

Simple tooltip, pure javascript.
CSS
4
star
17

util.php

A set of PHP utility/helper functions
PHP
4
star
18

chrome-defprogramming

This Chrome extension will show quotes about programming when you open a new tab.
CSS
3
star
19

jcrop_php

Exemplo de funcionamento do plugin jcrop com php.
PHP
3
star
20

daviferreira.github.com

GitHub Pages
JavaScript
3
star
21

vim

My vim files.
Vim Script
2
star
22

tableless

Artigos/Exemplos do Tabless
JavaScript
2
star
23

jquery_drag_and_drop

Exemplo de funcionamento de uma interface drag and drop com jQuery.
JavaScript
2
star
24

tissues

Issues/backlog manager
Ruby
2
star
25

funfou

Funfou - Site de perguntas e respostas voltado para profissionais de TI
Ruby
2
star
26

scroll-to-y

JavaScript
2
star
27

jslider

Vanilla Javascript image slider plugin
JavaScript
1
star
28

html5

Workshop de HTML5.
JavaScript
1
star
29

smartbar

smartbar is a sticky navbar/header that appears only when the user scrolls up
JavaScript
1
star
30

util.sh

Shell script utilities
Shell
1
star
31

lista_compras

Aplicação exemplo angular
JavaScript
1
star
32

chicostallone.com

Site do Chicão
JavaScript
1
star
33

jquery.fila

plugin jquery para manipular os primeiros e últimos ítens de elementos
JavaScript
1
star
34

msgTopo

Função JavaScript/jQuery para exibir uma mensagem no topo da página.
JavaScript
1
star
35

euler

Project Euler Solutions
Python
1
star
36

html5lab

Lab for HTML5/CSS3 stuff
1
star
37

python_challenge

Solutions for Python Challenge
Python
1
star
38

github-zen-chrome

This extension shows a random github zen text on new tabs.
CSS
1
star
39

portfolio-2k12

My personal site.
Ruby
1
star
40

canvas_site

Canvas class website
JavaScript
1
star
41

jquery.marcaTexto

Plugin jQuery para highlight em textos.
JavaScript
1
star
42

gimmelicious

Import bookmarks from delicious to gimmebar.
Ruby
1
star