Themes & Styling
UX SweetAlert passes theme and styling data directly into the serialized alert payload. That keeps your Symfony code in charge of the visual intent while SweetAlert2 handles the rendering.
Theme enum support
The Theme enum includes:
Auto,Light,Dark,Borderless,Minimal,EmbedIframeBootstrap4,Bootstrap4Light,Bootstrap4DarkBootstrap5,Bootstrap5Light,Bootstrap5DarkMaterialUI,MaterialUILight,MaterialUIDarkBulma,BulmaLight,BulmaDark
Applying a theme
use Pentiminax\UX\SweetAlert\Enum\Theme;
$alertManager
->success('Saved')
->theme(Theme::Bootstrap5Dark);
Loading the matching CSS
The package metadata exposes SweetAlert2 theme files in assets/package.json, but the optional
theme styles are not auto-enabled by default. If you want a framework theme, make sure the matching
SweetAlert2 CSS is imported by your asset pipeline.
Fine-grained styling
The Alert object lets you control button colors and CSS hooks:
$alertManager
->question('Archive item?')
->confirmButtonColor('#ff6b4f')
->cancelButtonColor('#2f4858')
->denyButtonColor('#f4b400')
->theme(Theme::Dark);
You can also pass a customClass array when creating alerts through the manager helpers.
Content-level styling options
Beyond the theme name, the alert model supports:
html(...)for rich HTML contentsetFooter(...)for footer text or markupsetImageUrl(...),setImageAlt(...), andsetImageHeight(...)setDraggable(...)andsetTopLayer(...)
Styling lifecycle events
The frontend controller emits two useful browser events around every modal render:
sweetalert:before-firesweetalert:after-fire
Both expose the SweetAlert options object, making them useful when your application needs to add cross-cutting frontend tweaks without changing the PHP API.