# dc-toast-ng

> Dark Chicken Toast NG

Latest version **2.0.3** (published 2025-06-24) · MIT license · 0 weekly downloads

## Install

```sh
npm install dc-toast-ng
pnpm add dc-toast-ng
yarn add dc-toast-ng
bun add dc-toast-ng
```

## Health

**Score 35/100 (D)** — status: maintenance-mode.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads.

Negative: stale; low maintenance score.

## Facts

| | |
|---|---|
| Version | 2.0.3 |
| Published | 2025-06-24 |
| First published | 2024-03-09 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 1 |
| Unpacked size | 2.5 MB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | ergulferik, serkankarahan |
| Keywords | angular, typescript, alert, toast, angular toast, notifications, dc, darkchicken, dc-toast-ng, message |

## Links

- npm: https://www.npmjs.com/package/dc-toast-ng
- Repository: https://github.com/Dark-Chicken-DC/dc-toast-ng
- Homepage: https://dark-chicken-dc.github.io/dc-toast-ng/
- Issues: https://github.com/Dark-Chicken-DC/dc-toast-ng/issues
- npm.io page: https://npm.io/package/dc-toast-ng

## Dependencies (1)

- [tslib](https://npm.io/package/tslib.md) ^2.3.0

## Alternatives

- [update-check](https://npm.io/package/update-check.md) — 4.0M weekly downloads
- [react-native-onesignal](https://npm.io/package/react-native-onesignal.md) — 134.5K weekly downloads
- [react-redux-toastr](https://npm.io/package/react-redux-toastr.md) — 33.7K weekly downloads
- [@nocobase/plugin-notification-manager](https://npm.io/package/@nocobase/plugin-notification-manager.md) — 2.0K weekly downloads
- [react-simple-toasts](https://npm.io/package/react-simple-toasts.md) — 1.9K weekly downloads

## Recent versions

- 2.0.3 (latest) — 2025-06-24
- 2.0.2 — 2025-06-24
- 2.0.1 — 2025-06-24
- 2.0.0 — 2025-06-24
- 1.0.8 — 2025-06-24
- 1.0.7 — 2024-05-26
- 1.0.5 — 2024-05-26
- 1.0.4 — 2024-05-26
- 1.0.3 — 2024-03-10
- 1.0.2 — 2024-03-10
- 1.0.1 — 2024-03-10
- 1.0.0 — 2024-03-10
- 0.0.3 — 2024-03-09
- 0.0.2 — 2024-03-09
- 0.0.1 — 2024-03-09

## README

<div align="center">
  <img src="https://raw.githubusercontent.com/Dark-Chicken-DC/dc-toast-ng/main/misc/documentation-assets/dark-chicken-toasts-examples.png" width="600" alt="Dark Chicken Toast NG">
  <br>
  <h1>Dark Chicken Toast NG</h1>
  <br>
  <a href="https://www.npmjs.com/package/dc-toast-ng">
    NPM
  </a>
  <br>
  <br>
</div>

DEMO: https://dark-chicken-dc.github.io/dc-toast-ng/


## Dependencies

Latest version available for each version of Angular


## Install

```bash
npm i dc-toast-ng
```

## Setup

**step 1:** add assets

- You can add it to your angular.json for icons and fonts

```ts
"assets": [
  {
    "glob": "**/*",
    "input": "./node_modules/dc-toast-ng/assets",
    "output": "/assets/"
  }
],
```

**step 2:** add `DcToastNgModule` to app `NgModule`

- Module based

```typescript

import { DcToastNgModule } from 'dc-toast-ng';

@NgModule({
  imports: [
    DcToastNgModule // DcToastNgModule added
  ],
  bootstrap: [AppComponent],
  declarations: [AppComponent],
})
class MainModule {}
```


## Use

```typescript
import { DcToastService } from 'dc-toast-ng';
import { ToastModel } from 'dc-toast-ng/model/models.model';

@Component({...})
export class YourComponent {

  DCToast:ToastModel = {
    content: 'Dark Chicken Toast NG',
    time: 5,
    position: 'top-right',
    closeWithHover: true,
    closeButtonPosition: 'right',
    type: 'success',
    allowTimeBar: true,
    showCloseButton: true
  };

  constructor(private DcToastService: DcToastService) {}

  showToast() {
    this.DcToastService.create(this.DCToast: ToastModel)
  }
}
```

## Options

Passed to `DcToastService.create()`

| Option            | Type                           | Default                        | Description                                                                             
| -----------------   | ------------------------------ | ------------------------------ | ------------------------------------------------------------ |
| content             | string                         | null                           | Determines the content within the toast message.             |
| position            | string                         | 'top-right'                    | Allows the toast to be created in the specified position.    |
| type                | string                         | 'success'                      | Determines what type of toast will be created.               |
| time                | number                         | 0 ( infinity )                 | Determines how long toast will be active.                    |
| closeButtonPosition | string                         | 'right'                        | The position of the close button inside toast.               |
| closeWithHover      | boolean                        | true                           | It closes when you exit to toast with the mouse.             |
| allowTimeBar        | boolean                        | true                           | The value that allows the time bar to be displayed.          |
| showCloseButton     | boolean                        | true                           | The value of whether there will be a close button or not.    |



### DcToast Service method return:

```typescript
this.DcToastService.onHidden().subscribe((response)=> {
      //...
})
//The response value comes in BaseToastModel Type

export interface BaseToastModel {
    content: string,
    time: string,
    type: ToastType,
    closeButton: boolean,
    closeButtonPosition: ToastCloseButtonPositionType,
    allowTimeBar: boolean,
    closeWithHover: boolean,
    index: number,
    position: ToastPositionType
    icon?: SafeHtml
}
```

## Functions

##### Create

Create a new dc-toast

```ts
DcToastService.create(toast: ToastModel);
```

##### Delete

Delete all dc-toasts

```ts
DcToastService.delete();
```


## License

MIT

---

> GitHub [@skarahan35](https://github.com/skarahan35) &nbsp;&middot;&nbsp;
> Github [@ergulferik](https://github.com/ergulferik) &nbsp;&middot;&nbsp;

## Standalone Kullanım

Artık `dc-toast-ng` tamamen standalone bir Angular bileşenidir. Modül import etmeye gerek yoktur.

### Kurulum

```typescript
import { DcToastComponent } from 'dc-toast-ng';
```

veya bir feature/component dosyanızda:

```typescript
@Component({
  // ...
  imports: [DcToastComponent],
  standalone: true,
  // ...
})
```

### Kullanım

```html
<dc-toast-ng></dc-toast-ng>
```

> Not: Servisleri kullanmak için herhangi bir değişiklik yapmanıza gerek yoktur. `DcToastService` ve `IconService` otomatik olarak root'a enjekte edilir.

---
_Source: https://npm.io/package/dc-toast-ng · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
