Skip to content
IzzyBlazor

Enter all results ↑ ↓ move Esc close

VisuallyHidden

Since 0.1.0-alpha.24
Gives screen readers words the screen doesn't show.

Text screen readers read and the screen doesn't show, such as "per month" for a price shown as "$29 / month", or a word that finishes a sentence an icon starts. For a control's name, prefer the control's own Label.

Words for screen readers

Put words only screen readers need in a VisuallyHidden, such as "per month" for a price shown as "$29 / month", and hide the visible slash with aria-hidden. For a skip link, set Focusable, and it shows while it has focus.

Static

Preview

Team

For small teams getting started.

$29 per month

Code

Usage.razor
@* A plan's price, read as "$29 per month": the slash is hidden from screen readers, and the
   words they read instead are hidden from the screen. *@
<Card Title="Team" TitleLevel="3" Description="For small teams getting started." MaxWidth="Length.Rem(20)">
    <CardBody>
        <TextBlock>
            <TextBlock As="span" Size="TextSize.Xl4" Weight="FontWeight.Semibold" TabularNums>$29</TextBlock>
            <TextBlock As="span" Color="Color.Muted" aria-hidden="true"> / month</TextBlock>
            <VisuallyHidden> per month</VisuallyHidden>
        </TextBlock>
    </CardBody>
</Card>

Add this example to a page with the izzy CLI:

bash
izzy add component VisuallyHidden --at <file>:<line>

Mode support

What works in each mode, VisuallyHidden
FeatureStaticInteractive
EverythingYesYes

Static: static server-side rendering, with no circuit and no WebAssembly. Interactive: Server, WebAssembly or Auto.

Accessibility

  • It renders a span (or the element As names) clipped to one pixel, so screen readers, search and translation tools read it.
  • With Focusable, it shows when it or anything in it has focus, as a skip link does. AppShell has its own skip link.

Parameters

VisuallyHidden parameters
PropTypeDefault
AsThe element: span by default, so it fits inside text; div or h2 for a block or a hidden heading.string"span"
FocusableShows it while it or anything in it has focus, such as a skip link.boolfalse
ChildContentThe text, or the elements, to hide.RenderFragment?

See also

  • TextBlock: sets paragraphs, captions and labels in the library's text styles.
  • Heading: renders headings 1 to 6, with fluid sizes and section links.
  • Blocks that use it: Pricing.

Connection lost

Rejoining the server…