An opinionated toast component for Angular with SVG morphing, spring physics, and a minimal API. Based on Sileo.
npm install sileo-angularNo additional CSS imports needed — styles are bundled with the component.
import { Component } from '@angular/core';
import { SileoToaster } from 'sileo-angular';
@Component({
selector: 'app-root',
imports: [SileoToaster],
template: `
<sileo-toaster position="top-right" theme="light" />
`,
})
export class App {}import { inject } from '@angular/core';
import { Sileo } from 'sileo-angular';
export class MyComponent {
private sileo = inject(Sileo);
showSuccess() {
this.sileo.success({
title: 'Success',
description: 'Your changes have been saved.',
});
}
showError() {
this.sileo.error({
title: 'Error',
description: 'Something went wrong.',
});
}
}sileo.success({ title: 'Success', description: '...' });
sileo.error({ title: 'Error', description: '...' });
sileo.warning({ title: 'Warning', description: '...' });
sileo.info({ title: 'Info', description: '...' });
sileo.action({
title: 'Deleted',
description: 'File removed.',
button: { title: 'Undo', onClick: () => { /* ... */ } },
});sileo.promise(fetchData(), {
loading: { title: 'Loading...' },
success: (data) => ({ title: 'Done', description: String(data) }),
error: (err) => ({ title: 'Failed' }),
});| Prop | Type | Default | Description |
|---|---|---|---|
position |
'top-left' | 'top-center' | 'top-right' | 'bottom-left' | 'bottom-center' | 'bottom-right' |
'top-right' |
Toast position |
theme |
'light' | 'dark' | 'system' |
— | Color theme |
offset |
number | { top?, right?, bottom?, left? } |
— | Viewport offset |
| Prop | Type | Default | Description |
|---|---|---|---|
title |
string |
— | Toast title |
description |
string |
— | Toast body text |
duration |
number | null |
6000 |
Auto-dismiss ms (null = persistent) |
position |
ToastPosition |
— | Override toaster position |
button |
{ title, onClick } |
— | Action button |
fill |
string |
— | Custom pill background color |
roundness |
number |
16 |
Border radius |
# Install dependencies
npm install
# Build the library
ng build sileo-angular
# Run the demo
ng serve demo --port=4300- Original library: Sileo by Aaryan Kapoor
- Website: sileo.aaryan.design
- License: MIT