1.0.3 • Published 5 years ago

@lit-element-bootstrap/alert v1.0.3

Weekly downloads
3
License
MIT
Repository
github
Last release
5 years ago

@lit-element-bootstrap/alert

An implementation of Bootstrap v4.3.1 alert components in LitElement.

Live demo

Go to live demo

Installation

Install via npm:

npm install @lit-element-bootstrap/alert

Install via yarn:

yarn add @lit-element-bootstrap/alert

Install via unpkg:

https://unpkg.com/@lit-element-bootstrap/alert@latest/unpkg/index.bundled.js

Import

import all modules:

import '@lit-element-bootstrap/alert';

import specific module (preferred):

import '@lit-element-bootstrap/alert/bs-alert.js';

import specific class:

// import specific class from all modules
import { BsAlert } from '@lit-element-bootstrap/alert';

// import specific class
import { BsAlert } from '@lit-element-bootstrap/alert/bs-alert.js';

Examples

Plain alert

<bs-alert context="success">
    <p>A simple primary alert—check it out!</p>
</bs-alert>

Plain alert

Dismissable alert

<bs-alert context="warning" dismissable>
    <p>A simple primary alert—check it out!</p>
    <bs-alert-dismiss slot="dismiss"></bs-alert-dismiss>
</bs-alert>

Plain alert

Additional content alert

<bs-alert context="primary" dismissable>
    <h4 slot="heading">Well done!</h4>
    <div>
        Aww yeah, you successfully read this important alert message. This example text is going to run a bit longer so that you can see how spacing within an alert works with this kind of content.
        <bs-alert-hr context="primary"></bs-alert-hr>
        <p>Whenever you need to, be sure to use margin utilities to keep things nice and tidy.</p>
    </div>
    <bs-alert-dismiss slot="dismiss"></bs-alert-dismiss>
</bs-alert>

Additional content

Components

TagClass
<bs-alert>BsAlert
<bs-alert-link>BsAlertLink
<bs-alert-hr>BsAlertHr
<bs-alert-dismiss>BsAlertDismiss

Methods

bs-alert

MethodReturnsDescription
dismiss()PromiseDismisses the alert, but it is not removed from the DOM. It is left up to the parent element to either catch the closed.bs.alert event or await on the Promise and then to manually call remove()

Events

bs-alert

EventDescription
close.bs.alertFired in the beginning of alert dismissal
closed.bs.alertFired in the end of alert dismissal (will wait for CSS transition to complete)

bs-alert-dismiss

EventDescription
close.button.clickFired when the close button has been clicked

Slots

bs-alert

NameDescription
slot="heading"Place alert header content
slot="dismiss"Place content that displays a close button

Theming

bs-alert

PropertyDefault valueDescription
--alert-coloruser agentSet the alert text color
--alert-bg-coloruser agentSet the alert background color
--alert-bd-coloruser agentSet the alert border color
--alert-primary-color#004085Set the primary context text color
--alert-primary-bg-color#cce5ffSet the primary context background color
--alert-primary-bd-color#b8daffSet the primary context border color
--alert-secondary-color#383d41Set the secondary context text color
--alert-secondary-bg-color#e2e3e5Set the secondary context background color
--alert-secondary-bd-color#d6d8dbSet the secondary context border color
--alert-success-color#155724Set the success context text color
--alert-success-bg-color#d4eddaSet the success context background color
--alert-success-bd-color#c3e6cbSet the success context border color
--alert-info-color#0c5460Set the info context text color
--alert-info-bg-color#d1ecf1Set the info context background color
--alert-info-bd-color#bee5ebSet the info context border color
--alert-warning-color#856404Set the warning context text color
--alert-warning-bg-color#fff3cdSet the warning context background color
--alert-warning-bd-color#ffeebaSet the warning context border color
--alert-danger-color#721c24Set the danger context border color
--alert-danger-bg-color#f8d7daSet the danger context background color
--alert-danger-bd-color#f5c6cbSet the danger context border color
--alert-light-color#818182Set the light context text color
--alert-light-bg-color#fefefeSet the light context background color
--alert-light-bd-color#fdfdfeSet the light context border color
--alert-dark-color#1b1e21Set the dark context text color
--alert-dark-bg-color#d6d8d9Set the dark context background color
--alert-dark-bd-color#c6c8caSet the dark context border color

bs-alert-link

PropertyDefault valueDescription
--alert-link-color#007bffSet the alert link color
--alert-link-font-weight700Set the alert link text font weight
--alert-link-text-decorationnoneSet the alert link text decoration
--alert-link-bg-colortransparentSet the alert link background color
--alert-link-hover-color#0056b3Set the alert link hover text color
--alert-link-hover-text-decorationunderlineSet the alert link hover text decoration
--alert-link-primary-color#002752Set the alert link primary context text color
--alert-link-secondary-color#202326Set the alert link secondary context text color
--alert-link-success-color#0b2e13Set the alert link success context text color
--alert-link-info-color#062c33Set the alert link info context text color
--alert-link-warning-color#533f03Set the alert link warning context text color
--alert-link-danger-color#491217Set the alert link danger context text color
--alert-link-light-color#686868Set the alert link light context text color
--alert-link-dark-color#040505Set the alert link dark context text color

bs-alert-hr

PropertyDefault valueDescription
--alert-hr-bd-top-colorrgba(0, 0, 0, 0.1)Set the horizontal line top border color
--alert-hr-primary-bd-top-color#9fcdffSet the horizontal line context primary top border color
--alert-hr-secondary-bd-top-color#c8cbcfSet the horizontal line context secondary top border color
--alert-hr-success-bd-top-color#b1dfbbSet the horizontal line context success top border color
--alert-hr-info-bd-top-color#abdde5Set the horizontal line context info top border color
--alert-hr-warning-bd-top-color#ffe8a1Set the horizontal line context warning top border color
--alert-hr-danger-bd-top-color#f1b0b7Set the horizontal line context danger top border color
--alert-hr-light-bd-top-color#ececf6Set the horizontal line context light top border color
--alert-hr-dark-bd-top-color#b9bbbeSet the horizontal line context dark top border color
1.0.3

5 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago

1.0.0-alpha.4

5 years ago

1.0.0-alpha.3

5 years ago

1.0.0-alpha.2

5 years ago

1.0.0-alpha.1

5 years ago