---
title: Icon
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { Icon } from '@telus-uds/components-web'
import { Icon as BaseDocs } from 'docs/@telus-uds/components-base'

# Icon

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

```jsx live
<Icon icon={Icons.EyeMasked} />
```

## Introduction

A wrapper for svg icons. Takes an icon from a [UDS palette](icons-allium), and renders it with theming applied.

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

## Guidance

Design guidance on the usage and choice of Iconography is given in the [Icons palette documentation](icons-allium) for each category of icons used in the
TELUS brand.

### Accessibility

- Pass an `accessibilityLabel` for icons that have a meaning that should be communicated to the user.
  This will be used by assistive technology such as screen readers.
- Don't repeat content in an `accessibilityLabel` that is already present in text. If an icon's
  `accessibilityLabel` would simply repeat the text next to it, it is better to treat the icon as decorative.
- If the `accessibilityLabel` prop is not passed, the icon will treated as purely decorative and
  will be set as ignorable by assistive technology via the attribute `aria-hidden`.
- If an icon is to be included alongside text and has a meaning related to the text, pass the prop
  `scalesWithText` as true so that if a sighted users increases their device's text size, the icon also scales
  to a size similar to the size they find comfortable for reading.

### Platform considerations

In web-only projects, use the web palette build to import icons.

```jsx
import Users from '@telus-uds/palette-allium/build/web/icons/Users'
import { Icon } from '@telus-uds/components-web'

const icon = <Icon icon={Users} accessibilityLabel="Works on Web" />
```

In native apps and cross-platform projects, import the palette icons from the `rn` build instead of the `web` build.
This will select an svg icon for web, and a native svg icon for native platforms.

:::info
In order for this to work on native platforms, you will need to have `react-native-svg` installed as a dependency in your project.
:::

```jsx
import { Users } from '@telus-uds/palette-allium/build/rn/icons'
import { Icon } from '@telus-uds/components-base'

const icon = <Icon icon={Users} accessibilityLabel="Works on Web, iOS and Android" />
```

## Props

<PropsTable base={BaseDocs} />

## Tokens

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

## Variants

`Icon` has a fixed size and colour and does not automatically inherit sizes or colour from surrounding
text. Instead, components that use icons alongside text, such as `Link`, set the icon's size and colour
tokens explicitly, to complement the styles of each variant.

There are two variants generally available for icons used outside of such components (`Size` and `Color`):

### Size

- To change the size of an icon by setting the `size` variant to one of the following values: `micro`, `small`, `large`, `extraLarge` (with "normal" size being the default)

```jsx live
<StackView tokens={{ justifyContent: 'space-around' }} space={2} direction="row">
  <Icon icon={Icons.EyeMasked} variant={{ size: 'micro' }} />
  <Icon icon={Icons.EyeMasked} variant={{ size: 'small' }} />
  <Icon icon={Icons.EyeMasked} />
  <Icon icon={Icons.EyeMasked} variant={{ size: 'large' }} />
  <Icon icon={Icons.EyeMasked} variant={{ size: 'extraLarge' }} />
</StackView>
```

### Background

:::warning
`background` is considered deprecated as of August 21st, 2025 and will be removed after 6 months in one of the next major version upgrades. Please consider using `style` variant instead.
:::

- To change the background of an icon by setting the `background` variant and `padding` to one of the following values: `micro`, `small`, `large`, `extraLarge`

```jsx live
<>
  <StackView tokens={{ justifyContent: 'space-around' }} space={2} direction="row">
    <Icon icon={Icons.EyeMasked} variant={{ background: true, padding: 'micro' }} />
    <Icon icon={Icons.EyeMasked} variant={{ background: true, padding: 'small' }} />
    <Icon icon={Icons.EyeMasked} variant={{ background: true, padding: 'medium' }} />
    <Icon icon={Icons.EyeMasked} variant={{ background: true, padding: 'large' }} />
    <Icon icon={Icons.EyeMasked} variant={{ background: true, padding: 'extraLarge' }} />
  </StackView>
  <StackView tokens={{ justifyContent: 'space-around' }} space={2} direction="row">
    <Icon icon={Icons.EyeMasked} variant={{ padding: 'micro' }} />
    <Icon icon={Icons.EyeMasked} variant={{ padding: 'small' }} />
    <Icon icon={Icons.EyeMasked} variant={{ padding: 'medium' }} />
    <Icon icon={Icons.EyeMasked} variant={{ padding: 'large' }} />
    <Icon icon={Icons.EyeMasked} variant={{ padding: 'extraLarge' }} />
  </StackView>
</>
```

### Style

```jsx live
<Box variant={{ background: 'lighter' }} space={4}>
  <StackView tokens={{ justifyContent: 'space-around' }} space={2} direction="row">
    <Icon icon={Icons.EyeMasked} variant={{ background: true, padding: 'large' }} />
    <Icon
      icon={Icons.EyeMasked}
      variant={{ background: true, style: 'brand', padding: 'large', color: 'inverse' }}
    />
    <Icon icon={Icons.EyeMasked} variant={{ background: true, style: 'dark', padding: 'large' }} />
    <Icon icon={Icons.EyeMasked} variant={{ background: true, style: 'light', padding: 'large' }} />
  </StackView>
</Box>
```

### Color

- To give an icon a more eye-catching purple colour, set variant `{ rank: 'primary' }`

| Code               | Description                                                 |
| ------------------ | ----------------------------------------------------------- |
| `color: 'Default'` | Use as the default decorative/interactions icon colour      |
| `color: 'Brand'`   | Use to add visual priority                                  |
| `color: 'Subtle'`  | Use to visually minimize or deprioritize                    |
| `color: 'Success'` | Use to indicate successful and positive meaning             |
| `color: 'Danger'`  | Use to indicate critical, destructive, and negative meaning |
| `color: 'Warning'` | Use to indicate caution                                     |
| `color: 'Inverse'` | Use to display icons on darker backgrounds                  |
| `color: 'Offer'`   | Use to add visual priority                                  |

```jsx live
<StackView tokens={{ justifyContent: 'space-around' }} space={2} direction="row">
  <Icon icon={Icons.EyeMasked} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'brand' }} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'default' }} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'subtle' }} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'success' }} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'danger' }} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'warning' }} />
  <Icon icon={Icons.EyeMasked} variant={{ color: 'offer' }} />
  <div style={{ backgroundColor: 'black', padding: 2 }}>
    <Icon
      icon={Icons.EyeMasked}
      variant={{ color: 'inverse' }}
      tokens={{ BackgroundColor: 'black' }}
    />{' '}
  </div>
</StackView>
```

### Rank

:::info
This is a deprecated variant that achieves the same purpose of adding visual priority as `variant={{color:`Brand`}}`. Please use the variant color whenever possible.
:::

- To give an icon a more eye-catching purple colour, set variant `{ rank: 'primary' }`

```jsx live
<StackView space={2} direction="row">
  <Icon icon={Icons.EyeMasked} />
  <Icon icon={Icons.EyeMasked} variant={{ rank: 'primary' }} />
</StackView>
```

Consult with the TELUS brand team if you wish to use other icon styles for a custom component.
It is technically possible via the `tokens` prop but the brand team should be consulted to ensure
the desired design is not off-brand or inconsistent.

## Feedback

<Feedback component="Icon" />
