---
title: List
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { List, ListItem, Typography } from '@telus-uds/components-web'
import { List as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnBoth from '../../partials/_platform-considerations-both.mdx'

# List

<LibraryInfo figmaLink="https://www.figma.com/embed?embed_host=share&url=https%3A%2F%2Fwww.figma.com%2Ffile%2F4zJn2Qn6uXOqPP1GVDipy6%2F%25F0%259F%258D%2580-Allium-Components%3Fnode-id%3D2734%253A20920" />

```jsx live
<List>
  <ListItem>List Item</ListItem>
  <ListItem>List Item</ListItem>
  <ListItem>List Item</ListItem>
</List>
```

## Introduction

List component displays an unordered list.

[Follow the appropriate instructions](importing-components) to add this component in to your app.

## Guidance

:::info
ListItem can also be used with dot notation. E.g. `<List.Item />`.
This is useful when you want to import the List component without importing the subcomponents separately,
:::

- showDivider props display a divider between items
- List item accepts the following properties:
  - icon an SVG icon
  - iconSize defines the icon size in pixels
  - iconColor for a different color; it accepts the same values as the Icon color variants.
  - title prop can be used to display a list item heading above the children
- List item also accepts "Typography" or any other children components

### Display divider

```jsx live
<List showDivider>
  <ListItem>List item with divider</ListItem>
  <ListItem>List item with divider</ListItem>
  <ListItem>List item with divider</ListItem>
</List>
```

### Using Icons

```jsx live
<List showDivider variant={{ size: 'small' }}>
  <ListItem icon={Icons.EyeUnmasked}>List item with divider</ListItem>
  <ListItem icon={Icons.Add}>List item with divider</ListItem>
  <ListItem icon={Icons.EyeUnmasked}>List item with divider</ListItem>
</List>
```

```jsx live
<List showDivider variant={{ size: 'medium' }}>
  <ListItem icon={Icons.Add}>List item with divider</ListItem>
  <ListItem icon={Icons.EyeMasked}>List item with divider</ListItem>
  <ListItem icon={Icons.EyeUnmasked}>List item with divider</ListItem>
</List>
```

```jsx live
<List showDivider variant={{ size: 'large' }}>
  <ListItem icon={Icons.EyeUnmasked}>List item with divider</ListItem>
  <ListItem icon={Icons.Add}>List item with divider</ListItem>
  <ListItem icon={Icons.EyeMasked}>List item with divider</ListItem>
</List>
```

### Using Headings

```jsx live
<List showDivider>
  <ListItem icon={Icons.EyeUnmasked} title="Watch in glorious HD TV">
    Optik TV puts you in the middle of the action, with the highest picture quality available.
  </ListItem>
  <ListItem icon={Icons.EyeMasked} title="Must use TELUS purple">
    With a PVR capacity of 400 hours for HD and 100 hours for 4K, you’ll have lots of time to catch
    up.
  </ListItem>
  <ListItem icon={Icons.Add} title="Emphasize points">
    Did life get in the way of the game? Did you miss it all together? Replay up to 30 hours after
    it’s aired.
  </ListItem>
</List>
```

### Nested lists

- In order to maintain the correct spacing and alignment, the nested list should be wrapped within a new `List` component.
- If no `Icon` specified, the default `BulletFill` icon will be used.
- If no `IconColor` is specified, the default color will be used.

```jsx live
<List>
  <ListItem>First item</ListItem>
  <ListItem>
    With a PVR capacity of 400 hours for HD and 100 hours for 4K, you’ll have lots of time. Optik TV
    puts you in the middle of the action, with the highest picture quality available. With a PVR
    capacity of 400 hours for HD and 100 hours for 4K, you’ll have lots of time.
    <List>
      <ListItem icon={Icons.BulletCircle}>Nested list</ListItem>
      <ListItem icon={Icons.BulletCircle}>
        With a PVR capacity of 400 hours for HD and 100 hours for 4K, you’ll have lots of time.
        Optik TV puts you in the middle of the action, with the highest picture quality. With a PVR
        capacity of 400 hours for HD and 100 hours for 4K, you’ll have lots of time. Optik TV puts
        you in the middle of the action, with the highest picture quality.
      </ListItem>
      <ListItem icon={Icons.BulletCircle}>Third item</ListItem>
      <ListItem icon={Icons.BulletCircle}>Fourth item</ListItem>
    </List>
  </ListItem>
  <ListItem>Third item</ListItem>
  <ListItem>Fourth item</ListItem>
</List>
```

### Accessibility

`List` and `ListItem` adopt the semantics of `ul` and `li` respectively.

### Platform considerations

<AvailableOnBoth />

## Props

### List

<PropsTable base={BaseDocs} />

### ListItem

<PropsTable base={BaseDocs.Item} />

## Tokens

<TokensTable base={BaseDocs} component="List" />

## Variants

### Size

Lists are available in `small`, `medium` (default), and `large` sizes.

```jsx live
<List variant={{ size: 'small' }}>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
</List>
```

```jsx live
<List variant={{ size: 'medium' }}>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
</List>
```

```jsx live
<List variant={{ size: 'large' }}>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
</List>
```

### Compact

List is available in a `compact` variant.

```jsx live
<List variant={{ compact: true }}>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
  <ListItem>List item</ListItem>
</List>
```

## Feedback

<Feedback component="List" />
