All Projects → thoughtbot → tailwindcss-aria-attributes

thoughtbot / tailwindcss-aria-attributes

Licence: MIT license
TailwindCSS variants for aria-* attributes

Programming Languages

javascript
184084 projects - #8 most used programming language

Projects that are alternatives of or similar to tailwindcss-aria-attributes

Vue Simple Suggest
Feature-rich autocomplete component for Vue.js
Stars: ✭ 324 (+252.17%)
Mutual labels:  accessibility, aria
Van11y Accessible Tab Panel Aria
ES2015 accessible tabs panel system, using ARIA
Stars: ✭ 58 (-36.96%)
Mutual labels:  accessibility, aria
Accessible components
Listing of accessible components & patterns
Stars: ✭ 393 (+327.17%)
Mutual labels:  accessibility, aria
van11y-accessible-hide-show-aria
ES2015 accessible hide-show system (collapsible regions), using ARIA
Stars: ✭ 34 (-63.04%)
Mutual labels:  accessibility, aria
Aria Query
Programmatic access to the ARIA specification
Stars: ✭ 129 (+40.22%)
Mutual labels:  accessibility, aria
Js Offcanvas
A lightweight, flexible jQuery off-canvas navigation plugin which lets you create fully accessible sidebar or top/bottom sliding (or push) panels with keyboard interactions and ARIA attributes.
Stars: ✭ 272 (+195.65%)
Mutual labels:  accessibility, aria
Accessibility Checklist
Stars: ✭ 41 (-55.43%)
Mutual labels:  accessibility, aria
alfa
♿ Suite of open and standards-based tools for performing reliable accessibility conformance testing at scale
Stars: ✭ 75 (-18.48%)
Mutual labels:  accessibility, aria
Skin
Pure CSS framework designed & developed by eBay for a branded, e-commerce marketplace.
Stars: ✭ 126 (+36.96%)
Mutual labels:  accessibility, aria
Accordion
Accordion module created in pure javascript & CSS. Very useful to create FAQ lists on your website.
Stars: ✭ 94 (+2.17%)
Mutual labels:  accessibility, aria
enabler
✋ Accessibility analyzer for your frontend.
Stars: ✭ 19 (-79.35%)
Mutual labels:  accessibility, aria
Eslint Plugin Jsx A11y
Static AST checker for a11y rules on JSX elements.
Stars: ✭ 2,609 (+2735.87%)
Mutual labels:  accessibility, aria
a11y tab widget
Accessible Tab Widget built with ARIA
Stars: ✭ 25 (-72.83%)
Mutual labels:  accessibility, aria
jquery-accessible-simple-tooltip-aria
jQuery accessible simple tooltip window, using ARIA
Stars: ✭ 22 (-76.09%)
Mutual labels:  accessibility, aria
jquery-accessible-modal-window-aria
jQuery simple and accessible modal window, using ARIA
Stars: ✭ 61 (-33.7%)
Mutual labels:  accessibility, aria
A11y tooltips
Accessible Tooltip Component
Stars: ✭ 35 (-61.96%)
Mutual labels:  accessibility, aria
jquery-accessible-dialog-tooltip-aria
jQuery simple and accessible dialog tooltip window, using ARIA
Stars: ✭ 17 (-81.52%)
Mutual labels:  accessibility, aria
jquery-accessible-carrousel-aria
jQuery Accessible Carrousel System, using ARIA
Stars: ✭ 40 (-56.52%)
Mutual labels:  accessibility, aria
Accessible Html Content Patterns
♿️ The full HTML5 Doctor Element Index as well as common markup patterns for quick reference.
Stars: ✭ 93 (+1.09%)
Mutual labels:  accessibility, aria
Accessible modal window
Accessible modal dialogs
Stars: ✭ 196 (+113.04%)
Mutual labels:  accessibility, aria

@thoughtbot/tailwindcss-aria-attributes

A plugin that provides variants for various aria-* attributes and their supported values.

Installation

Install the plugin from npm:

# Using npm
npm install @thoughtbot/tailwindcss-aria-attributes

# Using Yarn
yarn add @thoughtbot/tailwindcss-aria-attributes

Then add the plugin to your tailwind.config.js file:

// tailwind.config.js
module.exports = {
  theme: {
    // ...
  },
  plugins: [
    require("@thoughtbot/tailwindcss-aria-attributes"),
    // ...
  ],
}

Usage

There are two styles of attributes supported by the variants: boolean attributes, and enumerated values.

In some cases, attributes belong to both groups.

Boolean attributes

Variants for boolean attributes are active when the value is "true" and only "true". When the attribute is missing or the value is "false", its other applicable utility classes are applied.

Currently, the collection of variants includes support for the following boolean attributes:

Attribute Variant
aria-atomic="true" aria-atomic:
aria-busy="true" aria-busy:
aria-checked="true" aria-checked:
aria-current="true" aria-current:
aria-disabled="true" aria-disabled:
aria-expanded="true" aria-expanded:
aria-grabbed="true" aria-grabbed:
aria-haspopup="true" aria-haspopup:
aria-hidden="true" aria-hidden:
aria-invalid="true" aria-invalid:
aria-live="true" aria-live:
aria-modal="true" aria-modal:
aria-multiline="true" aria-multiline:
aria-multiselectable="true" aria-multiselectable:
aria-pressed="true" aria-pressed:
aria-readonly="true" aria-readonly:
aria-required="true" aria-required:
aria-selected="true" aria-selected:

To utilize a boolean variant, prefix the attribute name with aria- and omit the value:

<ul role="listbox">
  <li role="option" class="aria-selected:border">Not selected</li>
  <li role="option" class="aria-selected:border" aria-selected="true">Selected</li>
</ul>

<button class="aria-disabled:cursor-not-allowed" aria-disabled="true">Submit</button>

Enumerated values

Variants for enumerated values are active when the value is equivalent to the variant's suffix.

When the attribute is missing or the value does not match the specified suffix, its other applicable utility classes are applied.

Currently, the collection of variants includes support for the following attributes and value combinations:

Attribute Variants
aria-autocomplete aria-autocomplete-both:
aria-autocomplete-inline:
aria-autocomplete-list:
aria-autocomplete-none:
aria-current aria-current-date:
aria-current-location:
aria-current-page:
aria-current-step:
aria-current-time:
aria-dropeffect aria-dropeffect-copy:
aria-dropeffect-execute:
aria-dropeffect-link:
aria-dropeffect-move:
aria-dropeffect-none:
aria-dropeffect-popup:
aria-haspopup aria-haspopup-dialog:
aria-haspopup-grid:
aria-haspopup-listbox:
aria-haspopup-menu:
aria-haspopup-tree:
aria-orientation aria-orientation-horizontal:
aria-orientation-undefined:
aria-orientation-vertical:
aria-sort aria-sort-ascending:
aria-sort-descending:
aria-sort-none:
aria-sort-other:
aria-relevant aria-relevant-additions:
aria-relevant-all:
aria-relevant-removals:
aria-relevant-text:

To utilize an enumerated value variant, prefix the attribute name with aria- and include the value:

<nav>
  <a class="aria-current-page:font-bold" href="/" aria-current="page">Root</a>
  <a class="aria-current-page:font-bold" href="/about">About us</a>
</nav>

License

tailwindcss-aria-attributes is Copyright (c) 2021 thoughtbot, inc. It contains free software that may be redistributed under the terms specified in the LICENSE file.

About

thoughtbot

This project is maintained and funded by thoughtbot, inc. The names and logos for thoughtbot are trademarks of thoughtbot, inc.

We love open source software! See our other projects or hire us to help build your product.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].