Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bscop/react-select

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bscop/react-select

Accessible select (in React).

  • 1.0.1
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

react-select

GitHub license npm version CircleCI Status Coverage

Accessible select (in React).

Install

npm i @bscop/react-select

Usage

import Select from "@bscop/react-select";

function App () {
  return (
    <Select
      label="Pick a fruit"
      onChange={
        (option) => {
          alert(`Option selected: "${option.label}"`);
        }
      }
      options={
        [
          {
            id: "a",
            label: "Apple",
          },
          {
            id: "b",
            label: "Banana",
          },
          {
            id: "c",
            label: "Cherry",
          },
        ]
      }
    />
  );
}

Props

  • [className]

Optional. Additional css class that is going to be applied on the select root element.

  • [disabled]

Optional. Default false. Determine whether the selected should be selected.

  • label

A label that describes the purpose of the select component.

  • options

List of options.
Each option should have shape as { id : string; label : string; value ?: string | number; }

  • [onChange]

Optional. Handler executed when the selected option change.
Receive the new selected option, and its index, as argument.

  • [placeholder]

Optional. Determine the label rendered in the select hook button when there's no selected option.

  • [renderHook]

Optional. Permits to customise the content of the select hook button.

  • [renderOption]

Optional. Permits to customise how each option is rendered.

  • [scrollable]

Optional. Default false. Determine whether the option list should be scrollable, in case the select contains a large number of options.

  • [value]

Optional. Value of the selected option.

CSS Custom properties

You can set the following CSS Custom properties to customize the look of the dropdown component:

:root {
  --main-color: black;
  --main-bg-color: white;
  --dropdown-hook-border-color: #000;
  --dropdown-hook-disabled-border-color: #bababa;
  --dropdown-border-color: #bababa;
  --select-caret: url("data:image/png;base64,...");
  --select-active-option-bg-color: #eaeaea;
}

Contribute

Read the guidelines.

Run tests

npm test

Coverage

Coverage reports are hosted on codecov.

npm run badge:coverage -- --token=<guid>

Bruno Scopelliti
www.brunoscopelliti.com

Keywords

FAQs

Package last updated on 17 Jun 2021

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

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc