Socket
Socket
Sign inDemoInstall

rc-checkbox

Package Overview
Dependencies
10
Maintainers
6
Versions
48
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    rc-checkbox

checkbox ui component for react


Version published
Maintainers
6
Install size
2.44 MB
Created

Package description

What is rc-checkbox?

The rc-checkbox npm package provides React components for creating and managing checkboxes. It allows developers to easily implement checkbox functionality in their React applications with customizable options.

What are rc-checkbox's main functionalities?

Basic Checkbox

This code sample demonstrates how to use the rc-checkbox package to create a basic checkbox component in a React application.

{"import React from 'react';\nimport Checkbox from 'rc-checkbox';\n\nclass App extends React.Component {\n  render() {\n    return (\n      <Checkbox />\n    );\n  }\n}\n\nexport default App;"}

Controlled Checkbox

This code sample shows how to create a controlled checkbox where the checked state is managed by the component's state using React hooks.

{"import React, { useState } from 'react';\nimport Checkbox from 'rc-checkbox';\n\nfunction App() {\n  const [checked, setChecked] = useState(false);\n\n  const handleChange = (e) => {\n    setChecked(e.target.checked);\n  };\n\n  return (\n    <Checkbox\n      checked={checked}\n      onChange={handleChange}\n    />\n  );\n}\n\nexport default App;"}

Custom Styles

This code sample illustrates how to apply custom styles to the checkbox component using the style prop.

{"import React from 'react';\nimport Checkbox from 'rc-checkbox';\n\nfunction App() {\n  return (\n    <Checkbox\n      style={{ fontSize: '20px', color: 'blue' }}\n    />\n  );\n}\n\nexport default App;"}

Other packages similar to rc-checkbox

Readme

Source

rc-checkbox


React Checkbox

NPM version build status Test coverage Dependencies DevDependencies npm download

install

rc-checkbox

Usage

var Checkbox = require('rc-checkbox');
var React = require('react');
var ReactDOM = require('react-dom');
ReactDOM.render(<Checkbox />, container);

API

props

nametypedefaultdescription
prefixClsStringrc-checkbox
classNameString''additional class name of root node
nameStringsame with native input checkbox
checkedenum: 0,1,2
defaultCheckedenum: 0,1,20same with native input checkbox
onChangeFunction(e:Event, checked:Number)called when checkbox is changed. e is native event, checked is original checked state.

Development

npm install
npm start

Example

http://localhost:8001/examples/

online example: http://react-component.github.io/checkbox/examples/

Test Case

npm test
npm run chrome-test

Coverage

npm run coverage

open coverage/ dir

License

rc-checkbox is released under the MIT license.

Keywords

FAQs

Last updated on 24 Sep 2019

Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc