Socket
Socket
Sign inDemoInstall

@workday/canvas-kit-css-badge

Package Overview
Dependencies
0
Maintainers
6
Versions
937
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @workday/canvas-kit-css-badge

provides a summary indicator with dynamic values


Version published
Weekly downloads
200
increased by412.82%
Maintainers
6
Install size
18.6 kB
Created
Weekly downloads
 

Readme

Source

Canvas Kit CSS Badge

The count badge provides a quantity-based summary with dynamic values.

Mainenance Mode

Installation

yarn add @workday/canvas-kit-css

or

yarn add @workday/canvas-kit-css-badge

Add your node_modules directory to your SASS includePaths. You will then be able to import index.scss.

@import '~@workday/canvas-kit-css-badge/index.scss';

Accessibility

A common use case for the count badge is for displaying notifications, and there are several accessibility concerns you'll want to keep in mind:

  • The button should have an aria-label that updates with the count
  • The elements inside the button should have aria-hidden
  • The live region should be outside the button
  • The live region should be visually hidden and only contain text

Example

<button type="button" aria-label="Alerts 3 new notifications">
  <svg aria-hidden="true" focusable="false">...</svg>
  <span class="wdc-count-badge" aria-hidden="true">3</span>
</button>
<div class="wdc-accessible-hide" role="status" aria-live="polite" aria-atomic="true">
  New notifications
</div>

Note: To use the wdc-accessible-hide class, you'll need to import it from the core module.

@import '~@workday/canvas-kit-css-core/lib/accessibility.scss';

Usage

Variants

Default
<span class="wdc-count-badge">
  1
</span>
Inverse
<span class="wdc-count-badge-inverse">
  2
</span>

Formatting

Badges with more than 999 notifications should display '999+'

<span class="wdc-count-badge">
  999+
</span>

Keywords

FAQs

Last updated on 20 Oct 2023

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc