1.1.1 ā€¢ Published 4 years ago

react-free-dropdown v1.1.1

Weekly downloads
20
License
MIT
Repository
github
Last release
4 years ago

Easy custom dropdown list with React

Actions Status npm install size npm downloads

Get Started šŸ“¦

react-free-dropdown install the package.

npm install react-free-dropdown

Usage šŸ“ƒ

import React from 'react';
import { Rfdd, RfddOption } from 'react-free-dropdown';

const App = () => {
  const [value, setValue] = React.useState('');
  return (<>
      <Rfdd onChange={optionValue => setValue(optionValue)}>
        <RfddOption value="Apple">Apple</RfddOption>
        <RfddOption value="Grape">Grape</RfddOption>    
      </Rfdd>
      <p>{value}</p>
    </>);
}

export default App;

Rfdd Property ā›·

PropertyTypeDescriptionsExample
selectClassNamestringselect classNameselectClassName="select-classname"
selectStyleReact.CSSPropertiesselect component styleselectStyle={{border: '1px solid red'}}
optionClassNamestringoption classNameoptionClassName="option-classname"
optionStylestringall option custom styleoptionStyle='border: 1px solid red;'
styleReact.CSSPropertiesdropdown wrapper stylestyle={{border: '1px solid red'}}
classNamestringdropdown wrapper classNameclassName="wrapper-classname"
focusStyleReact.CSSPropertiesif focus use stylefocusStyle={{border: '1px solid red'}}
valuestringselected valuevalue={value}
childrenReact.ReactElement<RfddOptionType, 'RfddOption'>[]only use RfddOption component<RfddOption>option</RfddOption>
onChange(value: string) => voidchange value functiononChange={(optionValue) => setValue(optionValue)}
modelight or darklight or dark modemode='dark'
hoverStylestringcustom hover stylehoverStyle='border: 1px solid red;'
iconanyusage import image import image from './example.png'icon={image}
hiddenIconbooleanhidden iconhiddenIcon={true}
placeholderstringsetting placeholderplaceholder='area'
listStylestringul list stylelistStyle='max-height:200px'
optionOnClick() => voidall option onClickoptionOnClick={() => console.log('onClick')}

RfddOption Property šŸ‚

PropertyTypeDescriptionsExample
valuestringoption valuevalue='option-value'
styleReact.CSSPropertiesmust be entered as camelcasestyle={{ border: '1px solid red' }}
classNamestringmust be entered as camelcaseclassName="class-name"
childrenReact.ReactNodeoption childrenoption text or <div>option Element</div>
hoverStylestringeach option custom hover stylehoverStyle='border: 1px solid red;'
onClick() => voidonChange before active functiononClick={() => console.log('onClick')}

Preview šŸŽ†

react-free-dropdown preview

šŸ”ŽPlay the example

1.1.1

4 years ago

1.1.0

4 years ago

1.0.15

4 years ago

1.0.14

4 years ago

1.0.13

4 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.9

4 years ago

1.0.8

4 years ago

1.0.7

4 years ago

1.0.6

4 years ago

1.0.5

4 years ago

1.0.4

4 years ago

1.0.2

4 years ago

1.0.3

4 years ago

1.0.1

4 years ago

1.0.0

4 years ago