README
apeman-react-switch
apeman react package for switch components
Installation
$ npm install apeman-react-switch --save
Demo
Live demo is hosted on GitHub Pages.
Usage
'use strict'
import React from 'react'
import {ApSwitch, ApSwitchStyle} from 'apeman-react-switch'
const ExampleComponent = React.createClass({
render () {
const s = this
let { state } = s
let { on } = state
return (
<div>
<ApSwitchStyle />
<ApSwitchStyle highlightColor="#b35600"/>
<ApSwitch on={ on }
onTap={ s._toggleSwitch }
/>
</div>
)
},
_toggleSwitch () {
const s = this
let { state } = s
let { on } = state
s.setState({ on: !on })
}
})
Components
ApSwitchStyle
Props
Name | Type | Default | Description |
---|---|---|---|
style | object | {} | |
highlightColor | string | ApStyle.DEFAULT_HIGHLIGHT_COLOR | |
backgroundColor | ApStyle.DEFAULT_BACKGROUND_COLOR | ||
borderColor | '#CCC' |
ApSwitch
Props
Name | Type | Default | Description |
---|---|---|---|
on | bool | false | |
onTitle | string | '' | |
offTitle | string | '' | |
width | number | ||
id | uuid.v4() |
License
This software is released under the MIT License.