@rafcin/visually-hidden

A React component that visually hides its content

Usage no npm install needed!

<script type="module">
  import rafcinVisuallyHidden from 'https://cdn.skypack.dev/@rafcin/visually-hidden';
</script>

README

@rafcin/visually-hidden

The visually hidden component styles itself so that it’s content is not visible, but it is available to assistive technologies like screen readers and other text to speech programs.

Installation

yarn add @rafcin/visually-hidden

# or

npm i @rafcin/visually-hidden

Import component

import { VisuallyHidden } from "@rafcin/visually-hidden"

Basic usage

// it renders a `span` by default
<VisuallyHidden>This content will be hidden on screen</VisuallyHidden>

// for visually hidden input fields
<VisuallyHiddenInput type="checkbox" defaultChecked/>

References