Version 0.11.2

VisuallyHidden

Visually hides content while keeping it accessible to screen readers.

This text is followed by a paragraph that is visually hidden but accessible to screen readers. Try using a screen reader to hear it, or inspect the DOM to see it's there.

This content is visually hidden but accessible to screen readers

Usage#

import { VisuallyHidden } from '@backstage/ui';

<VisuallyHidden>
  This content is visually hidden but accessible to screen readers
</VisuallyHidden>

API reference#

PropTypeDefaultDescription
children
ReactNode
-Content to hide visually while remaining accessible to screen readers.
className
string
-Additional CSS class name for custom styling.
style
CSSProperties
-Inline CSS styles object.

This component also accepts all standard HTML div attributes.

Examples#

Hidden headings#

<Flex direction="column" gap="4">
  <VisuallyHidden>
    <Text as="h2">Footer links</Text>
  </VisuallyHidden>
  <Text as="p">
    <a href="#">About us</a>
  </Text>
  <Text as="p">
    <a href="#">Jobs</a>
  </Text>
  <Text as="p">
    <a href="#">Terms and Conditions</a>
  </Text>
</Flex>

Theming#

Our theming system is based on a mix between CSS classes, CSS variables and data attributes. If you want to customise this component, you can use one of these class names below.

  • bui-VisuallyHidden

Changelog#

Version 0.9.0#

Changes

  • Added new VisuallyHidden component for hiding content visually while keeping it accessible to screen readers. #31484