0.4 cn


The weex builtin component switch is used to create and manage a IOS styled On/Off buttons used, for example, in the Settings app for options such as 'muted' and 'toggle color'.

Child Components

This component supports no child components.


  • checked: <boolean> true | false. The initial value of whether the status of this button is On or Off.

Other attributes please check out the common attributes.


Notes: There are several style properties that you mustn't use on this component, mostly have impact on the layout. Here are all the invalid properties:

  • width
  • height
  • min-width
  • min-height
  • margin and margin-xxs
  • padding and padding-xxs
  • border and border-xxs

Notes: Specially the width and height related properties is not configurable and the size of this component is fixed to 100x60 (for the design width 750px).


common events: check out the common events

Parameters of events' object

  • for change event:
    • value: the value of the component who dispatched this event, which is the boolean value true or false.
    • timestamp: the time stamp of the event.


  <switch checked="true"></switch>

results matching ""

    No results matching ""