Unbox count in buttons

What does this MR do?

Simplifies the count by unboxing it. Currently it mimics a badge but most consumers in the product use a custom integration to unbox it.

Changes:

  • Tweaks how the count looks by unboxing it
  • button.vue
    • hasIconOnly no longer depends on count, so a button with icon + count and no text gets btn-icon.
    • The .gl-button-count element now renders outside .gl-button-text, so it also shows for icon-only buttons.
    • A new btn-count class is applied whenever a count is shown.
  • button.scss
    • Count is now unboxed with gl-font-semibold
    • New .btn-icon.btn-count and .btn-sm.btn-icon.btn-count padding rules for optical alignment with the icon-only buttons. The count spacing drops to gl-ml-2 here.
  • Docs: adds icon + count examples (medium and small) to contents/components/button.md.
  • Specs
    • Updated the spec that expected icon + count to not be icon-only. It now asserts btn-icon.
    • Added specs for:
      • where the count renders (outside the button text)
      • the count rendering on icon-only buttons
      • when the btn-count class is applied (count with text, 0, icon-only, null, undefined, no count, negative)
  • Changeset: @gitlab/ui patch.

Screenshots or screen recordings

Before After
before after
Icon-only button adjustments
image
image

Integrations

Does this MR meet the acceptance criteria?

Toggle the acceptance checklist

Conformity

  • The “What does this MR do?” section in the MR description is filled out.
  • Relevant label(s) are applied to the MR.
  • The MR is added to a milestone.
  • Added the ~"component:*" label(s) if applicable.
  • A changeset is added when this MR will do a patch, minor, or major update.

Components

  • GitLab UI's contributing guidelines.
  • If the MR changes a component's API, integration MR(s) have been opened.

Accessibility

  • All actions and functionality can be done with a keyboard.
  • Links, buttons, and controls have a visible focus state.
  • All content is presented in text or with a text equivalent (icon-only + count buttons still need an aria-label).
  • Color combinations have sufficient contrast.
Edited by Design System Danger Token

Merge request reports

Loading
Loading