---
title: A11yText
---

import LibraryInfo from '@theme/LibraryInfo'
import { Feedback, PropsTable } from '../../src/components'
import { A11yText as BaseDocs } from 'docs/@telus-uds/components-base'
import AvailableOnBoth from '../../partials/_platform-considerations-both.mdx'
import NoStylisticVariants from '../../partials/_variants-none.mdx'

# A11yText

<LibraryInfo />

```jsx live
<A11yText text="I'm read by screenreaders" />
```

## Introduction

A11yText is a zero-size invisible element that adds text to be read by screen readers.

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

## Guidance

Use `A11yText` to insert additional context for screenreader users within existing text content.

For example, there might be a link below some text. For sighted users, the text above
provides context for the link. However, screenreader users may be skipping to interactive
items and may therefore not be aware of this context on focusing the link:

```jsx live
<StackView space={2}>
  <Typography>The new MegaPhone is our loudest phone yet.</Typography>
  <Link href="https://telus.com">Buy today{<A11yText text=", MegaPhone" />}</Link>
</StackView>
```

In the above example, screenreaders read "Buy today, MegaPhone" on focusing the link.

Appending hidden text at the end of the element is the best practice for voice to text technology.

### Accessibility

Inside focusable interactive components, the `A11yText` text will be flattened alongside other text
into one focusable item.

`A11yText` fulfills a similar role to the React Native `accessibilityLabel` prop which is
available to most UDS components, but inserts itself inside text, rather than replacing
current text content.

Despite having a similar use case, React Native's `accessibilityHint` prop is not recommended
for use as it has inconsistent cross-platform behaviour and is not supported on web.

You can use the `role` prop to change the semantic meaning of the element.

### Platform considerations

<AvailableOnBoth />

## Props

<PropsTable base={BaseDocs} />

## Variants

<NoStylisticVariants />

This component is always invisible.

## Feedback

<Feedback component="A11yText" />
