Twe kɔ emu nsɛm atitiriw no so Twe kɔ docs navigation so
Check
in English

Badge ahorow

Nwoma ne nhwɛsoɔ ma badge, yɛn akontabuo ketewa ne labeling component.

Nhwɛso ahorow

Badge ahorow no susuw ho ma ɛne ɔwofo element a ɛwɔ hɔ ntɛm ara no kɛse hyia denam font kɛse ne emunit ahorow a ɛfa ho a wɔde di dwuma no so. Ɛde besi v5 no, badge nni focus anaa hover styles bio ma links.

Nsɛmti ahorow

Nhwɛso asɛmtiFoforɔ

Nhwɛso asɛmtiFoforɔ

Nhwɛso asɛmtiFoforɔ

Nhwɛso asɛmtiFoforɔ

Nhwɛso asɛmtiFoforɔ
Nhwɛso asɛmtiFoforɔ
html na ɛwɔ hɔ
<h1>Example heading <span class="badge bg-secondary">New</span></h1>
<h2>Example heading <span class="badge bg-secondary">New</span></h2>
<h3>Example heading <span class="badge bg-secondary">New</span></h3>
<h4>Example heading <span class="badge bg-secondary">New</span></h4>
<h5>Example heading <span class="badge bg-secondary">New</span></h5>
<h6>Example heading <span class="badge bg-secondary">New</span></h6>

Nsɛmma nhoma no

Wobetumi de badge ahorow adi dwuma sɛ link anaa button ahorow no fã de ama counter.

html na ɛwɔ hɔ
<button type="button" class="btn btn-primary">
  Notifications <span class="badge text-bg-secondary">4</span>
</button>

Hyɛ no nsow sɛ, egyina sɛnea wɔde di dwuma so no, ebia badge ahorow no bɛma wɔn a wɔde screen reader ne mfiridwuma a ɛte saa a ɛboa wɔn di dwuma no adwene atu afra. Bere a sɛnea wɔyɛ badge ahorow no ma wotumi hu nea enti a wɔde di dwuma no, nea wɔde badge no mu nsɛm bɛkyerɛ wɔn a wɔde di dwuma yi ara kwa. Ɛgyina tebea pɔtee no so no, saa badge ahorow yi betumi ayɛ te sɛ nsɛmfua anaa nɔma afoforo a wɔde ka ho a wɔanhyɛ da wɔ kasamu, link, anaa bɔtn bi awiei.

Gye sɛ nsɛm a ɛfa ho no mu da hɔ (te sɛ nea ɛte wɔ “Nsɛm a Wɔka Kyerɛ” nhwɛso no ho no, baabi a wɔte ase sɛ “4” no yɛ amanneɛbɔ dodow no), susuw ho sɛ wode nsɛm foforo a ɛfa ho a wɔde nsɛm foforo a wɔde asie wɔ aniwa so bɛka ho.

Wɔde asi hɔ

Fa utilities sesa a .badgena fa si link anaa button bi ntwea so.

html na ɛwɔ hɔ
<button type="button" class="btn btn-primary position-relative">
  Inbox
  <span class="position-absolute top-0 start-100 translate-middle badge rounded-pill bg-danger">
    99+
    <span class="visually-hidden">unread messages</span>
  </span>
</button>

Wubetumi nso de .badgeutilities kakraa bi foforo asi adesuakuw no ananmu a wonni akontaabu mma generic indicator kɛse.

html na ɛwɔ hɔ
<button type="button" class="btn btn-primary position-relative">
  Profile
  <span class="position-absolute top-0 start-100 translate-middle p-2 bg-danger border border-light rounded-circle">
    <span class="visually-hidden">New alerts</span>
  </span>
</button>

Kɔla ahorow a ɛwɔ akyi

Wɔde aka ho wɔ v5.2.0 mu

Fa a background-colorwith contrasting foreground colorne yɛn .text-bg-{color}aboafo no si hɔ . Kane no na wɔhwehwɛ sɛ wode nsa bɛbɔ wo paw .text-{color}ne .bg-{color}utilities ma styling, a woda so ara betumi de adi dwuma sɛ wopɛ a.

Mfiaseɛ Nea ɛto so abien Nkunimdie Ɔhaw a ɛbɛtumi aba Kɔkɔbɔ Info Kanea Sum
html na ɛwɔ hɔ
<span class="badge text-bg-primary">Primary</span>
<span class="badge text-bg-secondary">Secondary</span>
<span class="badge text-bg-success">Success</span>
<span class="badge text-bg-danger">Danger</span>
<span class="badge text-bg-warning">Warning</span>
<span class="badge text-bg-info">Info</span>
<span class="badge text-bg-light">Light</span>
<span class="badge text-bg-dark">Dark</span>
Ntease a wɔde bɛma mfiridwuma ahorow a ɛboa

Kɔla a wɔde di dwuma de ntease ka ho no ma wonya sɛnkyerɛnne a wotumi hu nkutoo, a wɔremfa nkɔma wɔn a wɔde mfiridwuma a ɛboa di dwuma – te sɛ screen akenkanfo. Hwɛ sɛ nsɛm a wɔde kɔla no kyerɛ no da adi pefee fi emu nsɛm no ankasa mu (sɛ nhwɛso no, nsɛm a wotumi hu no), anaasɛ wɔde bɛka ho denam akwan foforo so, te sɛ nsɛm foforo a wɔde asie ne .visually-hiddenadesuakuw no mu.

Pill badge ahorow

Fa .rounded-pillutility class no di dwuma ma badge ahorow no yɛ kurukuruwa kɛse a border-radius.

Mfiaseɛ Nea ɛto so abien Nkunimdie Ɔhaw a ɛbɛtumi aba Kɔkɔbɔ Info Kanea Sum
html na ɛwɔ hɔ
<span class="badge rounded-pill text-bg-primary">Primary</span>
<span class="badge rounded-pill text-bg-secondary">Secondary</span>
<span class="badge rounded-pill text-bg-success">Success</span>
<span class="badge rounded-pill text-bg-danger">Danger</span>
<span class="badge rounded-pill text-bg-warning">Warning</span>
<span class="badge rounded-pill text-bg-info">Info</span>
<span class="badge rounded-pill text-bg-light">Light</span>
<span class="badge rounded-pill text-bg-dark">Dark</span>

CSS a ɛwɔ hɔ no

Nneɛma a Ɛsakra

Wɔde aka ho wɔ v5.2.0 mu

Sɛ́ Bootstrap CSS nsakrae kwan a ɛrekɔ so no fã no, mprempren badge ahorow de mpɔtam hɔ CSS nsakrae ahorow di dwuma wɔ so .badgema bere ankasa mu nsakrae a ɛkɔ anim. Wɔde Sass so ahyɛ CSS nsakraeɛ no botaeɛ, enti Sass nhyehyɛɛ no ​​da so ara boa, nso.

  --#{$prefix}badge-padding-x: #{$badge-padding-x};
  --#{$prefix}badge-padding-y: #{$badge-padding-y};
  @include rfs($badge-font-size, --#{$prefix}badge-font-size);
  --#{$prefix}badge-font-weight: #{$badge-font-weight};
  --#{$prefix}badge-color: #{$badge-color};
  --#{$prefix}badge-border-radius: #{$badge-border-radius};
  

Sass nsakrae ahorow

$badge-font-size:                   .75em;
$badge-font-weight:                 $font-weight-bold;
$badge-color:                       $white;
$badge-padding-y:                   .35em;
$badge-padding-x:                   .65em;
$badge-border-radius:               $border-radius;