Visually Hidden
Alignment target:@astryxdesign/core v0.7.1 · VisuallyHidden
What you see
What a screen reader hears
Download, button Share, button Delete, button
Actions available: Download, Share, Delete.
Usage #
Import VisuallyHidden from its dedicated entry. The default slot is required:
Vue
<script setup lang="ts">
import { VisuallyHidden } from '@astryx-vue/core/VisuallyHidden'
</script>
<template>
<a href="/articles/accessibility">
Read more
<VisuallyHidden> about accessibility primitives</VisuallyHidden>
</a>
</template>Best practices #
| Guidance | Practices |
|---|---|
| Do | Use to give icon-only buttons and controls an accessible name that screen readers announce. |
| Do | Render as a block element (as="div") with aria-live to announce dynamic updates like drag-and-drop or result counts. |
| Don't | Use it to hide content from everyone; it stays in the accessibility tree; use conditional rendering or hidden to remove content entirely. |
| Don't | Put interactive controls inside it; the content is not visible and cannot receive pointer input. |
Examples #
Visually Hidden — Live region
Drag-and-drop and other visual-only changes are silent to screen readers. A live region narrates them.
Task is in Backlog
Task moved to Backlog
When the task moves to the next column, aria-live reads the new place. People who can see the label do not need that sentence.
Visually Hidden — Structural heading
The layout makes this group obvious to sighted users. A hidden heading gives screen-reader users the same landmark to jump to.
Build status
astryx-corePassing
astryx-chartsFailing
astryx-cliPassing
The group is obvious on screen and has no visible heading. A hidden h2 gives screen-reader users a landmark to jump to.
Visually Hidden — Supplementary context
Revenue$48.2k
+12% increase from last month
Churn2.1%
-4% decrease from last month
The arrow is decoration. Whether the number went up or down is written in VisuallyHidden for a screen reader.