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

Commit

Permalink
add chip container prop
Browse files Browse the repository at this point in the history
  • Loading branch information
Josh de la Peña committed May 25, 2020
1 parent 893ad3d commit 75647ed
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/ChipInput.js
Expand Up @@ -482,6 +482,7 @@ class ChipInput extends React.Component {
blurBehavior,
children,
chipRenderer = defaultChipRenderer,
chipContainerStyle,
classes,
className,
clearInputValueOnChange,
Expand Down Expand Up @@ -605,7 +606,8 @@ class ChipInput extends React.Component {
[classes.disabled]: disabled,
[classes.labeled]: label != null,
[classes.error]: error
})}
},
chipContainerStyle)}
>
{variant === 'standard' && chipComponents}
<InputComponent
Expand Down Expand Up @@ -654,6 +656,8 @@ ChipInput.propTypes = {
/** A function of the type `({ value, text, chip, isFocused, isDisabled, isReadOnly, handleClick, handleDelete, 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. */
chipRenderer: PropTypes.func,
/** Whether the input value should be cleared if the `value` prop is changed. */
chipContainerStyle: PropTypes.object,
/** Override the input and chips container style */
clearInputValueOnChange: PropTypes.bool,
/** Data source for auto complete. This should be an array of strings or objects. */
dataSource: PropTypes.array,
Expand Down
8 changes: 8 additions & 0 deletions stories/index.js
Expand Up @@ -300,3 +300,11 @@ storiesOf('ChipInput', module)
.add('with "filled" variant full width', () => (
<ChipInput defaultValue={['foo', 'bar']} variant='filled' label='Add Tags' fullWidth fullWidthInput />
))
.add('with custom container style', () => (
<ChipInput
defaultValue={['foo', 'bar']}
fullWidth
onChange={action('onChange')}
chipContainerStyle={{ marginTop: 0 }}
/>
))

0 comments on commit 75647ed

Please sign in to comment.