react-toolbox/components/list
Rubén Moya c462c0a8ff
Merge pull request #1630 from olegstepura/list-hover-animation
Add transition to hover effect in list items
2018-01-23 18:24:56 +01:00
..
List.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
List.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListCheckbox.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListCheckbox.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListDivider.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListDivider.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListItem.d.ts ListItem component theme prop extends ListItemTextTheme. 2017-09-05 11:26:12 +02:00
ListItem.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListItemAction.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListItemAction.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListItemActions.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListItemActions.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListItemContent.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListItemContent.js ListItem legend may be a node as well (#1496) 2017-07-13 20:20:33 +02:00
ListItemLayout.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListItemLayout.js fix #1611 (#1612) 2017-08-02 18:08:28 +02:00
ListItemText.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListItemText.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
ListSubHeader.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
ListSubHeader.js Importing PropTypes from prop-types rather than react (#1413) 2017-04-17 16:14:17 +02:00
config.css Migrate styles to PostCSS (#666) 2017-01-05 02:42:18 +01:00
index.d.ts Restructure typescript definitions (#1114) 2017-01-18 08:37:37 +01:00
index.js Update dependencies and linter (#1180) 2017-01-26 18:05:32 +01:00
readme.md small typo error corrected. 2017-11-23 13:07:09 +05:30
theme.css Add transition to hover effect in list items 2017-08-09 13:54:34 +02:00

readme.md

List

A list component consists of a single continuous column of tessellated sub-divisions of equal width called rows that function as containers for tiles. Tiles hold content, and can vary in height within a list.

Lists are best suited to presenting a homogeneous data type or sets of data types, such as images and text, optimized for reading comprehension with the goal of differentiating between like data types or qualities within a single data type. You can compose lists based on subcomponents.

import { List, ListItem, ListSubHeader, ListDivider, ListCheckbox } from 'react-toolbox/lib/list';

const ListTest = () => (
  <List selectable ripple>
    <ListSubHeader caption='Explore characters' />
    <ListItem
      avatar='https://placeimg.com/80/80/animals'
      caption='Dr. Manhattan'
      legend="Jonathan 'Jon' Osterman"
      rightIcon='star'
    />
    <ListItem
      avatar='https://placeimg.com/80/80/animals'
      caption='Ozymandias'
      legend='Adrian Veidt'
      rightIcon='star'
    />
    <ListItem
      avatar='https://placeimg.com/80/80/animals'
      caption='Rorschach'
      legend='Walter Joseph Kovacs'
      rightIcon='star'
    />
    <ListSubHeader caption='Configuration' />
    <ListCheckbox checked caption='Notify new comics' legend='You will receive a notification when a new one is published' />
    <ListDivider />
    <ListItem caption='Contact the publisher' leftIcon='send' />
    <ListItem caption='Remove this publication' leftIcon='delete' />
  </List>
);

If you want to provide styles via context to this components, you should use the key RTList.

List

Is used as a wrapper for the list. It can hold properties that affect to the whole list and get styles for the wrapper.

Properties

Name Type Default Description
className String '' Sets a class to give custom styles to the list wrapper.
ripple Boolean false If true, each element in the list will have a ripple effect on click
selectable Boolean false If true, the elements in the list will display a hover effect and a pointer cursor.

Theme

Name Description
list Used for the root element of the list.

List Item

Represents a list item that can have avatar, icons, title, subtitle, etc. Note: you have to set it as an inmediate child of List component.

Properties

Name Type Default Description
avatar String or Element A string URL to specify an avatar in the left side of the item.
caption String or Element Main text of the item.
className String '' Set a class to give custom styles to the list item.
disabled String false If true, the item is displayed as disabled and is not clickable.
itemContent Element An element that will be displayed as the item. If set, this will override caption and legend.
leftActions Array of Elements A list of elements that are placed on the left side of the item and after the avatar attribute.
leftIcon String or Element A string key of a font icon or element to display an icon in the left side of the item.
legend String or Element Secondary text to display under the caption.
onClick Function Callback that is invoked when the item is clicked if it's not disabled.
rightIcon String or Element The same as the leftIcon but in this case the icon is displayed in the right side.
rightActions Array of Elements A list of elements that are placed on the right side of the item and after the rightIcon attribute.
ripple Boolean false If true, the item displays a ripple effect on click. By default it's inherited from the parent element.
selectable Boolean false If true, the elements in the list will display a hover effect and a pointer cursor. Inherited from the parent.
to String In case you want to provide the item as a link, you can pass this property to specify the href.

Theme

Name Description
disabled Added to the inner content if its a disabled item.
item Used for the inner content of a list item.
itemAction Used for each action element (left/right).
itemContentRoot Used for the content wrapper element in list item.
itemText Added to the text inside of the list item.
large Added to the content wrapper element if size is large.
left Added for the element that wraps left actions.
listItem Used for the root element of the list.
primary Added to the text inside of the list item if its primary.
right Added for the element that wraps right actions.
selectable Added to the inner content if its a selectable item.

List Checkbox

A special type of item that has a checkbox control on the left side. It implements similar methods to the ListItem component and some additional to control the checkbox.

Properties

Name Type Default Description
caption String Main text of the item. Required.
className String Set a class to give custom styles to Component.
checked Boolean false If true the checkbox appears checked by default.
disabled String false If true, the item is displayed as disabled and it's not clickable.
legend String Secondary text to display under the caption.
name String Name for the checkbox input item.
onBlur Function Callback called when the input element is blurred.
onChange Function Callback called when the input element is changed.
onFocus Function Callback called when the input element is focused.

Theme

Name Description
checkbox Used as a wrapper class for the subheader element.
checkboxItem Added to the checkbox element.
disabled Added to the root element if the component is disabled.
item Used as a wrapper class root element element. Same as List.
itemContentRoot Used for the content wrapper element in list item.
itemText Added to the text inside of the list item.
large Added to the content wrapper element if size is large.
primary Added to the text inside of the list item if its primary.

List Subheader

Simple subcomponent used to give a title to a list area.

Properties

Name Type Default Description
caption String Text that will be displayed.
className String '' Set a class to give custom styles to the list subheader.

Theme

Name Description
subheader Used as a wrapper class for the subheader element.

List Divider

Simple subcomponent used to separate list sections or items. It has only one property inset which is a Boolean that indicates if the divider should be full with or should leave an space to the left side. It has two theming keys: inset and divider that will be used depending on wether it should full width or leave space.