apeman-react-switch

2.0.3 • Public • Published

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

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.

Links

/apeman-react-switch/

    Package Sidebar

    Install

    npm i apeman-react-switch

    Weekly Downloads

    3

    Version

    2.0.3

    License

    MIT

    Last publish

    Collaborators

    • okunishinishi