Socket
Socket
Sign inDemoInstall

@types/react-select

Package Overview
Dependencies
Maintainers
1
Versions
138
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/react-select

TypeScript definitions for react-select


Version published
Weekly downloads
693K
decreased by-3.35%
Maintainers
1
Weekly downloads
 
Created

What is @types/react-select?

@types/react-select provides TypeScript type definitions for the react-select library, which is a flexible and customizable select input control for React applications.

What are @types/react-select's main functionalities?

Basic Select

This feature allows you to create a basic select input with predefined options.

import Select from 'react-select';

const options = [
  { value: 'chocolate', label: 'Chocolate' },
  { value: 'strawberry', label: 'Strawberry' },
  { value: 'vanilla', label: 'Vanilla' }
];

const MyComponent = () => (
  <Select options={options} />
);

Async Select

This feature allows you to create a select input that loads options asynchronously, useful for fetching data from an API.

import AsyncSelect from 'react-select/async';

const loadOptions = (inputValue: string, callback: (options: any[]) => void) => {
  setTimeout(() => {
    callback([
      { value: 'chocolate', label: 'Chocolate' },
      { value: 'strawberry', label: 'Strawberry' },
      { value: 'vanilla', label: 'Vanilla' }
    ]);
  }, 1000);
};

const MyComponent = () => (
  <AsyncSelect loadOptions={loadOptions} />
);

Creatable Select

This feature allows users to create new options in addition to selecting from predefined ones.

import CreatableSelect from 'react-select/creatable';

const options = [
  { value: 'chocolate', label: 'Chocolate' },
  { value: 'strawberry', label: 'Strawberry' },
  { value: 'vanilla', label: 'Vanilla' }
];

const MyComponent = () => (
  <CreatableSelect options={options} />
);

Other packages similar to @types/react-select

FAQs

Package last updated on 31 Dec 2020

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