---
title: Feedback
---

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

# Feedback

<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%3D435%253A2089" />

```jsx live
<Feedback>Here's some feedback</Feedback>
```

## Introduction

A feedback box commonly used with form fields. While its primary use is to facilitate feedback states for other form
components such as TextInput, you may use it standalone.

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

## Guidance

### Complex content

You may pass any React tree as the children of this component, bear in mind that a render function is better suited
for styling children based on `Feedback`'s variant.

```jsx live
<Feedback title="Instructions">
  <Typography>Provide a brief description of your issue</Typography>
</Feedback>
```

### Using a render function

When a function is passed for rendering content, it will receive the feedback text styles and variant as arguments.

```jsx live
<Feedback title="Feedback" validation="success" variant={{ icon: true }}>
  {({ variant, textStyles }) => (
    <Typography style={textStyles}>
      The variant of this feedback is {Object.keys(variant).join(',')}
    </Typography>
  )}
</Feedback>
```

### Accessibility

All accessibility props set on this component will be applied to the outer container.
By default using `validation="error"` will set the feedback's role to `"alert"`.

### Platform considerations

<AvailableOnBoth />

## Props

<PropsTable base={BaseDocs} />

## Tokens

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

## Variants

You can choose whether an icon should be shown by using the `icon` variant:

```jsx live
<>
  <Feedback validation="success" variant={{ icon: true }} title="Title">
    Everything went great!
  </Feedback>
  <Box top={4} bottom={4}>
    <Divider variant={{ decorative: true }} />
  </Box>
  <Feedback validation="error" variant={{ icon: true }} title="Title">
    Everything went wrong!
  </Feedback>
</>
```

:::info
An icon will only be rendered if the `title` prop is set.
:::

This component's appearance may change based on the `validation` prop.

```jsx live
<Feedback validation="success">Everything went great!</Feedback>
```

```jsx live
<Feedback validation="error">Something went wrong...</Feedback>
```

## Feedback

<DocsFeedback component="Feedback" />
