2.0.3 • Published 9 years ago
apeman-react-switch v2.0.3
apeman-react-switch
apeman react package for switch components
Installation
$ npm install apeman-react-switch --saveDemo
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 | Switch on or not | |
| onTitle | string | '' | Title text for on state | |
| offTitle | string | '' | Title text for off state | |
| width | number | Width of component | ||
| id | uuid.v4() |
License
This software is released under the MIT License.