API Reference

AccessKitProvider

1 min read

AccessKitProvider

Wraps your app and supplies accessibility state (reduced motion, high contrast, focus, spacing, font size, dyslexia font, color vision) to the tree. Applies preferences to the document via data-accesskit-* attributes and CSS variables. Required for useAccessKit, the Widget, and the Dev Tool.

PropTypeDefaultRequiredDescription
defaultSettingsPartial<AccessKitSettings>-NoInitial values for preferences. Omitted keys use built-in defaults (e.g. reducedMotion: false, fontSize: 100). Use to ship with e.g. high contrast on or a different default font size.
storageKeystring"accesskit:settings"NoKey used to read and write settings in localStorage. Change it to namespace per app or avoid clashes.
persist booleantrueNoWhen true, user changes are saved to localStorage and restored on the next visit. Set to false to keep settings in memory only (e.g. kiosks or incognito flows).
onPersisterror(error: unknown) => void-NoCalled when writing settings to localStorage fails (e.g. quota exceeded, private browsing). Use to show a notification or log to an error service. In development, a console warning is also logged automatically.
focusColorstring-NoCSS color for the focus ring (e.g. " #0066cc"). Applied as --accesskit-focus-color on the document. Omit to use the default.