WidgetCoreWidgetCore Documentation

Alert widget

The complete guide to the WidgetCore Alert widget — four message types, automatic or custom icons, status and alert roles, the dismiss button, title and text and style controls.

The Alert widget is a message box: from “Your registration is complete” to “This coupon has expired”. It has four message types and picks the right ARIA role for each, so screen readers announce urgent messages with priority.

ItemValue
Widget namewgcr-alert
Panel titleAlert
CategoryWidgetCore Widgets (wgcr)
Style / scriptwgcr-alert / wgcr-alert
Root class.wgcr-alert

The “Message content” section

ControlIDTypeDefaultNotes
Message typetypeSelectInfoInfo / Success / Warning / Danger — decides the colors, the automatic icon and the ARIA role
Message titletitleText“Message title”Leave empty to print only the text
Message textcontentWYSIWYG“Message text…”The body of the message; links and simple formatting are allowed

The “Settings” section

ControlIDTypeDefaultNotes
IconiconSelectAutoAuto (matches the message type) / No icon / Custom (Elementor icon library)
Custom iconcustom_iconIcon—Only when “Icon” is set to Custom
Dismiss buttondismissibleSwitcherOffWhen on, visitors can close the box

The automatic icon per type: info → info icon, success → check, warning → warning sign, danger → cross. Icons are inline SVG and follow the icon color controls.

HTML output

html
<div class="wgcr-alert wgcr-alert-info" role="status">
  <span class="wgcr-alert-ic">…svg…</span>
  <div class="wgcr-alert-body">
    <div class="wgcr-alert-title">Message title</div>
    <div class="wgcr-alert-text">Message text…</div>
  </div>
  <button type="button" class="wgcr-alert-close" aria-label="Dismiss message">…svg…</button>
</div>
Class / rolePurpose
.wgcr-alert-info / -success / -warning / -dangerThe message type class with its accent color and background
role="status"For info and success — a polite screen-reader announcement
role="alert"For warning and danger — an assertive screen-reader announcement
.wgcr-alert-icThe icon container
.wgcr-alert-title / .wgcr-alert-textTitle and text (not printed when empty)
.wgcr-alert-closeThe dismiss button with a localized aria-label (only when “Dismiss button” is on)

If the title is empty and the text (after stripping tags) is empty too, the widget prints nothing at all.

Dismiss behaviour

Clicking the button hides the box with the hidden attribute — it is not removed from the DOM and nothing is stored; refreshing the page brings the message back. The small script for this loads only on pages that use the widget.

Style sections

  • Message box: a ready-made box group (background, border, shadow, padding, radius) plus “Accent color” (the side stripe and the icon).
  • Title and text: “Title color”, “Text color” and both typographies.
  • Icon and dismiss button: “Icon size”, “Icon color” and “Dismiss button color” in the Normal tab plus “Dismiss button color on hover” in the Hover tab. The colors run through CSS variables, so hover always works even when the Normal color is set.

Custom style example

css
/* Rounder corners and a thicker accent stripe */
.wgcr-alert { border-radius: 16px; border-inline-start-width: 6px; }