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
| 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
dataprop. Ifdatais provided, it will take precedence over passed children, therefore rendering only the content provided indata. - An
Accordiononly accepts children of theCollapsecomponent type. dataonly accepts an array of object values. Objects in thedataarray must contain atitleand acontentvalue. The latter can either be a string or an object, allowing you to pass React component trees.openIndexcan only be an integer between0and however many children ordatavalues the accordion has minus one (inclusive) - i.e. the zero-based index of the selected accordion item.fillcan be either'solid'or'flat'and will override thefillproperty of any of the component’s children.
