Skip to main content

List: React

Lists are vertically organized groups of related text content marked with a bullet, a number, or an icon.

Installation

Before you can start using the @mediahuis/chameleon-react component, you’ll need to install it, for more information check: Getting started for developers.

With that done, you’re now ready to implement the component in your application.

import { List, ListItem } from '@mediahuis/chameleon-react';

export default function Example() {
return (
<List>
<ListItem>Example 1</ListItem>
<ListItem>Example 2</ListItem>
</List>
);
}

Properties

PropertyTypeDefaultRequiredDescription
as'ul' | 'ol'ulNoAllows setting the HTML element for the List component and controls its visual appearance.
childrenReactNode-NoThe contents displayed within the List component, typically consisting of ListItem components.
styleStyleProps-NoCustom styling on the List component.

Properties of ListItem

PropertyTypeDefaultRequiredDescription
accessibilityLabelString''NoSets the accessibility friendly label for the ListItem, which will not be shown visually.
childrenReactNode-NoThe content to be rendered within the ListItem component.
iconElementType-NoThe icon to be displayed in the ListItem component, which can be a functional component, a node, or an object.

icon

The icon property allows you to specify an icon to be used as a list-style. You can choose from a variety of icons outlined in the Icons documentation.