Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

An outlined Material-UI input component based on react-select, inspired by the Autocomplete section in Material-UI docs

License

NotificationsYou must be signed in to change notification settings

appgeist/react-select-material-ui

Repository files navigation

NPM versionLicense

AppGeist React-Select-Material-UI

An outlinedMaterial-UI input component based onreact-select, inspired by theAutocomplete section in Material-UI docs.

Supportsreact-select/async andreact-select/creatable.

Usage

importReact,{Fragment,useState}from"react";importSelectfrom"@appgeist/react-select-material-ui";constKINGDOMS=[{value:"AS",label:"Astur"},{value:"FA",label:"Fargos"},{value:"LE",label:"Laeden"},{value:"TH",label:"Therras"},{value:"VE",label:"Vessar"}];exportdefault()=>{const[kingdom,setKingdom]=useState(null);return(<Fragment><h1>Fictional places:</h1><Selectid="place"label="Kingdom"placeholder="Select a kingdom"options={KINGDOMS}value={kingdom}onChange={setKingdom}isClearablehelperText="Where would you like to live?"/></Fragment>);};

Component props

  • id (string);
  • label (string);
  • margin (string, one of 'none', 'normal' or 'dense')
  • error (string);
  • helperText (string);
  • isAsync (bool);
  • isCreatable (bool);
  • all other props are forwarded to react-select component - seethe API docs.

Async/creatable select

  • Providing an{ isAsync: true } prop a will generate anasync select;
  • Providing an{ isCreatable: true } prop a will generate acreatable select;
  • isAsync andisCreatable can be combined.

Replacing react-select components

You can augment the layout and functionality by providingcustom react-select components in acomponents property like so:

constOption=props=>{// custom Option implementation};constClearIndicator=props=>{// custom ClearIndicator implementation};return(<Selectid="place"label="Kingdom"placeholder="Select a kingdom"options={KINGDOMS}value={kingdom}onChange={setKingdom}isClearablehelperText="Where would you like to live?"components={{      Option,      ClearIndicator}}/>);

Peer dependencies

  • react (> 16.9);
  • prop-types;
  • clsx;
  • @material-ui/core;
  • @material-ui/styles.

License

TheISC License.

About

An outlined Material-UI input component based on react-select, inspired by the Autocomplete section in Material-UI docs

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors2

  •  
  •  

[8]ページ先頭

©2009-2025 Movatter.jp