@avalanche/utility-visibility

Classes to hide content with accessibility in mind.

Install

npm install @avalanche/utility-visibility --save-dev

Basic usage

// Import the main file.
@import 'node_modules/@avalanche/utility-visibility/scss/index.scss';

Usage with node-sass-magic-importer

Using node-sass (or a plugin for Grunt, gulp or webpack which is using node-sass) in combination with the node-sass-magic-importer custom importer, can make importing CSS dependencies from node_modules a much nicer experience.

// Import the main file.
@import '~@avalanche/utility-visibility';

// Import just the classes you need.
@import '{ .u-visibility-hidden } from ~@avalanche/utility-visibility';

// Not a fan of the "u-" prefix?
@import '{ .u-visibility-hidden as .visibility-hidden } from ~@avalanche/utility-visibility';

Demo

Hide from both screenreaders and browsers.
Hide only visually, but have it available for screenreaders.
Hide visually and from screenreaders, but maintain layout.
```html
Hide from both screenreaders and browsers.
Hide only visually, but have it available for screenreaders.
Hide visually and from screenreaders, but maintain layout.
```

Mixins

@import 'node_modules/@avalanche/utility-visibility/scss/mixins';

// Usage.
.visibility-hidden {
  @include u-visibility-hidden();
}

About

Author

Markus Oberlehner
Website: https://markus.oberlehner.net
Twitter: https://twitter.com/MaOberlehner
PayPal.me: https://paypal.me/maoberlehner

License

MIT

Do you want to support avalanche?

Star the project on GitHub