toastizy
v1.2.0
Published
A lightweight TypeScript library for toast notifications
Maintainers
Readme
Toastizy

Une librairie TypeScript pour afficher des notifications toastr
Installation
Via NPM
npm install toastizy
yarn add toastizyVia CDN
Ajoutez les fichiers CSS et JavaScript dans votre HTML :
<!-- CSS -->
<link rel="stylesheet" href="https://unpkg.com/[email protected]/dist/css/toastizy.min.css">
<!-- JavaScript -->
<script src="https://unpkg.com/[email protected]/dist/toastizy.min.js"></script>Utilisation
Avec les modules ES
import { Toastr } from 'toastizy';
import 'toastizy/dist/toastizy.min.css';
const toastr = Toastr.getInstance();
// Notification simple
toastr.show({ title: 'Success', type: 'success'});
// Notification avec options
toastr.show({
title: "Error",
type: 'error',
description: 'Une erreur est survenue'
}, {
duration: 5000,
position: 'top-right',
closeButton: true,
progressBar: true
});Avec le CDN
<script>
const toastr = Toastizy.Toastr.getInstance();
toastr.show({ title: 'Success', type: 'success'});
</script>Types de notifications
successerrorinfowarning
Options
| Option | Type | Description | Par défaut | |--------|------|-------------|------------| | duration | number | Durée d'affichage en ms | 3000 | | position | string | Position de la notification | 'top-right' | | closeButton | boolean | Afficher le bouton de fermeture | true | | progressBar | boolean | Afficher la barre de progression | true | | className | string | Classe CSS personnalisée | undefined |
Développement
# Installer les dépendances
npm install
# Lancer les tests
npm test
# Compiler le projet
npm run build