πŸš€ Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more β†’
Socket
Sign inDemoInstall
Socket

chakra-react-select

Package Overview
Dependencies
Maintainers
1
Versions
147
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

chakra-react-select

A Chakra UI wrapper for the popular library React Select

6.1.0
latest
Source
npm
Version published
Weekly downloads
158K
-6.85%
Maintainers
1
Weekly downloads
Β 
Created

What is chakra-react-select?

chakra-react-select is a package that integrates the popular react-select library with Chakra UI, providing a set of customizable and accessible select components that are styled using Chakra UI's design system.

What are chakra-react-select's main functionalities?

Basic Select

This code demonstrates a basic select component using chakra-react-select. It provides a dropdown with options for Chocolate, Strawberry, and Vanilla.

import React from 'react';
import { ChakraProvider } from '@chakra-ui/react';
import { Select } from 'chakra-react-select';

const App = () => (
  <ChakraProvider>
    <Select
      options={[
        { value: 'chocolate', label: 'Chocolate' },
        { value: 'strawberry', label: 'Strawberry' },
        { value: 'vanilla', label: 'Vanilla' }
      ]}
    />
  </ChakraProvider>
);

export default App;

Multi-Select

This code demonstrates a multi-select component using chakra-react-select. It allows users to select multiple options from the dropdown.

import React from 'react';
import { ChakraProvider } from '@chakra-ui/react';
import { Select } from 'chakra-react-select';

const App = () => (
  <ChakraProvider>
    <Select
      isMulti
      options={[
        { value: 'chocolate', label: 'Chocolate' },
        { value: 'strawberry', label: 'Strawberry' },
        { value: 'vanilla', label: 'Vanilla' }
      ]}
    />
  </ChakraProvider>
);

export default App;

Custom Styles

This code demonstrates how to apply custom styles to the select component using chakra-react-select. The control and options are styled with custom colors.

import React from 'react';
import { ChakraProvider } from '@chakra-ui/react';
import { Select } from 'chakra-react-select';

const customStyles = {
  control: (provided) => ({
    ...provided,
    backgroundColor: 'lightblue'
  }),
  option: (provided, state) => ({
    ...provided,
    color: state.isSelected ? 'white' : 'black',
    backgroundColor: state.isSelected ? 'blue' : 'white'
  })
};

const App = () => (
  <ChakraProvider>
    <Select
      styles={customStyles}
      options={[
        { value: 'chocolate', label: 'Chocolate' },
        { value: 'strawberry', label: 'Strawberry' },
        { value: 'vanilla', label: 'Vanilla' }
      ]}
    />
  </ChakraProvider>
);

export default App;

Other packages similar to chakra-react-select

Keywords

accessibility

FAQs

Package last updated on 25 Mar 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