Built-in icons
These icons are available out of the box for action buttons:external-link
Open in new window
eye
View or preview
undo
Undo action
retry
Retry operation
reply
Reply to message
map-pin
Location or place
download
Download file
copy
Copy to clipboard
trash
Delete item
check
Confirm action
x
Cancel or close
image
Image or photo
Registering custom icons
Usetoast.registerIcon() to add your own SVG icons. The icon will be available for use in action buttons and as custom type icons.
Make sure your SVG uses
currentColor for the stroke or fill so it inherits the toast’s color scheme. Avoid hardcoding colors unless you have a specific design reason.Using custom icons in action buttons
Once registered, reference your custom icon by name in action buttons.Using custom icons as type icons
You can override the default type icon with your custom icon.Complete examples
Brand icon for premium features
Custom share icon
Shopping cart icon
SVG requirements
Use currentColor
Set
stroke="currentColor" or fill="currentColor" to inherit the toast’s theme colors:Keep it simple
Icons should be simple and recognizable at small sizes. Avoid complex gradients or fine details.
Icon sources
Popular sources for SVG icons that work well with Gooey Toast:Lucide
Clean, consistent icon set with great documentation. All icons use stroke-based design.
Heroicons
Tailwind’s official icon library. Available in outline and solid variants.
Feather Icons
Minimalist icons with a 24x24 grid. Lightweight and easy to customize.
Bootstrap Icons
Extensive library with over 1,800 icons. Works great for both fill and stroke styles.
Registration timing
Register your custom icons once when your app initializes, typically in your main JavaScript file:If you’re using Alpine.js (which Gooey Toast requires), register icons in the
alpine:init event to ensure they’re available before any components initialize:Best practices
Consistent style
Use icons from the same family or with the same design style to maintain visual consistency.
Meaningful names
Choose descriptive icon names like
shopping-cart instead of icon1 for better maintainability.Optimize SVGs
Minify your SVG code to reduce file size. Remove unnecessary attributes and whitespace.
Fallback icons
If a custom icon fails to load, the toast will fall back to the type’s default icon automatically.