Badge

Documentation

JavaScript

var Components = require("gd-sprest-bs").Components;

// Create the badge
var el = document.querySelector("#badge");
var badge = Components.Badge({
    el: el,
    content: "Badge"
});

TypeScript

import { Components } from "gd-sprest-bs";

// Create the badge
let el = document.querySelector("#badge");
let badge = Components.Badge({
    el: el,
    content: "Badge"
});

Web Component

<script type="text/javascript" src="https://unpkg.com/gd-sprest-bs/wc/dist/gd-sprest-bs.js"></script>
<bs-badge content="Badge"></bs-badge>

References

Badge(props:IBadgeProps):IBadge

BadgeTypes

Name Value
Danger 1
Dark 2
Info 3
Light 4
Primary 5
Secondary 6
Success 7
Warning 8

IBadge

Name Returns Description
el Element The jquery element.

IBadgeProps

Name Type Description
className string The class name to apply to badge.
content string The badge content.
el HTMLElement The element to render the badge to.
header string The badge header.
href string Renders the badge as an anchor element instead of a span element.
isPill boolean Adds the ‘badge-pill’ class name.
type number The badge type. Reference the BadgeTypes enumerator