Tabs
Tabs display content in tabbed views.
Examples
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.
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.
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.
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 { Tabs, Tab } from 'furl-components';
ReactDOM.render(
<div>
<Tabs>
<Tab 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.
</Tab>
<Tab 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.
</Tab>
</Tabs>
<Tabs
controlStyle='button-group'
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 | tabs selected index | int | 0 | ||
controlStyle | tabs control style | string | 'solid' | ||
data | tabs data source | array(object) |
Notes
- You can populate a tab view either via passing children to it or via the use of the
data
prop. Ifdata
is provided, it will take precedence over passed children, therefore rendering only the content provided indata
. - A
Tabs
component only accepts children of theTab
component type. data
only accepts an array of object values. Objects in thedata
array must contain atitle
and acontent
value. The latter can either be a string or an object, allowing you to pass React component trees.openIndex
can only be an integer between0
and however many children ordata
values the tab view has minus one (inclusive) - i.e. the zero-based index of the selected tab.controlStyle
can be either'normal'
or'button-group'
.