Socket
Socket
Sign inDemoInstall

@appgeist/react-select-material-ui

Package Overview
Dependencies
95
Maintainers
1
Versions
19
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @appgeist/react-select-material-ui

An outlined Material-UI input component based on react-select


Version published
Weekly downloads
33
increased by13.79%
Maintainers
1
Install size
8.90 MB
Created
Weekly downloads
 

Readme

Source

@appgeist/react-select-material-ui

NPM version License

AppGeist React-Select-Material-UI

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

Supports react-select/async and react-select/creatable.

Usage

import React, { Fragment, useState } from "react";
import Select from "@appgeist/react-select-material-ui";

const KINGDOMS = [
  { value: "AS", label: "Astur" },
  { value: "FA", label: "Fargos" },
  { value: "LE", label: "Laeden" },
  { value: "TH", label: "Therras" },
  { value: "VE", label: "Vessar" }
];

export default () => {
  const [kingdom, setKingdom] = useState(null);

  return (
    <Fragment>
      <h1>Fictional places:</h1>
      <Select
        id="place"
        label="Kingdom"
        placeholder="Select a kingdom"
        options={KINGDOMS}
        value={kingdom}
        onChange={setKingdom}
        isClearable
        helperText="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 - see the API docs.

Async/creatable select

  • Providing an { isAsync: true } prop a will generate an async select;
  • Providing an { isCreatable: true } prop a will generate a creatable select;
  • isAsync and isCreatable can be combined.

Replacing react-select components

You can augment the layout and functionality by providing custom react-select components in a components property like so:

const Option = props => {
  // custom Option implementation
};

const ClearIndicator = props => {
  // custom ClearIndicator implementation
};

return (
  <Select
    id="place"
    label="Kingdom"
    placeholder="Select a kingdom"
    options={KINGDOMS}
    value={kingdom}
    onChange={setKingdom}
    isClearable
    helperText="Where would you like to live?"
    components={{
      Option,
      ClearIndicator
    }}
  />
);

Peer dependencies

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

License

The ISC License.

Keywords

FAQs

Last updated on 11 Oct 2019

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc