New:Microsoft Teams Notifications Are Now Available in Socket.Learn more
Get Started

cf-components-alert

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cf-components-alert

"An alert web component"

Source
npmnpm
Version
1.0.2
Version published
Maintainers
1
Created
Source

cf-alert

A simple alert web component.

Usage

In an HTML file:

<!DOCTYPE html>
<html lang="en">
<head>
    <script type="module" src="components/alert/cf-alert.js"></script>

    <!-- 
        Use CSS custom properties to alter styles within the component.
    -->
    <style>
        --alert-bg-default: hotpink;
    </style>
</head>
<body>
    <cf-alert>
        This is the default alert.
    </cf-alert>

    <cf-alert type="info">
        This is an info alert.
    </cf-alert>

    <cf-alert type="tip">
        This is an tip / success alert.
    </cf-alert>

    <cf-alert type="warning">
        This is an warning alert.
    </cf-alert>

    <cf-alert type="danger">
        This is an danger alert.
    </cf-alert>
</body>
</html>

With npm:

npm install cf-alert
import 'cf-alert';

Configurable styles

Each type of alert can be customized by changing the background color or the text color. Use the following custom properties for customization:

/* Default */
--alert-bg-default: #f0f4f8; /* background-color */
--alert-color-default: #334e68; /* text color */

/* Info */
--alert-bg-info: #e3f8ff;
--alert-color-info: #035388;

/* Tip / Success */
--alert-bg-tip: #effcf6;
--alert-color-tip: #014d40;

/* Warning */
--alert-bg-warning: #fffbea;
--alert-color-warning: #8d2b0b;

/* Danger */
--alert-bg-danger: #ffe3e3;
--alert-color-danger: #610316;

FAQs

Package last updated on 06 Oct 2019

Related posts