---
title: Toast
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, TokensTable, PropsTable } from '../../src/components'
import { Toast } from '@telus-uds/components-web'
import { Toast as WebDocs } from 'docs/@telus-uds/components-web'
import AvailableOnWebOnly from '../../partials/_platform-considerations-web-only.mdx'

# Toast

<LibraryInfo
  packageType="Web Component"
  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%3D7299%253A130072"
/>

```jsx live
<Toast toast copy="Shoping Smartphones?" />
```

## Introduction

```jsx
import { Toast } from '@telus-uds/components-web'
```

Use Toast to display important content and focus attention.

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

## Guidance

- Select the size that best fits your context
  - Default (medium text)
  - Small (small, compact text)
- Use textAlign to set alignment explicitly
  - By default, text is left-aligned
  - When roundedCorners is set, text is center-aligned
- Use roundedCorners when showing Callout within content bounds
  - Don’t use roundedCorners when showing Callout full-width, edge-to-edge
- Use icon to show Icon

### Accessibility

If your toast is dynamically triggered, ensure that the content is appropriately marked up such that it will be announced by assistive technologies.
For example use an `aria-live` region.

```jsx live
function() {
  const [visible, setVisible] = useState(false)
  return (
    <StackView space={3}>
      <div aria-live={true}>
        {visible && <Toast toast copy="Shopping Smartphones?" />}
      </div>
      <Button onPress={() => setVisible(!visible)}>toggle toast</Button>
    </StackView>
  )
}
```

### Platform considerations

<AvailableOnWebOnly />

## Props

<PropsTable web={WebDocs} />

## Tokens

<TokensTable web={WebDocs} component="Toast" />

## Variants

### Headline

```jsx live
<Toast toast copy="Shopping Smartphones?" headline="Latest offers" />
```

### Link

```jsx live
<Toast toast copy="Shopping Smartphones?" link={{ href: '#', text: 'Get the latest deals' }} />
```

### Headline and Link

```jsx live
<Toast
  toast
  copy="Shopping Smartphones?"
  headline="Latest offers"
  link={{ href: '#', text: 'Get the latest deals' }}
/>
```

## Feedback

<Feedback component="Toast" />
