11import { forwardRef , useEffect , useRef , useState } from 'react' ;
22import { Button } from '@patternfly/react-core/dist/esm/components/Button' ;
3- import { Label , LabelGroup } from '@patternfly/react-core/dist/esm/components/Label' ;
3+ import { Label , LabelGroup , LabelProps } from '@patternfly/react-core/dist/esm/components/Label' ;
44import { MenuToggle , MenuToggleElement , MenuToggleProps } from '@patternfly/react-core/dist/esm/components/MenuToggle' ;
55import {
66 Select ,
@@ -51,6 +51,8 @@ export interface MultiTypeaheadSelectProps extends Omit<SelectProps, 'toggle' |
5151 toggleWidth ?: string ;
5252 /** Additional props passed to the toggle. */
5353 toggleProps ?: MenuToggleProps ;
54+ /** Additional props passed to each label of the selected option. */
55+ labelProps ?: LabelProps ;
5456}
5557
5658export const MultiTypeaheadSelectBase : React . FunctionComponent < MultiTypeaheadSelectProps > = ( {
@@ -65,6 +67,7 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
6567 isDisabled,
6668 toggleWidth,
6769 toggleProps,
70+ labelProps,
6871 ...props
6972} : MultiTypeaheadSelectProps ) => {
7073 const [ isOpen , setIsOpen ] = useState ( false ) ;
@@ -302,10 +305,11 @@ export const MultiTypeaheadSelectBase: React.FunctionComponent<MultiTypeaheadSel
302305 < Label
303306 key = { index }
304307 datatest-id = { `${ selection } -chip` }
305- onClick = { ( ev ) => {
308+ onClose = { ( ev ) => {
306309 ev . stopPropagation ( ) ;
307310 clearOption ( ev , selection ) ;
308311 } }
312+ { ...labelProps }
309313 >
310314 { initialOptions . find ( ( o ) => o . value === selection ) ?. content }
311315 </ Label >
0 commit comments