Skip to content
This repository was archived by the owner on Dec 23, 2022. It is now read-only.

Commit 57b5d8e

Browse files
committed
Update the readme.
1 parent 8b3db90 commit 57b5d8e

File tree

2 files changed

+22
-14
lines changed

2 files changed

+22
-14
lines changed

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
MIT License
22

3-
Copyright (c) 2016 Team Wertarbyte
3+
Copyright (c) 2016-2017 Team Wertarbyte
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 21 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ If you want to try the component yourself instead of watching a gif, head over t
1111

1212
## Installation
1313
```shell
14-
npm i --save material-ui-chip-input
14+
npm i --save material-ui-chip-input@next
1515
```
1616

1717
## Usage
@@ -38,43 +38,51 @@ import ChipInput from 'material-ui-chip-input'
3838
| Name | Type | Default | Description |
3939
| --- | --- | --- | --- |
4040
| allowDuplicates | `bool` | `false` | Allows duplicate chips if set to true. |
41-
| chipContainerStyle | `object` | | Override the inline-styles of the chip container element. |
42-
| chipRenderer | `function` | | A function of the type `({ value, text, chip, isFocused, isDisabled, handleClick, handleRequestDelete, defaultStyle }, key) => node` that returns a chip based on the given properties. This can be used to customize chip styles. Each item in the `dataSource` array will be passed to `chipRenderer` as arguments `chip`, `value` and `text`. If `dataSource` is an array of objects and `dataSourceConfig` is present, then `value` and `text` will instead correspond to the object values defined in `dataSourceConfig`. If `dataSourceConfig` is not set and `dataSource` is an array of objects, then a custom `chipRenderer` must be set. `chip` is always the raw value from `dataSource`, either an object or a string.|
41+
| chipRenderer | `function` | | A function of the type `({ value, text, chip, isFocused, isDisabled, handleClick, handleRequestDelete, className }, key) => node` that returns a chip based on the given properties. This can be used to customize chip styles. Each item in the `dataSource` array will be passed to `chipRenderer` as arguments `chip`, `value` and `text`. If `dataSource` is an array of objects and `dataSourceConfig` is present, then `value` and `text` will instead correspond to the object values defined in `dataSourceConfig`. If `dataSourceConfig` is not set and `dataSource` is an array of objects, then a custom `chipRenderer` must be set. `chip` is always the raw value from `dataSource`, either an object or a string.|
42+
| classes | `object` | | Extends the styles applied to this component. |
4343
| clearOnBlur | `bool` | `true` | If true, clears the input value after the component loses focus. |
4444
| dataSource | `array` | | Data source for auto complete. This should be an array of strings or objects.|
4545
| dataSourceConfig | `object` | | Config for objects list dataSource, e.g. `{ text: 'text', value: 'value' }`. If not specified, the `dataSource` must be a flat array of strings or a custom `chipRenderer` must be set to handle the objects. |
4646
| defaultValue | `string[]` | | The chips to display by default (for uncontrolled mode). |
4747
| disabled | `bool` | `false` | Disables the chip input if set to true. |
48-
| errorText | `node` | | The error text to display. |
49-
| floatingLabelText | `node` | | The content of the floating label. |
48+
| helperText | `node` | | The helper text to display. |
5049
| fullWidth | `bool` | `false` | If true, the chip input will fill the available width. |
5150
| fullWidthInput | `bool` | `false` | If true, the input field will always be below the chips and fill the available space. By default, it will try to be beside the chips. |
52-
| hintText | `node` | | The hint text to display. |
53-
| id | `string` | _a unique id_ | The id prop for the text field, should be set to some deterministic value if you use server-side rendering. |
51+
| label | `node` | | The content of the floating label. |
5452
| newChipKeyCodes | `number[]` | `[13]` (enter key) | The key codes used to determine when to create a new chip. |
5553
| onBeforeRequestAdd | `function` | | Callback function that is called with the chip to be added and should return true to add the chip or false to prevent the chip from being added without clearing the text input. |
5654
| onBlur | `function` | | Callback function that is called with `event` when the input loses focus, where `event.target.value` is the current value of the text input. |
5755
| onChange | `function` | | Callback function that is called when the chips change (in uncontrolled mode). |
58-
| onClick | `function` | | Callback function that is called when text input is clicked. |
5956
| onRequestAdd | `function` | | Callback function that is called when a new chip was added (in controlled mode). |
6057
| onRequestDelete | `function` | | Callback function that is called when a new chip was removed (in controlled mode). |
6158
| onUpdateInput | `function` | | Callback function that is called when the input changes (useful for auto complete). |
6259
| openOnFocus | `bool` | `false` | Opens the auto complete list on focus if set to true. |
63-
| style | `object` | | Override the inline-styles of the root element. |
60+
| placeholder | `node` | | A short placeholder that is displayed if the input has no values. |
6461
| value | `string[]` | | The chips to display (enables controlled mode if set). |
6562

6663

67-
Additionally, most other properties of Material UI's [Auto Complete][mui-auto-complete] and [Text Field][mui-text-field] should be supported. Please open an issue if something is missing or does not work as expected.
64+
Any other properties supplied will be [spread to the root element](https://material-ui-next.com/guides/api/#spread). The properties of [<FormControl />](https://material-ui-next.com/api/form-control/) are also available.
65+
66+
## CSS API
67+
You can customize the class names used by `ChipInput` with the `classes` property. It accepts the following keys:
68+
* `root`
69+
* `inputRoot`
70+
* `input`
71+
* `chipContainer`
72+
* `label`
73+
* `helperText`
74+
* `chip`
75+
76+
Have a look at [this guide](https://material-ui-next.com/customization/overrides/#overriding-with-classes) for more detail.
6877

6978
## Credits
70-
The code for the input component was adapted from Material UI's [Auto Complete][mui-auto-complete] and [Text Field][mui-text-field] that we all know and love.
79+
The code for the input component was adapted from Material UI's [Text Field][mui-text-field] that we all know and love.
7180

7281
## License
7382
The files included in this repository are licensed under the MIT license.
7483

7584
[chipspec]: https://material.google.com/components/chips.html#chips-behavior
7685
[mui]: http://www.material-ui.com/#/
7786
[angular-chips]: https://material.angularjs.org/latest/demo/chips
78-
[mui-text-field]: http://www.material-ui.com/#/components/text-field
79-
[mui-auto-complete]: http://www.material-ui.com/#/components/auto-complete
87+
[mui-text-field]: https://material-ui-next.com/api/text-field/
8088
[gh-pages]: https://teamwertarbyte.github.io/material-ui-chip-input/

0 commit comments

Comments
 (0)