Skip to content
ProLifetime access for $199, paid once, every future release included
Truffle UI

Accessibility

ProNew

A floating accessibility menu with text size, contrast, grayscale, highlighted links, a readable font, text spacing, a big cursor, paused animations, quick profiles and reset. Settings apply to the page or a container and are remembered.

Installation

pnpm dlx shadcn@latest add @viewport/accessibility

First time? Add the @viewport registry to components.json. Setup takes one minute.

Usage

The code behind the preview above comes with Truffle Pro.

Props

PropTypeDefault
targetReact.RefObject<HTMLElement | null>

The element the settings apply to. Defaults to the whole page.

—
position"bottom-left" | "bottom-right" | "top-left" | "top-right"

Corner the button sits in.

"bottom-left"
offsetnumber

Distance from the edges in pixels.

16
containedboolean

Positions the button inside the nearest `relative` parent instead of the window.

false
colorstring

Accent color of the button, the switches and the active profile.

"#1d64ec"
tone"tinted" | "plain"

`tinted` washes the panel in the accent color, `plain` keeps it neutral.

"tinted"
titlestring

Heading of the panel and name of the button.

"Accessibility"
profilesboolean

Hides the quick profiles and shows only the individual settings.

true
defaultOpenboolean

Opens the panel on first render.

false
storageKeystring | null

localStorage key the settings are kept under. Pass `null` to keep nothing.

"accessibility"
onChange(settings: AccessibilitySettings) => void

Called with all settings whenever one changes, e.g. to pause your own JavaScript animations.

—
classNamestring—

Accessibility

  • The button is named and opens a labelled, non-modal dialog; focus moves into it, Escape closes it and focus returns to the button.
  • Every setting is a labelled switch, profiles are toggle buttons with aria-pressed, and settings are grouped under headings.
  • The text size and a reset are announced politely; the stepper and reset buttons stay focusable when they have nothing to do, so focus is never dropped.
  • The page stays usable while the panel is open, so changes can be seen as they are made. Under reduced motion the panel and switches move at once.