🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Sign inDemoInstall
Socket

@commercetools-uikit/checkbox-input

Package Overview
Dependencies
Maintainers
3
Versions
1054
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@commercetools-uikit/checkbox-input

An input component that works as checkbox input.

19.25.1
latest
Source
npm
Version published
Weekly downloads
0
Maintainers
3
Weekly downloads
 
Created
Source

CheckboxInput

Description

An input component that works as checkbox input.

Installation

yarn add @commercetools-uikit/checkbox-input
npm --save install @commercetools-uikit/checkbox-input

Additionally install the peer dependencies (if not present)

yarn add react
npm --save install react

Usage

import CheckboxInput from '@commercetools-uikit/checkbox-input';

const Example = () => (
  <div>
    <CheckboxInput
      value="foo-radio-value"
      onChange={(event) => alert(event.target.value)}
      isChecked={true}
    >
      A pre-checked option
    </CheckboxInput>
    <CheckboxInput
      value="bar-radio-value"
      onChange={(event) => alert(event.target.value)}
      isDisabled={true}
    >
      A disabled option
    </CheckboxInput>
    <CheckboxInput
      value="unknown-radio-value"
      onChange={(event) => alert(event.target.value)}
      aria-label={'An Option Without a Visible Label'}
    />
  </div>
);

export default Example;

Properties

PropsTypeRequiredDefaultDescription
idstringUsed as HTML id attribute. An id is auto-generated when it is not specified.
namestringUsed as HTML name attribute of the input component
valuestringValue of the input component.
isCheckedbooleanfalseThe checked property sets the checked state of the checkbox.
isIndeterminatebooleanIf true, this state is shown as a dash in the checkbox, and indicates that its state is neither checked nor unchecked. This is most often used when the checkbox is tied to a collection of items in mixed states (E.g nested checkboxes). This takes precedence visually in case isChecked is marked as true
onChangeChangeEventHandlerWill be triggered whenever an CheckboxInput is clicked. Called with event
isHoveredbooleanForces CheckboxInput to be rendered in a hovered state. Needed for cases when hovered appearance should be triggered by the parent component and not the CheckboxInput itself. CheckboxInput is capable of handling it's own hovering without the need to pass this prop.
isDisabledbooleanfalseDisables the CheckboxInput
isReadOnlybooleanMakes the CheckboxInput readonly
hasErrorbooleanfalseIndicates that the checkbox has an error
childrenReactNodeThe descriptive text of the CheckboxInput, used as its label.

data-* and aria-* props

The component further forwards all data- and aria- attributes to the underlying component. In order to keep the component more accessible to screen-readers, please make sure that if no children prop is present (for displaying a checkbox without any text), a corresponding aria-label property is provided instead.

Keywords

javascript

FAQs

Package last updated on 09 May 2025

Did you know?

Socket

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