Skip to content
 
 

Repository files navigation

A11y Toggle

A tiny script (less than 1KB gzipped) to build accessible content toggles. You can try the live demo which also acts as a documentation.

a11y-toggle targets modern browsers and is not intended for Internet Explorer.

Install

npm install a11y-toggle

Import it from your JavaScript entry point:

import 'a11y-toggle';

You can also import the initializer directly when you need to initialize dynamically rendered markup:

import { initA11yToggle } from 'a11y-toggle';

initA11yToggle(document.querySelector('#new-content'));

For direct browser usage, use the generated IIFE build:

<script src="dist/a11y-toggle.iife.js" defer></script>

Tests

Vitest and jsdom are used to run DOM tests.

npm test

Build

npm run build

Releases

Packages

Used by

Contributors

Languages