Badge

Small count and labeling component.

Bootstrap docs: https://getbootstrap.com/docs/5.3/components/badge/

Badge

Syntax

$Bootstrap = new renderabootstrap5component();
echo $Bootstrap->badge($aOptions)
Returns: string

Parameters: 1

Parameter #0 [ <required> array $aOptions ] 
array of options

Output

  • label {string} text inside
  • title {string} mouseover / title tag

Styling

  • bgtype {string} set color by type; one of primary|secondary|success|warning|
  • rounded {bool} true=round pill; default: null (rounded corners)

Example

PHP snippet

$Bootstrap->badge([
  'bgtype' => 'secondary',
  'label' => 'New',
  'title' => 'This is new',
]);

Generated html output

<span title="This is new" class="badge text-bg-secondary">
New
</span>