Chip

A chip is used to communicate a value or a set of attribute-value pairs within workflows that involve filtering a set of objects.

Note: The chip component has been deprecated. Our new recommendation is to use the label component instead.

Warning alert:Deprecated feature

This component implementation has been deprecated in favor of a newer solution, and is no longer being maintained or enhanced. To learn more about deprecated components, visit about PatternFly.

Examples

Chip variants

Chips can be removable or read-only. The Overflow chip is a special chip that is used to expand or collapse the content of a chip group.

Chip 1

Really long chip that goes on and on

Chip 7

Read-only chip

Chip groups

A chip group is a collection of chips that can be grouped by category and used to represent one or more values assigned to a single attribute. When the value of numChips is exceeded, additional chips will be hidden using an overflow chip.

  • Chip one
  • Really long chip that goes on and on
  • Chip three

Chip groups with categories

  • Chip one
  • Really long chip that goes on and on
  • Chip three

Chip groups with removable categories

  • Chip one
  • Chip two
  • Chip three


  • Chip one
  • Chip two
  • Chip three

Props

Chip

*required
NameTypeDefaultDescription
badgeReact.ReactNodeBadge to add to the chip. The badge will be rendered after the chip text.
childrenReact.ReactNodeContent rendered inside the label.
classNamestring''Additional classes added to the label.
closeBtnReact.ReactNodeNode for custom close button.
closeBtnAriaLabelstringAria label for close button
closeBtnPropsanyAdditional properties for the default close button.
color'blue' | 'teal' | 'green' | 'orange' | 'purple' | 'red' | 'orangered' | 'grey' | 'yellow'Color of the label.
Deprecated: componentReact.ReactNodeComponent that will be used for chip. It is recommended that <button> or <li> are used when the chip is an overflow chip.
editablePropsanyAdditional props passed to the editable label text div. Optionally passing onInput and onBlur callbacks will allow finer custom text input control.
hrefstringHref for a label that is a link. If present, the label will change to an anchor element. This should not be passed in if the onClick prop is also passed in.
iconReact.ReactNodeIcon added to the left of the label text. Overrides the icon set by the status property.
isClickablebooleanFlag indicating the label is clickable. This flag will automatically be set if a href is passed, or if an onClick handler is passed and the label is not an overflow or add variant. This should be manually set when using the render prop.
isCompactbooleanFlag indicating the label is compact.
isDisabledbooleanFlag indicating the label is disabled. Works only on clickable labels, so either href or onClick props must be passed in.
isEditablebooleanFlag indicating the label is editable.
isOverflowChipbooleanfalseFlag indicating if the chip is an overflow chip
isReadOnlybooleanfalseFlag indicating if chip is read only
onClick(event: React.MouseEvent) => void(_e: React.MouseEvent) => undefined as anyCallback for when the label is clicked. This should not be passed in if the href or isEditable props are also passed in.
onClose(event: React.MouseEvent) => voidClose click callback for removable labels. If present, label will have a close button.
onEditCancel(event: KeyboardEvent, previousText: string) => voidCallback when an editable label cancels an edit.
onEditComplete(event: MouseEvent | KeyboardEvent, newText: string) => voidCallback when an editable label completes an edit.
ouiaIdnumber | stringValue to overwrite the randomly generated data-ouia-component-id.
ouiaSafeboolean
render({ className, content, componentRef }: { className: string; content: React.ReactNode; componentRef: any; }) => React.ReactNodeForwards the label content and className to rendered function. Use this prop for react router support.
status'success' | 'warning' | 'danger' | 'info' | 'custom'Status of the label with a respective icon and color. Overrides the color set by the color property.
textMaxWidthstring'16ch'The max width of the label before it is truncated. Can be any valid CSS unit, such as '100%', '100px', or '16ch'.
tooltipPosition| TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end''top'Position of the tooltip which is displayed if text is truncated
variant'outline' | 'filled' | 'overflow' | 'add'Variant of the label.

ChipGroup

*required
NameTypeDefaultDescription
aria-labelstring'Chip group category'Aria label for chip group that does not have a category name
categoryNamestring''Category name text for the chip group category. If this prop is supplied the chip group with have a label and category styling applied
childrenReact.ReactNodeContent rendered inside the chip group. Should be <Chip> elements.
classNamestringAdditional classes added to the chip item
closeBtnAriaLabelstring'Close chip group'Aria label for close button
collapsedTextstring'${remaining} more'Customizable template string. Use variable "${remaining}" for the overflow chip count.
defaultIsOpenbooleanfalseFlag for having the chip group default to expanded
expandedTextstring'Show Less'Customizable "Show Less" text string
isClosablebooleanfalseFlag if chip group can be closed
numChipsnumber3Set number of chips to show before overflow
onClick(event: React.MouseEvent) => voidFunction that is called when clicking on the chip group close button or on an overflow chip
Deprecated: onOverflowChipClick(event: React.MouseEvent) => voidFunction that is called when clicking on the overflow (expand/collapse) chip button
ouiaIdnumber | stringValue to overwrite the randomly generated data-ouia-component-id.
ouiaSafeboolean
tooltipPosition| TooltipPosition | 'auto' | 'top' | 'bottom' | 'left' | 'right' | 'top-start' | 'top-end' | 'bottom-start' | 'bottom-end' | 'left-start' | 'left-end' | 'right-start' | 'right-end''top'Position of the tooltip which is displayed if the category name text is longer

CSS variables

Prefixed with 'pf-v6-c-chip'

Expand or collapse columnSelectorVariableValue

Prefixed with 'pf-v6-c-chip-group'

Expand or collapse columnSelectorVariableValue