0.7.1 • Published 7 months ago

@react-lit/alert v0.7.1

Weekly downloads
-
License
MIT
Repository
github
Last release
7 months ago

@react-lit/alert

An alert is an element that displays a brief, important message in a way that attracts the user's attention without interrupting the user's task.

Dynamically rendered alerts are automatically announced by most screen readers, and in some operating systems, they may trigger an alert sound. It is important to note that, at this time, screen readers do not inform users of alerts that are present on the page before page load completes.

Installation

$ npm i @react-lit/alert
# or
$ yarn add @react-lit/alert

Example

import * as React from 'react';
import { Alert } from "@react-lit/alert";

function Example() {
  const [messages, setMessages] = React.useState([]);
  return (
    <div>
      <button
        onClick={() => {
          setMessages((prevMessages) =>
            prevMessages.concat([`Message #${prevMessages.length + 1}`])
          );
          setTimeout(() => {
            setMessages((prevMessages) => prevMessages.slice(1));
          }, 5000);
        }}
      >
        Add a message
      </button>
      <div>
        {messages.map((message, index) => (
          <Alert key={index}>{message}</Alert>
        ))}
      </div>
    </div>
  );
}

Development

(1) Install dependencies

$ npm i
# or
$ yarn

(2) Run initial validation

$ ./Taskfile.sh validate

(3) Run tests in watch-mode to validate functionality.

$ ./Taskfile test -w

This project was set up by @jvdx/core

0.7.1

7 months ago

0.7.0

8 months ago

0.6.0

10 months ago

0.5.0

2 years ago

0.4.0

2 years ago

0.3.1

2 years ago

0.3.0

2 years ago

0.2.0

2 years ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

3 years ago