woocommerce/plugins/woocommerce-admin/packages/components/src/list
Sam Seay fc030fb007 Migrate the devdocs examples to Storybook CSF stories (https://github.com/woocommerce/woocommerce-admin/pull/5271)
Fixes woocommerce/woocommerce-admin#5234
2020-10-15 14:55:55 +13:00
..
stories Update @wordpress/base-styles and replace deprecated variables (https://github.com/woocommerce/woocommerce-admin/pull/4759) 2020-07-17 12:11:42 +12:00
test Add support for List item tags and link types (https://github.com/woocommerce/woocommerce-admin/pull/4287) 2020-05-07 11:52:49 -04:00
README.md Fetch component usage documentation from local README.md. 2019-09-06 11:52:18 -07:00
index.js Added key to generic items in list without one (https://github.com/woocommerce/woocommerce-admin/pull/4936) 2020-08-05 16:01:02 -03:00
style.scss Update @wordpress/base-styles and replace deprecated variables (https://github.com/woocommerce/woocommerce-admin/pull/4759) 2020-07-17 12:11:42 +12:00

README.md

List

List component to display a list of items.

Usage

const listItems = [
	{
		title: 'List item title',
		description: 'List item description text',
	},
	{
		before: <Gridicon icon="star" />,
		title: 'List item with before icon',
		description: 'List item description text',
	},
	{
		before: <Gridicon icon="star" />,
		after: <Gridicon icon="chevron-right" />,
		title: 'List item with before and after icons',
		description: 'List item description text',
	},
	{
		title: 'Clickable list item',
		description: 'List item description text',
		onClick: () => alert( 'List item clicked' ),
	},
];

<List items={ listItems } />

Props

Name Type Default Description
className String null Additional class name to style the component
items Array null (required) An array of list items

items structure:

  • after: ReactNode - Content displayed after the list item text.
  • before: ReactNode - Content displayed before the list item text.
  • className: String - Additional class name to style the list item.
  • description: String - Description displayed beneath the list item title.
  • href: String - Href attribute used in a Link wrapped around the item.
  • onClick: Function - Called when the list item is clicked.
  • target: String - Target attribute used for Link wrapper.
  • title: String - Title displayed for the list item.