Theme Customizer

Audio Button

The Audio Button component enables triggerable interface sounds on user interaction. It allows you to configure click sound effects declaratively using HTML5 attributes, or execute playback dynamically in Javascript.

<!-- Simple audio button -->
<button class="btn" data-role="audio-button" data-audio-src="sounds/click.mp3">
    Click Me
</button>

<!-- Audio button with custom volume -->
<button class="btn success" data-role="audio-button"
        data-audio-src="sounds/success.mp3"
        data-audio-volume="0.8">
    Success
</button>

<!-- Play sound via JavaScript event -->
<button class="btn primary" onclick="FrankUI.playSound('sounds/notification.mp3', 0.5)">
    Notification
</button>

Markup & Configuration

Procedural Audio Fallback

To support rapid developer testing or offline use without local file assets, the audio engine automatically intercepts requests to standard sound paths and plays pleasant Web Audio API synthesized tones:

JavaScript API

You can play sounds programmatically at any time inside your scripts:

// Play a sound effect at full volume
FrankUI.playSound("sounds/notification.mp3");

// Play a sound effect with 50% volume
FrankUI.playSound("sounds/click.mp3", 0.5);

// AudioButton API alias compatibility
AudioButton.playSound("sounds/notification.mp3");