Toastr
Short notifications that slide in at the edge of the screen and close by themselves. One call — Odin.toast.success('Saved') — with options for position, timing and behaviour.
Toast Builderpick the options, then show it
Code
The call for the toast on the left. Options that keep their default are left out.
Change a default once for the whole admin: Odin.Toast.defaults.position = 'bottom-right'.
Types
Odin.toast.success(text, title)A shortcut for every colour. error is the same as danger.
Positions
position: 'top-right'Six places on the screen. Each one keeps its own stack.
Behaviour
Stays until closed —
Clickable —
No duplicates —
Close from code —
timeout: 0
onClick + closeOnClick
preventDuplicates: true (click several times)
toast.close(), Odin.toast.clear()
Options
Odin.Toast.defaults| Option | Default | What it does |
|---|---|---|
type | 'primary' | success, info, warning, danger (or error), primary, light, dark |
title, text | '' | Plain text — it is never read as HTML |
icon | by type | Any Font Awesome class, e.g. 'fas fa-cloud' |
timeout | 5000 | Milliseconds before it closes; 0 keeps it open. Hover pauses the timer |
position | 'top-right' | top-right, top-center, top-left, bottom-right, bottom-center, bottom-left |
closeButton | true | Show the × button |
progressBar | true | Show the line that counts down the time |
newestOnTop | true | New toasts appear nearest the edge of the screen |
preventDuplicates | false | Skip a toast with the same type, title and text that is still open |
closeOnClick | false | Clicking the toast closes it |
onClick | null | toast => … runs when the toast is clicked |