npm.io
0.18.0 • Published 3 years ago

@reach/visually-hidden

Licence
MIT
Version
0.18.0
Deps
1
Size
13 kB
Vulns
0
Weekly
0
Stars
6.0K

@reach/visually-hidden

Stable release MIT license

Docs | Source | Origin | Further reading

Provides text for screen readers that is visually hidden. It is the logical opposite of the aria-hidden attribute.

In the following example, screen readers will announce "Save" and will ignore the icon; the browser displays the icon and ignores the text.

import { VisuallyHidden } from "@reach/visually-hidden";

function Example() {
	return (
		<button>
			<VisuallyHidden>Save</VisuallyHidden>
			<span aria-hidden>💾</span>
		</button>
	);
}