2.0.3 • Published 9 years ago

apeman-react-switch v2.0.3

Weekly downloads
2
License
MIT
Repository
github
Last release
9 years ago

apeman-react-switch

Build Status Code Climate Code Coverage npm Version JS Standard

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

NameTypeDefaultDescription
styleobject{}
highlightColorstringApStyle.DEFAULT_HIGHLIGHT_COLOR
backgroundColorApStyle.DEFAULT_BACKGROUND_COLOR
borderColor'#CCC'

ApSwitch

Props

NameTypeDefaultDescription
onboolfalseSwitch on or not
onTitlestring''Title text for on state
offTitlestring''Title text for off state
widthnumberWidth of component
iduuid.v4()

License

This software is released under the MIT License.

Links