Alert

Documentation

JavaScript

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

// Create the alert
var el = document.querySelector("#alert");
var alert = Components.Alert({
    el: el,
    content: "This is an alert."
});

TypeScript

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

// Create the alert
let el = document.querySelector("#alert");
let alert = Components.Alert({
    el: el,
    content: "This is an alert."
});

Web Component

<script type="text/javascript" src="https://unpkg.com/gd-sprest-bs/wc/dist/gd-sprest-bs.js"></script>
<bs-alert content="This is an alert"></bs-alert>

References

Alert(props:IAlertProps):IAlert

AlertTypes

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

IAlert

Name Returns Description
close void Closes an alert by removing it from the DOM.
dispose void Destroys an element’s alert.
el Element The jquery element.

IAlertProps

Name Type Description
className string The class name to apply to alert.
content string The alert content.
el HTMLElement The element to render the alert to.
header string The alert header.
isDismissible boolean Renders an ‘x’ to close the alert.
type number The alert type. Reference the AlertTypes enumerator