0.7.9 • Published 2 months ago

@ausbom/accordion v0.7.9

Weekly downloads
80
License
MIT
Repository
github
Last release
2 months ago

@ausbom/accordion

Accordions are a list of sections that allow users to show or hide related content.

Try Accordion

Why

Accordions give quick access to options of content that are relevant to them.

When

Use accordions when you want to:

  • Give users options from a list of related items.
  • To shorten the page by condensing content into collapsable sections.
  • Choose between information in one place rather than on seperate pages.

How

Behaviour

Accordions should start with all sections closed. To open a section, select anywhere in the item button.

Users should be in control of the accordion state. If an accordion item is open when another accordion item is selected, then the original accordion item stays open.

Do

  • Always use an accordion for a list of related items.
  • Indicate an open accordion by changing the direction of the chevron (to point up) and the borders of the open accordion are blue.
  • Use the same text style for all accordion headings on a page or in a list.
  • Consider if there are there more appropriate alternatives, such as using In page anchor or showing the content on different pages or tabs.

Do not

  • Use an accordion for a single item.
  • Use accordions for short sections of content. Use simple headings to seperate this content instead.
  • Avoid using accordions to contain complex content such as graphs, tables or anything that might require horizontal scrolling.

Accessibility

Accordions need to be keyboard accessible as list items with a visible focus state.

Screen readers should read aloud all the text in the button as a single statement. There's also some visually hidden content in the heading text to help announce the call-to-action as "collapsed, button" or "expanded, button".

Installation

npm install @ausbom/accordion

API Docs

import Accordion, { AccordionItem } from '@ausbom/accordion'
import React from 'react'

<Accordion>
  <AccordionItem id="accordion-1" title="Lorem ipsum dolor">
    accordion-1 content
  </AccordionItem>
  <AccordionItem
    id="accordion-2"
    isOpen
    title="Lorem ipsum dolor sit amet"
  >
     accordion-2 content
  </AccordionItem>
  <AccordionItem id="accordion-3" title="Lorem ipsum">
     accordion-3 content
  </AccordionItem>
  <AccordionItem id="accordion-4" title="Lorem ipsum dolor">
     accordion-4 content
  </AccordionItem>
  <AccordionItem id="accordion-5" title="Lorem ipsum dolor" subTitle="Lorem ipsum sub title">
     accordion-5 content
  </AccordionItem>
</Accordion>
0.7.9

2 months ago

0.7.8

4 months ago

0.7.7

4 months ago

0.7.6

8 months ago

0.7.5

8 months ago

0.7.2

10 months ago

0.7.4

10 months ago

0.7.3

10 months ago

0.7.1

11 months ago

0.6.17

1 year ago

0.7.0

1 year ago

0.6.14

1 year ago

0.6.16

1 year ago

0.6.15

1 year ago

0.6.12

2 years ago

0.6.13

2 years ago

0.6.10

2 years ago

0.6.11

2 years ago

0.6.7

2 years ago

0.6.9

2 years ago

0.6.8

2 years ago

0.6.6

3 years ago

0.6.5

3 years ago

0.6.3

3 years ago

0.6.2

3 years ago

0.6.4

3 years ago

0.6.1

3 years ago

0.6.0

3 years ago

0.5.3

3 years ago

0.5.2

3 years ago

0.5.1

4 years ago

0.5.0

4 years ago

0.4.14

4 years ago

0.4.13

4 years ago

0.4.12

4 years ago

0.4.11

4 years ago

0.4.10

4 years ago

0.4.9

4 years ago

0.4.8

4 years ago

0.4.7

4 years ago

0.4.6

4 years ago

0.4.5

4 years ago

0.4.4

4 years ago

0.4.3

4 years ago

0.4.2

4 years ago

0.4.1

4 years ago

0.4.0

4 years ago

0.3.1

4 years ago

0.3.0

4 years ago