Skip to content

Latest commit

 

History

History
34 lines (24 loc) · 866 Bytes

Switch.md

File metadata and controls

34 lines (24 loc) · 866 Bytes

<Switch />

开关选择组件

使用

import React from 'react';
import { Switch } from 'sparrowcool';

const HomeScreen = () => {

    const [status,setStatus]=React.useState(false);

    return (
       <Switch value={status} onValueChange={()=>setStatus(!status)} />
    )
    
});

Props

参数名 类型 必填 默认值 说明
value boolean / 表示此开关是否打开;false为关闭状态
onValueChange () => void / 当value改变时,会调用该方法
disabled boolean false 默认为false;如果为true则禁用此组件的交互
onOpenBgColor string #65C066 打开时的背景色
onCloseBgColor string #dddddd 关闭时的背景色
circleColor string white 圆的颜色
scalingRatio number 1 整体缩放比例