Skip to content
GitLab
    • Explore Projects Groups Snippets
Projects Groups Snippets
  • /
  • Help
    • Help
    • Support
    • Community forum
    • Submit feedback
    • Contribute to GitLab
  • Sign in / Register
  • B bootstrap
  • Project information
    • Project information
    • Activity
    • Labels
    • Members
  • Repository
    • Repository
    • Files
    • Commits
    • Branches
    • Tags
    • Contributors
    • Graph
    • Compare
  • Issues 263
    • Issues 263
    • List
    • Boards
    • Service Desk
    • Milestones
  • Merge requests 114
    • Merge requests 114
  • CI/CD
    • CI/CD
    • Pipelines
    • Jobs
    • Schedules
  • Deployments
    • Deployments
    • Environments
    • Releases
  • Packages and registries
    • Packages and registries
    • Package Registry
    • Infrastructure Registry
  • Monitor
    • Monitor
    • Incidents
  • Analytics
    • Analytics
    • Value stream
    • CI/CD
    • Repository
  • Wiki
    • Wiki
  • Snippets
    • Snippets
  • Activity
  • Graph
  • Create a new issue
  • Jobs
  • Commits
  • Issue Boards
Collapse sidebar
  • Bootstrap
  • bootstrap
  • Merge requests
  • !23104

Docs fixes for badges in buttons

  • Review changes

  • Download
  • Email patches
  • Plain diff
Merged Mark Otto requested to merge btn-badge-fixes into v4-dev 8 years ago
  • Overview 0
  • Commits 3
  • Pipelines 0
  • Changes 1

This corrects some changes from #23060:

  • Buttons must have a base and modifier class. I've added .btn-primary to fix that.
  • Given the primary buttons, I've changed the badges to .badge-light for contrast.
  • .bd-example and {% highlight %} don't need to be separate, so I've combined them with our {% example %} blocks designed for these situations.
  • I've tweaked some docs content: added a serial comma, broke apart a rather large paragraph, and consolidated some text.

/cc @patrickhlauke

Compare
  • v4-dev (base)

and
  • latest version
    5be61238
    3 commits, 2 years ago

1 file
+ 10
- 21

    Preferences

    File browser
    Compare changes
docs/4.0/components/badge.md
+ 10
- 21
  • View file @ 5be61238

  • Edit in single-file editor

  • Open in Web IDE


@@ -30,33 +30,22 @@ Badges scale to match the size of the immediate parent element by using relative
Badges can be used as part of links or buttons to provide a counter.
<div class="bd-example">
<button class="btn">
Notifications <span class="badge badge-secondary">4</span>
</button>
</div>
{% highlight html %}
<button class="btn">
Notifications <span class="badge badge-secondary">4</span>
{% example html %}
<button class="btn btn-primary">
Notifications <span class="badge badge-light">4</span>
</button>
{% endhighlight %}
{% endexample %}
Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link or button. Unless the context is clear (as with the "Notifications" example, where it is arguably understandable that the "4" gives a count of the number of notifications), consider including additional context – for instance using a visually hidden piece of additional text.
Note that depending on how they are used, badges may be confusing for users of screen readers and similar assistive technologies. While the styling of badges provides a visual cue as to their purpose, these users will simply be presented with the content of the badge. Depending on the specific situation, these badges may seem like random additional words or numbers at the end of a sentence, link, or button.
<div class="bd-example">
<button class="btn">
Profile <span class="badge badge-secondary">9</span>
<span class="sr-only">unread messages</span>
</button>
</div>
Unless the context is clear (as with the "Notifications" example, where it is understood that the "4" is the number of notifications), consider including additional context with a visually hidden piece of additional text.
{% highlight html %}
<button class="btn">
Profile <span class="badge badge-secondary">9</span>
{% example html %}
<button class="btn btn-primary">
Profile <span class="badge badge-light">9</span>
<span class="sr-only">unread messages</span>
</button>
{% endhighlight %}
{% endexample %}
## Contextual variations
0 Assignees
None
Assign to
0 Reviewers
None
Request review from
Labels
2
docs v4
2
docs v4
    Assign labels
  • Manage project labels

Milestone
No milestone
None
None
Time tracking
No estimate or time spent
Lock merge request
Unlocked
2
2 participants
Mark Otto
Patrick H. Lauke
Reference: twbs/bootstrap!23104
Source branch: btn-badge-fixes

Menu

Explore Projects Groups Snippets