MonalisaUI
  • Introduction
  • ArticleCard
  • Avatar
  • Badge
  • Button
  • Card
  • CheckBox
  • Col
  • Divider
  • Icon
  • Input
  • ListItem
  • Pricing
  • ProgressBar
  • Rating
  • Row
  • Segment
  • SocialIcon
  • Spinner
  • Switch
  • Tag
  • Text
  • Textarea
  • Theme
Powered by GitBook
On this page
  • Configuration
  • Example

Switch

PreviousSpinnerNextTag

Last updated 5 years ago

Renders a boolean input.

MonalisaUI

View full example:

import React from 'react';
import { View } from 'react-native';
import { Switch } from 'monalisa-ui';

const Example = () => (
  <View>
    <Switch />
  </View>
);

export default Example;

Configuration

Property

Default

Option

Description

style

-

-

Style for the switch

height

18

number

Height switch

bgColor

#3e50fa

string

Custom colors for the switch track

thumbColor

#fff

string

Color of the foreground switch grip

circleStyle

-

-

Style of the thumbColor

onChange

-

function

Return value switch

Example

  • switch customize

import React from 'react';
import { View } from 'react-native';
import { Switch } from 'monalisa-ui';

const Example = () => (
  <View>
    <Switch height={30} />
    <Switch bgColor="#ff0000" thumbColor="#53c641" />
    <Switch onChange={() => alert("Change value")} />
  </View>
);

export default Example;
Switch Example