Socket
Socket
Sign inDemoInstall

@wedgekit/checkbox-list

Package Overview
Dependencies
4
Maintainers
18
Versions
28
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @wedgekit/checkbox-list

## Purpose


Version published
Maintainers
18
Created

Readme

Source

CheckboxList

Purpose

The CheckboxList is a reuseable, aria-compliant list of checkboxes. Wedgekit uses CheckboxList in the SwitchGroup from '@wedgekit/switch-group' and the Multiselect from '@wedgekit/select'.

Basic Implementation

import CheckboxList, { Option } from '@wedgekit/checkbox-list';

const Example = () => {
  const [value, setValue] = React.useState([]);

  return (
    <CheckboxList
      label="My CheckboxList"
      options={[
        { label: 'Option 1', id: 'Option1' },
        { label: 'Option 2', id: 'Option2' },
        { label: 'Option 3', id: 'Option3' },
      ]}
      value={value}
      onChange={setValue}
    />
  );
};

render(<Example />);

Props

allowMultiple

Type: boolean

Required: ❌

Allows more than one option to be selected, defaults to true

className

Type: string

Required: ❌

This is exposed but is only here so that styled-components will be able to style components correctly. Please do not use this unless you really know what you are doing.

options

Type:

{
  id: string | number,;
  label: string;
  disabled?: boolean;
}[]

Required: ✅

disabled

Type: boolean

Required: ❌

filter

Type: string

Required: ❌

CheckboxList can be provided a filter to control which options are shown to the user. Options will be filtered based on their label prop. Filtered options are not visible, but will remain selected as part of CheckboxList's value if it was selected before being filtered.

ref

Type: React.Ref

Required: ❌

The forwarded ref giving a user access to the underlying HTML input.

label

Type: string

Required: ✅

Aria compliant text for all child components to be 'labeled-by', required on all wedgekit components.

tabIndex

Type: number

Required: ❌

Sets the tabIndex for the listbox element. Default: tabIndex={0}

value

Type: (string | number)[]

Required: ✅

An array of Option ids used signify which Options should display as 'checked'.

onBlur

Type: (event:React.FocusEvent) => void

Required: ❌

onChange

Type: (value:(string | number)[], event: React.ChangeEvent<HTMLInputElement) => void

Required: ✅

Function that will fire when a checkbox value is changed.

onKeyDown

Type: (event: SyntheticEvent<*>) => void

Required: ❌

An optional callback when a key is pressed

FAQs

Last updated on 10 Nov 2022

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