What's new in Ding 0.0.5

More ways to make toasts look like your product. No breaking changes.

Everything here is optional. If you change nothing, your toasts look and move exactly as before. The demos below run the shipped library.

npm i @yusufceng1z/ding@latest

Filled toasts New

Each toast now has three variables you can set per status: --fill for the surface, --on for the text, buttons and focus ring, and --c for the icon. Set them and the whole toast takes the status color. The action button, the second button, the progress bar and the close button follow along.

.tst-viewport .tst[data-type=error] {
  --fill: #dc2626;
  --on: #fff;
  --c: #fff;
}

Colors can use light-dark() to differ per theme. If your site has its own theme switch, pass the theme to Toaster or toast.configure({ theme }).

The same error, plain and filled.

Style one toast New

Pass className and the toast gets that class next to tst. Style it as .tst.your-class. toast.update(id, { className: null }) removes it again.

toast.info('Limited offer', { className: 'gold' });

.tst.gold { --fill: #fff7d6; --on: #5b4200; --c: #c77d00; }

Only the first toast carries the class.

Tune the springs, swap the icons New

toast.configure takes two new options. springs retunes the three motions, enter, morph and stack, with a stiffness and a damping each. Leave one out to keep its default. icons replaces a status icon with your own paths on a 24×24 grid. Both apply to toasts shown afterwards.

toast.configure({
  springs: { enter: { stiffness: 170, damping: 12 } },
  icons: { success: [RING, 'M12 16.4s-3.8-2.3-3.8-5a2.1 2.1 0 0 1 3.8-1.2a2.1 2.1 0 0 1 3.8 1.2c0 2.7-3.8 5-3.8 5z'] },
});

The first path of an icon is its outer ring, which loading toasts draw as a turning arc. Keep three paths for warning and info, because their animations use the second and third.

Each button changes the setting, then shows a toast.

More CSS variables, and a new playground

The docs now list the variables that were already there: --tst-size, --tst-pad, --tst-shadow and --tst-enter-scale, plus the font, which you set on .tst-viewport. The playground was rebuilt around them. Pick a ready-made style, change the radius, size, colors, motion or icon on a real toast, then copy the CSS and config.

See Styling in the docs for the full list.

Square corners work Fixed

--tst-radius: 0 was treated as missing, so toasts stayed rounded at 24px. A radius of 0 now gives square corners. A radius you change while a toast is open also shows up on its next move, where it used to wait for the next toast.

Older releases

What's new in 0.0.4 · What's new in 0.0.3