Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/appgeist/react-select-material-ui

An outlined Material-UI input component based on react-select, inspired by the Autocomplete section in Material-UI docs
https://github.com/appgeist/react-select-material-ui

autocomplete autocompletion material-design material-ui react react-select ui-component

Last synced: 17 days ago
JSON representation

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

Awesome Lists containing this project

README

        

# @appgeist/react-select-material-ui

[![NPM version][npm-image]][npm-url]
[![License][license-image]][license-url]

![AppGeist React-Select-Material-UI](https://user-images.githubusercontent.com/581999/62422816-16dc7200-b6c1-11e9-940d-3638c26bdf93.png)

An outlined [Material-UI](https://material-ui.com) input component based on [react-select](https://react-select.com/home), inspired by the [Autocomplete section in Material-UI docs](https://material-ui.com/components/autocomplete).

Supports [react-select/async](https://react-select.com/async) and [react-select/creatable](https://react-select.com/creatable).

## Usage

```js
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 (

Fictional places:




);
};
```

## 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](https://react-select.com/props).

## Async/creatable select

- Providing an `{ isAsync: true }` prop a will generate an [async](https://react-select.com/async) select;
- Providing an `{ isCreatable: true }` prop a will generate a [creatable](https://react-select.com/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](https://react-select.com/components) in a `components` property like so:

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

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

return (

);
```

## Peer dependencies

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

## License

The [ISC License](LICENSE).

[npm-image]: https://img.shields.io/npm/v/@appgeist/react-select-material-ui.svg?style=flat-square
[npm-url]: https://www.npmjs.com/package/@appgeist/react-select-material-ui
[license-image]: https://img.shields.io/npm/l/@appgeist/react-select-material-ui.svg?style=flat-square
[license-url]: LICENSE