Import the component.
<script setup lang="ts">
import { AVisuallyHidden } from 'akar';
</script>
<template>
<AVisuallyHidden>
<slot />
</AVisuallyHidden>
</template>
Use the visually hidden primitive.
<script setup lang="ts">
import { GearIcon } from '@radix-icons/vue';
import { AVisuallyHidden } from 'akar';
</script>
<template>
<button>
<GearIcon />
<AVisuallyHidden>Settings</AVisuallyHidden>
</button>
</template>
Anything you put inside this component will be hidden from the screen but will be announced by screen readers.
| Prop | Default | Type |
|---|---|---|
as | span | string | ComponentThe element or component the current element should render as. Can be overwrite by |
asChild | booleanChange the default rendered element for the one passed as a child, merging their props and behavior. |
This is useful in certain scenarios as an alternative to traditional labelling with aria-label or aria-labelledby.