ember-bootstrap-toasts-manager
Version:
Ember-addon that provides a simple mechanism for interaction with user using toasts.
61 lines (43 loc) • 2.15 kB
Markdown
[](https://github.com/onechiporenko/ember-bootstrap-toasts-manager/actions/workflows/ci.yml)
[](https://emberobserver.com/addons/ember-bootstrap-toasts-manager)
[](http://badge.fury.io/js/ember-bootstrap-toasts-manager)
[](http://doge.mit-license.org)
[](https://www.npmjs.com/package/ember-bootstrap-toasts-manager)
`ember-bootstrap-toasts-manager` is an Ember-addon that provides a simple mechanism for interaction with user using toasts. This addon is based on `ember-bootstrap`.
`ember i ember-bootstrap-toasts-manager`
Add next to your `application.hbs`:
```html
<ToastsContainer />
```
```typescript
import Controller from "@ember/controller";
import { action } from "@ember/object";
import { inject as service } from "@ember/service";
import ToastsManager from "ember-bootstrap-toasts-manager/services/toasts-manager";
export default class ApplicationController extends Controller {
@service declare toastsManager: ToastsManager;
@action
showToast() {
this.toastsManager.showBaseToast({
title: "Hello",
message: "This is a toast message",
});
}
}
```
Custom components could be used as well:
```typescript
this.toastsManager.showToast(CustomToastComponent, {
title: "Hello",
message: "This is a toast message",
});
```
Here `CustomToastComponent` is a component that will be used to render a toast.
Check `components/toasts/base` for an example of toast component. Also check [Bootstrap Toasts
- `ember-bootstrap@6`
- `bootstrap@5`
Check [demo-page](https://onechiporenko.github.io/ember-bootstrap-toasts-manager/#/demo)