Marigold
v18.0.0-beta.4
Marigold
v18.0.0-beta.4

Application

MarigoldProvider
RouterProvider

Layout

AppShellbeta
Aside
Aspect
Center
Columns
Container
Grid
Inline
Inset
Pagebeta
Panelbeta
Scrollable
Split
Stack
Tiles

Actions

Buttonupdated
ButtonGroupbeta
Link
LinkButton
ToggleButtonbeta

Form

Autocomplete
Calendar
Checkbox
ComboBox
DateField
DatePicker
DateRangePickerbeta
FileField
Form
NumberField
Radio
RangeCalendaralpha
SearchField
SegmentedControlbeta
Select
SelectListupdated
Slider
Switchupdated
TagFieldbeta
TextArea
TextField
TimeField

Collection

Cardupdated
Table
Tag
ActionBaralpha

Navigation

Accordion
Breadcrumbs
Pagination
Sidebarbeta
Tabs
TopNavigationbeta

Overlay

ActionMenualpha
ContextualHelp
Dialog
Drawer
Menuupdated
Toastbeta
Tooltip

Content

Badge
Descriptionalpha
Divider
EmptyStatebeta
ErrorStatebeta
Headline
Keyboardbeta
List
Loader
SectionMessage
SVG
Text
TextValuealpha
Titlealpha

Formatters

DateFormat
NumericFormat

Hooks and Utils

cn
cva
extendTheme
parseFormData
useAsyncListData
useLandmark
useListData
useTheme
VisuallyHidden
Components

VisuallyHidden

Hide children but keep content accessible

<VisuallyHidden> is a component that visually hides its children while keeping them accessible to screen readers and assistive technologies.

This is especially useful when you want to preserve the native behavior and semantics of elements like checkboxes or radio buttons, but visually replace them with custom-styled components.

Anatomy

The <VisuallyHidden> contains of a simple <div> element, where you can add children.

Appearance

<label style={{ position: 'relative' }}>
  <VisuallyHidden>
    <input type="checkbox" />
  </VisuallyHidden>
  <span>Subscribe to our newsletter</span>
</label>

Usage

You should use <VisuallyHidden> when you want to make information available to screen reader users without displaying it visually on the screen.

This is especially useful for accessibility purposes, such as labeling icon-only buttons, adding helpful instructions to form fields, or including context like headings or descriptions that assist navigation for screen reader users. By doing so, you ensure your interface remains clean and visually simple for sighted users while still being fully accessible and understandable for those relying on assistive technologies.

Start your screenreader and tab to the button to hear how the component can support.
import { Button, Stack, VisuallyHidden } from '@marigold/components';import { Delete } from '@marigold/icons';export default () => (  <Stack space={5}>    Start your screenreader and tab to the button to hear how the component can    support.    <Button type="button" variant="destructive">      <Delete aria-hidden="true" />      <VisuallyHidden>Delete item</VisuallyHidden>    </Button>  </Stack>);

Do

Use VisuallyHidden to add meaningful accessibility enhancements.

Don't

Don't use <VisuallyHidden> to compensate for poorly labeled or structured elements. Fix the design instead.

Supplemental context

Sometimes you need to include additional context that isn't necessary to show visually but is important for users who rely on screen readers. For example, this could be clarifying instructions, status updates, or descriptions that help non-visual users understand what's happening on the page.

Using a visually hidden element ensures that this information is announced by assistive technologies without disrupting the visual layout or overwhelming sighted users with extra text.

<VisuallyHidden>All fields marked with * are required.</VisuallyHidden>

Props

Did you know? You can explore, test, and customize props live in Marigold's storybook. Watch the effects they have in real-time!
View VisuallyHidden stories

The <VisuallyHidden> component accepts standard HTML element props since it's a wrapper around a <div> element. It accepts all standard React props like children, className, and other HTML attributes.

Last update: 2 months ago

useTheme

Hook that applies a theme

App Frame

A composition pattern for building the application frame with persistent sidebar navigation, a top bar, and scrollable content.

On this page

AnatomyAppearanceUsageSupplemental contextProps