An open API service indexing awesome lists of open source software.

https://github.com/DanielJimenezC/makki-toast-package

Customizable toast designed and developed to facilitate the build and management of custom alerts.
https://github.com/DanielJimenezC/makki-toast-package

alert angular frontend notification npm-package

Last synced: 3 months ago
JSON representation

Customizable toast designed and developed to facilitate the build and management of custom alerts.

Awesome Lists containing this project

README

          

makki toast - Try it


NPM Version
Minzip size
Download
Licence





Creative makki toast.

Easy to use, customizable & support promise




Website
·
Documentation




Build by Daniel Jimenez


## Features

- **Easy to use**
- **Customizable**
- **Dark mode**
- **Lightweight**
- **Accessible**

## Installation

#### With NPM

```sh
npm install makki-toast@latest
```
## Getting Started

Add the makki toast and it will take care of render the alerts. From version 2.0.0 it's for Angular 21

#### Import Makki Toast in app.ts
```jsx
import { Component } from '@angular/core'
import { RouterOutlet } from '@angular/router'
import { ToasterComponent } from 'makki-toast'

@Component({
selector: 'app-root',
standalone: true,
imports: [RouterOutlet, ToasterComponent],
templateUrl: './app.html',
styleUrl: './app.css'
})
export class App {
constructor() {}
}
```

#### Import Makki Toast in app.html
```jsx

```

#### Import Makki Toast in Component
```jsx
import { ToastService } from 'makki-toast'

constructor(
private readonly toast: ToastService,
) {}
```

#### Info
```jsx
this.toast.info({
title: 'Info toast',
description: 'Info toast message',
});
```

#### Success
```jsx
this.toast.success({
title: 'Success toast',
description: 'Success toast message'
});
```

#### Warning
```jsx
this.toast.warning({
title: 'Warning toast',
description: 'Warning toast message'
});
```

#### Error
```jsx
this.toast.error({
title: 'Error toast',
description: 'Error toast message'
});
```

#### Action
```jsx
this.toast.action({
title: 'Action toast',
description: 'Action toast message',
button: {
title: 'View Details',
onClick: () => console.log('show')
},
});
```

#### Promise
```jsx
this.toast.promise(
fetchData(),
{
loading: {
title: 'Loading...',
},
success: (data) => ({
title: 'Complete',
description: 'promise complete message'
}),
error: (err) => ({
title: 'Error',
description: err.message
})
}
);
```

#### Component in description without data
```jsx
this.toast.promise(
fetchData(),
{
loading: {
title: 'Loading...',
},
success: (data) => ({
title: 'Complete',
description: DataComponent
}),
error: (err) => ({
title: 'Error',
description: err.message
})
}
);
```

#### Component in description with share data
```jsx
this.toast.promise(
fetchData(),
{
loading: {
title: 'Loading...',
},
success: (data) => ({
title: 'Complete',
description: {
component: DataComponent,
inputs: {
data: data
}
}
}),
error: (err) => ({
title: 'Error',
description: err.message
})
}
);

export class DataComponent {
@Input() data!: any;
}
```

## Documentation

Find the full documentation on [official documentation](https://danieljimenezc.github.io/makki-toast/docs)