diff --git a/packages/amis/src/renderers/Form/InputTag.tsx b/packages/amis/src/renderers/Form/InputTag.tsx index 56b8ded28..fe7c48b43 100644 --- a/packages/amis/src/renderers/Form/InputTag.tsx +++ b/packages/amis/src/renderers/Form/InputTag.tsx @@ -431,6 +431,7 @@ export default class TagControl extends React.PureComponent< optionsTip, maxTagCount, overflowTagPopover, + max, translate: __ } = this.props; @@ -445,12 +446,14 @@ export default class TagControl extends React.PureComponent< ) : []; + const reachMax = max != null && isInteger(max) && selectedOptions.length >= max; + return ( reachMax || this.handleOptionChange(e)} itemToString={this.renderItem} > {({isOpen, highlightedIndex, getItemProps, getInputProps}) => { @@ -507,7 +510,10 @@ export default class TagControl extends React.PureComponent< ...getItemProps({ index, item, - disabled: item.disabled + disabled: reachMax || item.disabled, + className: cx('ListMenu-item', { + 'is-disabled': reachMax + }), }) })} />