furl
Getting startedDesignComponents
Design
Design GuidelinesTypography SystemLayout SystemColor palettesCustomization
Components
ComponentsAccordionAlertAnchorAudioAvatarBadgeBreadcrumbsButtonButtonGroupCalendarCardCollapseContextButtonDividerDropdownFooterFormGraphGridHyperlinkIconIframeImageInputItemLayoutListLoaderMediaObjectMenuModalNotificationPaginationPopoverProgressSearchStepsSwitchTableTabsTooltipTypographyVideo

Accordion

Collapse allows users to show or hide grouped content.

Examples

1. How do I create an egg wash?

To create an egg wash, whisk together a large egg with one tablespoon of water until smooth. Use as a glue to seal pastries, then brush on top for a glossy appearance.

2. How do I easily peel tomatoes?

Peel tomatoes with ease! Cut an X in the top, and then simmer in a pot of hot water for 15 to 30 seconds. Cool down and the skin will fall right off.

1. How do I create an egg wash?

To create an egg wash, whisk together a large egg with one tablespoon of water until smooth. Use as a glue to seal pastries, then brush on top for a glossy appearance.

2. How do I easily peel tomatoes?

Peel tomatoes with ease! Cut an X in the top, and then simmer in a pot of hot water for 15 to 30 seconds. Cool down and the skin will fall right off.

import React from 'react';
import ReactDOM from 'react-dom';
import { Accordion, Collapse } from 'furl-components';

ReactDOM.render(
  <div>
    <Accordion>
      <Collapse title="1. How do I create an egg wash?">
        To create an egg wash, whisk together a large egg with one tablespoon of water until smooth. Use as a glue to seal pastries, then brush on top for a glossy appearance.
      </Collapse>
      <Collapse title="2. How do I easily peel tomatoes?">
        Peel tomatoes with ease! Cut an X in the top, and then simmer in a pot of hot water for 15 to 30 seconds. Cool down and the skin will fall right off.
      </Collapse>
    </Accordion>
    <Accordion 
      fill='flat' 
      openIndex={1}
      data={[
        {
          title: '1. How do I create an egg wash?',
          content: 'To create an egg wash, whisk together a large egg with one tablespoon of water until smooth. Use as a glue to seal pastries, then brush on top for a glossy appearance.'
        },
        {
          title: '2. How do I easily peel tomatoes?',
          content: 'Peel tomatoes with ease! Cut an X in the top, and then simmer in a pot of hot water for 15 to 30 seconds. Cool down and the skin will fall right off.'
        }
      ]}
    />
  </div>, 
  document.getElementById('root')
);

API

Accordion props
Property Description Type Default
openIndex accordion selected index int 0
fill accordion fill style string 'solid'
data accordion data source array(object)

Notes

  • You can populate an accordion either via passing children to it or via the use of the data prop. If data is provided, it will take precedence over passed children, therefore rendering only the content provided in data.
  • An Accordion only accepts children of the Collapse component type.
  • data only accepts an array of object values. Objects in the data array must contain a title and a content value. The latter can either be a string or an object, allowing you to pass React component trees.
  • openIndex can only be an integer between 0 and however many children or data values the accordion has minus one (inclusive) - i.e. the zero-based index of the selected accordion item.
  • fill can be either 'solid' or 'flat' and will override the fill property of any of the component’s children.

furl was designed and developed by Angelos Chalaris © 2019
Documentation generated using Gatsby, hosting by Netlify