How to Build a Custom On/Off Toggle Switch in Axure

This step‑by‑step guide shows how to create a gray “off” state and a blue “on” state for a toggle switch in Axure, covering shape drawing, styling, dynamic panel setup, and click interaction configuration.

AI Software Product Manager
AI Software Product Manager
AI Software Product Manager
How to Build a Custom On/Off Toggle Switch in Axure

Creating the “Off” State

Drag a rectangle of size 44 × 22 onto the canvas. Set its fill colour to #CCCCCC, corner radius to 23 px, border width to 0, and add the text “关”. Align the text to the right, set margins to 2 px top, 2 px right, 6 px bottom, 2 px left, and set the text colour to #FFFFFF.

Off‑state rectangle
Off‑state rectangle

Drag an ellipse of size 18 × 18 and set its border width to 0.

Off‑state ellipse
Off‑state ellipse

Select both shapes, right‑click → Convert to Dynamic Panel . Rename the default state to “关” (Off).

Dynamic panel with Off state
Dynamic panel with Off state

Creating the “On” State

Duplicate the dynamic panel created above and rename the new state to “开” (On).

In the “开” state change the text from “关” to “开”, align the text to the left, set the fill colour to #2D8BEF, and adjust margins to 6 px top, 2 px right, 2 px bottom, 2 px left.

On‑state rectangle
On‑state rectangle

Add a Click interaction to the dynamic panel that toggles between the “关” and “开” states, turning the widget into a functional toggle button.

Click interaction configuration
Click interaction configuration
frontendinteractionAxuretoggle switch
AI Software Product Manager
Written by

AI Software Product Manager

Daily updates of Xiaomi's latest AI internal materials

0 followers
Reader feedback

How this landed with the community

Sign in to like

Rate this article

Was this worth your time?

Sign in to rate
Discussion

0 Comments

Thoughtful readers leave field notes, pushback, and hard-won operational detail here.