Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

New Component: Badge #51

Open
1 of 9 tasks
richardtape opened this issue Mar 9, 2020 · 0 comments
Open
1 of 9 tasks

New Component: Badge #51

richardtape opened this issue Mar 9, 2020 · 0 comments

Comments

@richardtape
Copy link
Collaborator

Problem description
A badge provides a consistent visual labelling system for inline meta information. i.e. Number of articles, highlighting when something is 'new' etc.

Proposed solution

https://codepen.io/richardtape/pen/QWbaqEd?editors=1100

In its isolated form, the badge component has practically no unique accessibility considerations (beyond what is expected for all components in the DEF) - it's simply a box with some text in it. However, for the vast majority of the time the badge component will be providing meta information to the item that surrounds it and thus will need to include appropriate attributes or content that give the badge context.

The proposed CSS for the badge component uses inline-flex as value for the display property. This will make vertically centring this component within a parent element considerably easier.

Alternatives considered

https://getbootstrap.com/docs/4.4/components/badge/ and https://github.com/DavideTriso/aria-badge were looked at and both provide the same markup and considerations that is provided in the proposed solution here.

Additional context

https://codepen.io/richardtape/pen/QWbaqEd?editors=1100

The badge component as proposed here differs slightly from the CLF 7 badge component which used the label class, which caused issues with the label element in some contexts.

Feature Review Checklist:

  • HTML Markup
  • CSS
  • JS (if applicable)
  • Responsive Behaviour
  • UX
  • Design
  • Web Accessibility
  • Documentation
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant