October DealsAmazon USOctober deal check: compare before you payAmazon US: current deals, useful picks and tech finds.Check DealsSlow PC?RecommendedPC slow today? Run a repair scan before it gets worseResolve common Windows issues and optimize system performance.Scan NowOctober DealsAmazon USDeal season is back - check today's better picksAmazon US: current deals, useful picks and tech finds.See Picks×
Skip to content
World desk6 min

How to Customize Stream Alerts with CSS and JavaScript

A practical guide to editing StreamElements AlertBox HTML, CSS, and JavaScript, choosing a Custom Widget when needed, and checking alerts in your streaming software.
Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

To customize a StreamElements alert, create an overlay, add an AlertBox, open the settings for the event type you want to change, enable its custom code, and edit the HTML, CSS, and JavaScript in the Overlay Editor. CSS handles appearance and animation; JavaScript can respond to widget events or coordinate behavior. Test the finished alert in your streaming software, not just in the editor preview.

Choose the right customization route

StreamElements offers two relevant paths. An AlertBox is the native alert widget: it displays live events from a queue, and you can enable custom code for individual event types. A Custom Widget is a more general-purpose option with HTML, CSS, JavaScript, and configurable fields; use it when you need behavior or controls beyond a standard AlertBox. StreamElements describes its overlay tools and widgets in its overlays documentation.

If you prefer ready-made visuals and less coding, Streamlabs provides Alert Box settings, tests, browser-source setup, event filtering, and a theme library with free and premium choices. Its workflow is separate from StreamElements’ code editor, so do not assume the same settings or capabilities apply to both. See Streamlabs’ alert setup guide.

Customize a StreamElements AlertBox

  1. Create an overlay: In StreamElements, create an overlay and select a canvas resolution that matches the scene where the alert will appear. The official overlay setup guide covers this path.
  2. Add the widget: Add an AlertBox to the overlay and open its options.
  3. Select an event: Choose the relevant event tab, such as Followers. Enable Enable custom CSS for that event type. Custom code is configured by alert type, so repeat the setup for each event you want to customize.
  4. Edit the code: Open the Overlay Editor’s Code Editor and edit the alert’s HTML, CSS, or JavaScript. Start with the existing template and change only the structure or behavior you need.
  5. Preview and test: Use the editor’s available preview or test controls, then check the alert from the actual browser source in your streaming software, in the scene and at the canvas size you will use live.

Use the event’s documented variables

AlertBox templates provide inline variables for event-specific data. The available values depend on the type of event. Examples documented by StreamElements include:

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
#1 Best Overall
Sale
VSD M18 Macro Pad Programmable Keypad, Stream Controller Streaming Deck, Customizable LCD keys, Gaming shortcut keyboard, USB sound board, Trigger actions in OBS, Twitch, YouTube, Works with PC Mac
  • 18 Programmable Keys Macro Keypad: This stream controller deck comes with 18 customizable macro keys (15 LCD visual keys + 3 physical buttons). Users may program single actions or multi-step sequences for daily operation. The keys support in-game combos, app launch and media playback control for multiple usage scenarios. Each LCD key accepts JPG, PNG and GIF images and animations to mark separate functions
  • Single Tap Control: This USB macro keyboard pad supports single tap commands for quick operation. Users can trigger pre-set macros, input text, open files and web pages, adjust media playback, or switch OBS scenes with one tap. The straightforward layout fits gaming, live streaming and professional office task setup
  • One Tap Multi-Shortcut: This macro controller pad streaming deck supports multi-shortcut macro programming for gamers and content creators. Custom shortcuts simplify game combo inputs, video editing, music production and photography workflows. The Operation Follow function runs multiple macro steps in custom order or simultaneous execution for adjustable task control
  • Adjustable RGB Surround Light Ring - VSD M18 gaming streaming deck features an outer RGB light ring with auto color cycle mode. Custom RGB tones are available via device firmware upgrade. The light ring offers adjustable visual lighting for dim gaming, streaming and night work setups.
  • Wide System Compatibility: This VSDinside macro control board works with Windows 11 and newer, macOS 11.0 and newer systems. Connect via USB-C cable for immediate use. It is compatible with mainstream software including OBS, Streamlabs, YouTube, Twitter, Discord, Excel, Word and Photoshop for daily production work. Native Linux system plug-and-play support is not available, while SDK development documents are provided for custom secondary development
Variable Use
{{name}} The person associated with the event.
{{amount}} An event amount where that event supports one.
{{tier}} A subscription tier.
{{sender}} The sender of a gifted subscription.
{{currency}} The currency associated with a tip.
{{message}} and {{messageRaw}} User-message values.
{{image}}, {{video}}, {{audio}} Media URLs for the event.
{{widgetDuration}} The configured widget duration in seconds.

These are examples, not a guarantee that every variable exists for every event. Check the AlertBox custom-code reference for the event you are editing, and use its documented classes and variables rather than guessing at the payload.

Style the alert with CSS

Use CSS for typography, color, spacing, alignment, responsive sizing, transitions, and animations. Keep selectors scoped to the relevant alert markup so styles for one event do not unexpectedly affect another. For example, define a class in the event’s HTML and target that class in its CSS rather than styling every paragraph or image in the overlay.

Rank #2
RedThunder K10 Wired Gaming Keyboard and Mouse and Wrist Rest Combo, RGB Backlit, Mechanical Feel Anti-ghosting Keyboard + 7D 7200 DPI Mice+Soft Leather Wrist Rest 3 in 1 PC Gamer Accessories(Black)
  • 【Professional Gaming Keyboard】The 104-key full-size keyboard has a standard layout with F-keys (function keys) and a numeric keypad, and 26 Anti-Ghosting keys allow you to press multiple keys simultaneously. The quality of the built-in steel plate of the keyboard is very strong and durable.
  • 【Professional gaming mouse】The mouse uses high-precision optical sensor, sensitivity is 7200DPI, 12000fps scan rate, 1000Hz tour detection rate, can withstand 40G acceleration and 400IPS tracking speed, can meet your fast browsing and game requirements.
  • 【Upgraded RGB Lighting Gaming Combo】All the keys of the keyboard, the light bar on the bottom side of the keyboard, and the RGB lights on the side of the mouse will glow. Your fingertips dance on the designed floating keycaps and click on the hyper-responsive mouse, accompanied by rainbow-like RGB lighting, allowing you to instantly enter the cool game state.
  • 【Perfect Ergonomic Computer Game Combo】The adjustable tripod keyboard makes your keys easier. The anti-slip material mouse that is more suitable for the hand can reduce your hand fatigue.Soft leather wrist rest made from smooth faux leather and memory foam for extra relaxation while gaming.
  • 【High-quality Game Combination】The curved ABS keycaps are exquisite in workmanship, the built-in steel plate of the keyboard base is sturdy and resistant to falling, the non-slip ABS material mouse has a better grip, and the soft leather wrist-rest filled with memory foam is more textured. High quality allows you to choose worry-free.
  • Design within the overlay canvas and check the result at the browser-source dimensions used in your scene.
  • Test long names and messages for wrapping, clipping, and overlap; avoid fixed widths that only fit short sample text.
  • Check the visibility and placement of image, video, or audio-related elements for event types that use them.
  • Use transitions or CSS animations for visual motion. If JavaScript controls when an alert exits, coordinate the timing with the configured duration.

Add JavaScript carefully

In an AlertBox, JavaScript can coordinate behavior and respond to event data exposed by the template. For the Custom Widget route, StreamElements documents onWidgetLoad for widget-load information, including fields and session information, and onEventReceived for event information such as the event listener type and payload. Consult the Custom Widget tutorial and widget structure reference for the supported patterns.

When using {{widgetDuration}} with JavaScript’s setTimeout, convert seconds to milliseconds: multiply the duration by 1,000. A mismatch can make an alert disappear too early or linger. Keep DOM handling small and test messages containing punctuation, special characters, and unusually long text. The documentation does not establish a platform-specific sanitization guarantee, so do not rely on one.

Free tools Windows power users keep installed

One-click scans. No signup required.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.
Rank #3
Logitech K400 Plus Wireless Touch TV Keyboard for PC-Connected TV - Black
  • Media-Friendly: The K400 Plus wireless touch TV keyboard gives you integrated, comfortable control of your PC-to-TV entertainment, eliminating the clutter of a separate keyboard and mouse
  • Plug-and-Play: Simply plug the Unifying receiver into a USB port and the wireless touchpad keyboard is ready to go; adjust controls using the Logitech Options Software to save preferred settings
  • Power-Packed: Built with laid-back control in mind, this wireless TV keyboard has a reliable and long battery life of up to 18 months (2), including an on/off button to help it go even longer
  • Wireless Freedom: Designed for seamless comfort and control, this HTPC keyboard boasts a range of up to 33 ft (1) wireless connectivity, with quiet keys and a large touchpad for easy navigation
  • Broad Compatibility: Designed for use with Windows 7, Windows 8, Windows 10 and later, Android 7 or later, and Chrome OS

When a Custom Widget makes more sense

Choose a Custom Widget when you need an independent alert-like component, configurable editor fields, or behavior that is awkward to express in an AlertBox template. The editor provides HTML, CSS, JavaScript, and FIELDS tabs; fields can expose options such as text and color choices to the overlay editor user.

Widget code runs in a protected sandbox with limitations. StreamElements specifically notes that cookies, console.*, and IndexedDB storage are unavailable. Do not build a widget around those APIs. Session-data keys can change over time, so follow the current reference rather than depending on undocumented payload shapes. External libraries may be included, but relying on them adds a dependency whose availability or behavior can change.

Rank #4
fifine D6 RGB Macro-Keyboard with 15 Programable Buttons for Multi-Tasking
  • [Customizable LCD Macro Keys] Ampligame D6 stream controller features a total of 15 customizable macro keys , allowing you to create and assign different operations according to your live stream needs. Launch the software or application through a simple finger press, and switch your OBS scenes, control your audio levels, which is very easy and convenient to use.
  • [Wide Application Compatibility] This OBS stream controller for PC has a wide range of software, applications and plugins options whether in the store or download from the computer. They work with OBS Studio, Streamlabs, Twitch, YouTube and more in the Fifine D6 stream controller. This contoller for content creators lets you customize your setup effortlessly. You can also drag-and-drop, set up and download from the console's store, with a very large number of plugins and icons to fill your streaming.
  • [Visual Operation Keypad] After setting and customizing your keys, you can see the application on the touchscreen of stream controller and press to control directly. No need to open plenty of windows/app interfaces on the PC screen one by one, the Fifine D6 macro keypad streamlines your workflow and improves the work efficiency. Let you know your demands having been satisfied with a visual feedback. (Tip: Please ensure both firmware and software are updated to the latest versions prior to initial use.)
  • [Vivid RGB Lighting] Brighten your gaming setup with customizable RGB effects on stream controller for gaming. There is a glowing RGB ring around the twitch stream controller, with a total of 9 different controllable and changeable modes. Matching the shortcut button’s look and gaming aura according to your personal preferences, dynamic RGB on video stream controller will give your viewers a more vivid game impression.
  • [Applied in Multi-Tasking Scenes] Whether you intend to use the PC media controller in gaming, live streaming, photography/graphics design, video editing, music creation or office work, this versatile streaming equipmentmakes multi-tasking easier. You can also create folders to generate different programs, and the individual scenes can be processed independently.
Independent reader supportYour contribution helps us test, update, and keep practical guides available for everyone.Support on Ko-Fi

Test in the actual streaming scene

An editor preview is useful for iteration, but it does not verify the whole delivery path. Add the overlay or its browser source to the destination scene, trigger representative event types, and check the result at the intended canvas size. Streamlabs’ own workflow likewise includes browser-source insertion and test controls; follow the instructions for the alert service you actually use.

  • Confirm the alert appears in the right scene and at the intended position.
  • Test each customized event type, including events with amounts, tiers, or messages where applicable.
  • Check wrapping, clipping, visibility, and animation timing with longer-than-usual content.
  • Verify the browser source dimensions and scene placement after changing the overlay resolution or layout.

Troubleshoot common alert problems

Symptom Likely cause What to check
The alert shows but its text or media is blank. The template uses a variable not provided for that event, or a variable name was mistyped. Check the event-specific variable list in the AlertBox reference; test with an event that supplies that value.
The correct alert type still has the default appearance. Custom code was not enabled for that specific event type, or the edited code belongs to a different event. Open the AlertBox options, select the relevant event tab, confirm Enable custom CSS, and verify you are editing the corresponding code.
An alert exits too soon or stays visible too long. The JavaScript timer and widget duration use different units or do not match. Remember that {{widgetDuration}} is in seconds and setTimeout expects milliseconds; multiply seconds by 1,000.
The alert works in preview but is missing or misplaced in the live scene. The browser source, scene, dimensions, or placement differs from the editor preview. Test in the actual streaming software scene and check its browser-source dimensions and position.
A widget script fails when it tries to use browser storage or logging. The protected widget sandbox blocks some APIs. Remove reliance on cookies, console.*, or IndexedDB and use documented widget events and fields instead.
Long names or messages overlap other alert elements. The layout was tuned only for short sample content. Test longer text, revise wrapping and sizing rules, and check again at the destination canvas dimensions.

Or let it run in the cloud

Customizing an alert changes how it looks; keeping a 24/7 YouTube stream running is a separate job. StreamNeo is a cloud service for looping uploaded videos on YouTube: upload a recording or build a playlist, add your YouTube stream key once, and go live. Your computer and home connection do not need to stay on. It supports the uploaded quality up to 4K 60fps at one flat price per slot, automatically recovers if YouTube drops the stream, and the first day is free with no card. The monthly price is $9.99 per month. See StreamNeo for details, or start the free first day.

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

Product prices and availability are accurate as of the date/time indicated and are subject to change. Any price and availability information displayed on Amazon at the time of purchase will apply.

Leave a Reply

Your email address will not be published. Required fields are marked *

Special offer. See more information about Outbyte and uninstall instructions. Please review EULA and Privacy policy.

More from the Wire

  1. Shenzhen desk3 min
    HONOR Expands Beyond Smartphones With Humanoid Robot RevealHONOR said it unveiled its first humanoid robot at MWC 2026 and named shopping assistance, workplace inspections, and supportive companionship as intended uses. Later Robotics D1 claims and a reported…
  2. Cupertino desk5 min
    Apple Unveils AirPods Max 2: The Upgrade That Should Have Happened Years AgoAirPods Max 2 adds H2-powered audio features and Apple claims up to 1.5× more effective ANC, but its design, Smart Case, and 20-hour battery rating are unchanged. Wired lossless audio…
  3. Cupertino desk4 min
    Apple’s OLED Touch MacBooks Are Coming—but the Dynamic Island Is the Real GambleApple has not announced an OLED touchscreen MacBook, but reports point to high-end models arriving in late 2026 or early 2027. The reported Mac Dynamic Island could be useful, but…
Recommended PC Tool
Recommended PC Tool
Outdated Drivers Are Slowing You DownFree scan - exact matches
Windows Errors? Fix Them Before They SpreadFree repair scan

Two free Windows tools

One Free Minute Could Fix That PC

Before you go - each of these free tools takes about a minute and tackles what quietly slows a Windows PC down.

Special offer. View Outbyte info, uninstall instructions, EULA, and Privacy Policy.