<switch>

0.4 cn

Summary

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.

Attributes

  • 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.

Styles

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).

Events

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.

Example

<div>
  <text>muted:</text>
  <switch checked="true"></switch>
</div>

results matching ""

    No results matching ""