Icon button name
Keep a text label available to assistive technology when only an icon is visible.
Components / Utilities
Visually hide text while keeping it available to assistive technology.
Last changed in version 0.13.0: Add avatar groups and chips, expand the block gallery, and improve component colors, spacing, and motion.
bunx --bun @getweini/cli@latest add visually-hiddenImport the files copied by the install command, then place the component in your Vue template. The text and values in the example belong to your app; change them to fit your task.
<script setup lang="ts">
import Button from './components/ui/button/Button.vue'
import VisuallyHidden from './components/ui/visually-hidden/VisuallyHidden.vue'
</script>
<template>
<Button variant="outline">
<span aria-hidden="true">×</span>
<VisuallyHidden>Close panel</VisuallyHidden>
</Button>
</template>Set focusable only when the hidden content itself must enter the tab order.
Keep a text label available to assistive technology when only an icon is visible.
Add a short explanation that visual layout already conveys.
A text node can name a button without displaying a second visible label.
<script setup lang="ts">
import Button from './components/ui/button/Button.vue'
import VisuallyHidden from './components/ui/visually-hidden/VisuallyHidden.vue'
</script>
<template>
<Button variant="outline">
<span aria-hidden="true">×</span>
<VisuallyHidden>Close panel</VisuallyHidden>
</Button>
</template>A hidden caption keeps table context without consuming visual space.
<script setup lang="ts">
import VisuallyHidden from './components/ui/visually-hidden/VisuallyHidden.vue'
</script>
<template>
<table>
<caption>
<VisuallyHidden>Quarterly revenue by region</VisuallyHidden>
</caption>
<thead>
<tr>
<th scope="col">Region</th>
<th scope="col">Revenue</th>
</tr>
</thead>
<tbody>
<tr>
<th scope="row">North</th>
<td>€120,000</td>
</tr>
</tbody>
</table>
</template>Every public prop, model, event, slot, and exposed member of the installed Vue parts is listed below. “Not set” means you can leave that value out; “Required” means you must provide it. Native HTML attributes also work where the component uses a native element.
| Name | Type or signature | Default | What it does |
|---|
// packages/frameworks/vue/components/visually-hidden/types.ts
// ------- TYPES -------
export interface VisuallyHiddenProps {
as?: 'span' | 'div'
focusable?: boolean
}