List
Lists allow you to display short content in a bullet-point or numbered format.
Examples
- Apples
- Oranges
- Eggs
- Milk
- Nuts
- Bolts
- Cats
- Dogs
- Black
- White
- Work
- Fun
- Oil
- Water
- First
- Last
- Wake up
- Eat breakfast
- Brush teeth
- Go to sleep
- Code
- Debug
- Cook
- Eat
- Exercise
- Shower
- Work
- Play
import React from 'react';
import ReactDOM from 'react-dom';
import { List, ListItem } from 'furl-components';
ReactDOM.render(
<div>
<List listStyle='disc'>
<ListItem>Apples</ListItem>
<ListItem>Oranges</ListItem>
<ListItem>Strawberries</ListItem>
</List>
<List
ordered
listStyle='decimal'
data={[ 'Wake up', 'Eat breakfast', 'Go to work' ]}
/>
</div>,
document.getElementById('root')
);
API
Property | Description | Type | Default | ||
---|---|---|---|---|---|
ordered | render ordered list | boolean | false | ||
listStyle | list style | string | |||
data | list data source | array(string) |
Notes
- You can populate a list 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
List
only accepts children of theListItem
component type. data
only accepts an array of string values.ordered
determines if the rendered list is an unordered list (<ul>
) or an ordered list (<ol>
).listStyle
’s allowed values depend on the value ofordered
.listStyle
can be one of the following, whenordered
isfalse
:'circle'
,'disc'
,'square'
,'triangle'
,'checkmark'
,'xmark'
or emtpy/undefined.listStyle
can be one of the following, whenordered
istrue
:'decimal'
,'decimal-leading-zero'
,'lower-latin'
,'lower-roman'
,'upper-latin'
,'upper-roman'
or emtpy/undefined.