# List API

> Explore the API of Cimpress UI's list component.

Source: https://ui.cimpress.io/components/list/api/

## Import

Cimpress UI exports two list-related components:

- `OrderedList`: represents an ordered list of items, rendered as a numbered list
- `UnorderedList`: represents an unordered list of items, rendered as a bulleted list

```tsx
import { OrderedList, UnorderedList } from '@cimpress-ui/react';
```

## Text style

List text style can be customized using text style properties. All text and link content within a list will inherit the list style.

```tsx
import { ListItem, Stack, Text, UnorderedList } from '@cimpress-ui/react';

export default function Demo() {
  return (
    <Stack gap={8}>
      <Text as="p" tone="critical" variant="small">
        Please address the following errors:
      </Text>
      <UnorderedList tone="critical" variant="small">
        <ListItem>Password should be at least 8 characters long.</ListItem>
        <ListItem>Password should contain a special character.</ListItem>
      </UnorderedList>
    </Stack>
  );
}
```

## API reference

### OrderedList

Renders an ordered list of text items in a specified style.

See [list usage guidelines](https://ui.cimpress.io/components/list/).

- `ref`: `Ref<HTMLOListElement>`

  The `ref` type for this component.

**Props: `OrderedListProps`**

- `children` (required): `ReactNode`

  Text to display. Allows nesting other typography components.

- `id`: `string`

  The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

- `data-cim-style-root`: `boolean`

  Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.

- `UNSAFE_className`: `string`

  Sets the CSS className for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `UNSAFE_style`: `CSSProperties`

  Sets the CSS style for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `aria-label`: `string`

  Defines a string value that labels the current element.

- `aria-labelledby`: `string`

  Identifies the element (or elements) that labels the current element.

- `aria-describedby`: `string`

  Identifies the element (or elements) that describes the object.

- `aria-details`: `string`

  Identifies the element (or elements) that provide a detailed, extended description for the object.

- `startFrom`: `number`

  An integer to start numbering list items from.

- `variant`: `'small' | 'medium' | 'title-1' | 'title-2' | 'title-3' | 'title-4' | 'title-5' | 'title-6' | 'body' | 'body-semibold' | 'medium-semibold' | 'small-semibold'`

  Determines the visual variant of text.

- `fontStyle`: `'normal' | 'italic'`

  Whether the font should be styled with a normal or italic face.

- `textDecoration`: `'none' | 'underline' | 'strikethrough'`

  The kind of decorative line applied to the text.

- `tone`: `ForegroundTone`

  Determines the color tone of the text.

**Props: `StyleProps`**

- `margin`: `Responsive<Spacing | "auto">`

  The amount of margin applied to all edges of this component.

- `marginX`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the left and right edges of this component. Takes priority over `margin`.

- `marginY`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the top and bottom edges of this component. Takes priority over `margin`.

- `marginTop`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the top edge of this component. Takes priority over `marginY` and `margin`.

- `marginRight`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the right edge of this component. Takes priority over `marginX` and `margin`.

- `marginBottom`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the bottom edge of this component. Takes priority over `marginY` and `margin`.

- `marginLeft`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the left edge of this component. Takes priority over `marginX` and `margin`.

### UnorderedList

Renders an unordered list of text items in a specified style.

See [list usage guidelines](https://ui.cimpress.io/components/list/).

- `ref`: `Ref<HTMLUListElement>`

  The `ref` type for this component.

**Props: `UnorderedListProps`**

- `children` (required): `ReactNode`

  Text to display. Allows nesting other typography components.

- `id`: `string`

  The element's unique identifier. See [MDN](https://developer.mozilla.org/en-US/docs/Web/HTML/Global_attributes/id).

- `data-cim-style-root`: `boolean`

  Use this attribute to "claim" the component tree for exclusive Cimpress UI usage.

- `UNSAFE_className`: `string`

  Sets the CSS className for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `UNSAFE_style`: `CSSProperties`

  Sets the CSS style for the element. Only use as a **last resort**. Use style props instead.

  See [styling guide](https://ui.cimpress.io/dev-guides/styling/).

- `aria-label`: `string`

  Defines a string value that labels the current element.

- `aria-labelledby`: `string`

  Identifies the element (or elements) that labels the current element.

- `aria-describedby`: `string`

  Identifies the element (or elements) that describes the object.

- `aria-details`: `string`

  Identifies the element (or elements) that provide a detailed, extended description for the object.

- `variant`: `'small' | 'medium' | 'title-1' | 'title-2' | 'title-3' | 'title-4' | 'title-5' | 'title-6' | 'body' | 'body-semibold' | 'medium-semibold' | 'small-semibold'`

  Determines the visual variant of text.

- `fontStyle`: `'normal' | 'italic'`

  Whether the font should be styled with a normal or italic face.

- `textDecoration`: `'none' | 'underline' | 'strikethrough'`

  The kind of decorative line applied to the text.

- `tone`: `ForegroundTone`

  Determines the color tone of the text.

**Props: `StyleProps`**

- `margin`: `Responsive<Spacing | "auto">`

  The amount of margin applied to all edges of this component.

- `marginX`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the left and right edges of this component. Takes priority over `margin`.

- `marginY`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the top and bottom edges of this component. Takes priority over `margin`.

- `marginTop`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the top edge of this component. Takes priority over `marginY` and `margin`.

- `marginRight`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the right edge of this component. Takes priority over `marginX` and `margin`.

- `marginBottom`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the bottom edge of this component. Takes priority over `marginY` and `margin`.

- `marginLeft`: `Responsive<Spacing | "auto">`

  The amount of margin applied to the left edge of this component. Takes priority over `marginX` and `margin`.
