MCPcopy Index your code
hub / github.com/benbowes/react-responsive-select

github.com/benbowes/react-responsive-select @6.0.3

Chat with this repo
repository ↗ · DeepWiki ↗ · release 6.0.3 ↗ · + Follow
105 symbols 185 edges 51 files 1 documented · 1% 1 cross-repo links
What it actually does AI analysis from the code graph — generated when you open this
loading…
README

react-responsive-select

Build status

A customisable, touchable, React single-select / multi-select form control.

Built with keyboard and screen reader accessibility in mind.

Features

  • Single and Multi select modes
  • Accessible WAI ARIA compliance
  • Touch friendly
  • Keyboard friendly
  • Similar interaction experience across platforms
  • Custom label rendering
  • Custom option markup
  • Option headers
  • Mimics keyboard functionality where possible (sans multiselect)
  • Easy slot-in to your design system

Getting started

Install the dependency - https://www.npmjs.com/package/react-responsive-select

npm install react-responsive-select -save-dev

Example usage (Single Select):

import React from 'react';
import { Select, CaretIcon, ModalCloseButton } from 'react-responsive-select';

// for default styles...
import 'react-responsive-select/dist/react-responsive-select.css';

const Form = () => (
  <form>
    <Select
      name="carType1"
      modalCloseButton={<ModalCloseButton />}
      options={[
        { value: 'null', text: 'Any' },
        { value: 'alfa-romeo', text: 'Alfa Romeo' },
        { value: 'bmw', text: 'BMW' },
        { value: 'fiat', text: 'Fiat' },
        { value: 'subaru', text: 'Subaru' },
        { value: 'suzuki', text: 'Suzuki' },
        { value: 'tesla', text: 'Tesla' },
        { value: 'volvo', text: 'Volvo' },
        { value: 'zonda', text: 'Zonda' },
      ]}
      caretIcon={<CaretIcon />}
      prefix="Car1: "
      selectedValue="subaru"
      onChange={(newValue) => console.log('onChange', newValue)}
      onSubmit={() => console.log('onSubmit')}
    />
  </form>
);

Example usage (Multi Select):

import React from 'react';
import { Select, CaretIcon, MultiSelectOptionMarkup, ModalCloseButton } from 'react-responsive-select';

// for default styles...
import 'react-responsive-select/dist/react-responsive-select.css';

const Form = () => (
  <form>
    <Select
      multiselect={true}
      name="make6"
      selectedValues={['fiat']}
      modalCloseButton={<ModalCloseButton />}
      options={[
        {
          value: 'any',
          text: 'Any',
          markup: <MultiSelectOptionMarkup text="Any" />,
        },
        {
          value: 'fiat',
          text: 'Fiat',
          markup: <MultiSelectOptionMarkup text="Fiat" />,
        },
        {
          value: 'subaru',
          text: 'Subaru',
          markup: <MultiSelectOptionMarkup text="Subaru" />,
        },
        {
          value: 'suzuki',
          text: 'Suzuki',
          markup: <MultiSelectOptionMarkup text="Suzuki" />,
        },
      ]}
      caretIcon={<CaretIcon />}
      onChange={(...rest) => console.log(rest)}
      onSubmit={() => console.log('onSubmit')}
    />
  </form>
);

Examples & Demo

https://benbowes.github.io/react-responsive-select/

API

https://benbowes.github.io/react-responsive-select/#/API

Screen Reader Demo

https://benbowes.github.io/react-responsive-select/#/Screen%20reader%20demo

Business Rules

Have a read of README_BUSINESS_RULES.md

Extension points exported contracts — how you extend this code

IProps (Interface)
(no doc)
src/types/index.tsx
IOutputMultiSelectOptionSansDisabled (Interface)
(no doc)
src/reducers/lib/getInitialMultiSelectOption.ts
TProps (Interface)
(no doc)
src/components/MultiSelectOption.tsx
TArgs (Interface)
(no doc)
src/lib/getCustomLabelText.ts
IFormProps (Interface)
(no doc)
src/docs/recipes/ControlledExample2Form.tsx
IState (Interface)
(no doc)
src/types/index.tsx
IFindClosestValidOptionOutput (Interface)
(no doc)
src/reducers/lib/getInitialMultiSelectOption.ts
TProps (Interface)
(no doc)
src/components/SingleSelectOption.tsx

Core symbols most depended-on inside this repo

updateState
called by 16
src/react-responsive-select.tsx
nextValidIndex
called by 13
src/lib/nextValidIndex.ts
mergeIsAlteredState
called by 5
src/reducers/lib/mergeIsAlteredState.ts
focusButton
called by 4
src/react-responsive-select.tsx
getSingleSelectSelectedOption
called by 4
src/reducers/lib/getSingleSelectSelectedOption.ts
containsClassName
called by 4
src/lib/containsClassName.ts
isEqual
called by 3
src/lib/isEqual.ts
getMultiSelectInitialSelectedOptions
called by 2
src/reducers/lib/getMultiSelectInitialSelectedOptions.ts

Shape

Function 40
Method 28
Interface 25
Class 12

Languages

TypeScript100%

Modules by API surface

src/react-responsive-select.tsx9 symbols
src/components/SingleSelectOption.tsx8 symbols
src/components/SingleSelect.tsx8 symbols
src/components/MultiSelectOption.tsx8 symbols
src/types/index.tsx7 symbols
src/components/MultiSelect.tsx7 symbols
src/docs/recipes/ControlledExample2App.tsx5 symbols
src/Extras.tsx5 symbols
src/reducers/lib/getInitialMultiSelectOption.ts4 symbols
src/reducers/lib/mergeIsAlteredState.ts2 symbols
src/reducers/lib/getSingleSelectSelectedOption.ts2 symbols
src/reducers/lib/getSelectedValueIndex.ts2 symbols

Used by 1 indexed graphs manifest dependencies, hub-wide

For agents

$ claude mcp add react-responsive-select \
  -- python -m otcore.mcp_server <graph>

⬇ download graph artifact

Ask about this repo answers extend the page