PatternFly

Text input group

A text input group is a more flexible composable version of a text input. It enables consumers of PatternFly to build custom inputs for filtering and similar use cases by placing elements like icons, chips groups and buttons within a text input.

Examples

Basic

Disabled

Utilities and icon

Filters

  • chip one
  • chip two
  • chip three

Props

TextInputGroup

*required
NameTypeDefaultDescription
childrenReact.ReactNodeContent rendered inside the text input group
classNamestringAdditional classes applied to the text input group container
isDisabledbooleanAdds disabled styling and a disabled context value which text input group main hooks into for the input itself
isPlainbooleanFlag to indicate the toggle has no border or background

TextInputGroupMain

*required
NameTypeDefaultDescription
aria-activedescendantBetastringThe id of the active element. Required if role has a value of "combobox", and focus should remain on the input.
aria-controlsBetastringThe id of the element(s) controlled by the input. Required if role has a value of "combobox".
aria-labelstringAccessibility label for the input
childrenReact.ReactNodeContent rendered inside the text input group main div
classNamestringAdditional classes applied to the text input group main container
hintstringSuggestion that will show up like a placeholder even with text in the input
iconReact.ReactNodeIcon to be shown on the left side of the text input group main container
inputIdstringThe id of the input element
isExpandedBetabooleanFlag for whether an associated element controlled by the input is visible. Required if role has a value of "combobox".
namestringName for the input
onBlur(event?: any) => voidCallback for when focus is lost on the input field
onChange(event: React.FormEvent<HTMLInputElement>, value: string) => voidCallback for when there is a change in the input field
onFocus(event?: any) => voidCallback for when the input field is focused
placeholderstringPlaceholder value for the input
roleBetastringDetermines the accessible role of the input.
type| 'text' | 'date' | 'datetime-local' | 'email' | 'month' | 'number' | 'password' | 'search' | 'tel' | 'time' | 'url'Type that the input accepts.
valuestring | numberValue for the input

TextInputGroupUtilities

*required
NameTypeDefaultDescription
childrenReact.ReactNodeContent rendered inside the text input group utilities div
classNamestringAdditional classes applied to the text input group utilities container

CSS variables

Expand or collapse columnSelectorVariableValue
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--BackgroundColor
#fff
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text--before--BorderWidth
1px
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text--before--BorderColor
#f0f0f0
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text--after--BorderBottomWidth
1px
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text--after--BorderBottomColor
#8a8d90
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--hover__text--after--BorderBottomColor
#06c
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text--focus-within--after--BorderBottomWidth
2px
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text--focus-within--after--BorderBottomColor
#06c
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__main--first-child--not--text-input--MarginLeft
0.5rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__main--m-icon__text-input--PaddingLeft
2rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__main--RowGap
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__main--ColumnGap
0.5rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--c-chip-group__main--PaddingTop
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--c-chip-group__main--PaddingRight
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--c-chip-group__main--PaddingBottom
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--PaddingTop
0.375rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--PaddingRight
0.5rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--PaddingBottom
0.375rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--PaddingLeft
0.5rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--MinWidth
12ch
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--m-hint--Color
#6a6e73
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--placeholder--Color
#6a6e73
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__text-input--BackgroundColor
transparent
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__icon--Left
0.5rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__icon--Color
#151515
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__icon--TranslateY
-50%
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__utilities--MarginRight
0.5rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__utilities--MarginLeft
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__utilities--child--MarginLeft
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__utilities--c-button--PaddingRight
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group__utilities--c-button--PaddingLeft
0.25rem
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--m-disabled--Color
#6a6e73
.pf-v5-c-text-input-group--pf-v5-c-text-input-group--m-disabled--BackgroundColor
#f0f0f0
.pf-v5-c-text-input-group:hover--pf-v5-c-text-input-group__text--after--BorderBottomColor
#06c
.pf-v5-c-text-input-group.pf-m-disabled--pf-v5-c-text-input-group__text--before--BorderWidth
0
.pf-v5-c-text-input-group.pf-m-disabled--pf-v5-c-text-input-group__text--after--BorderBottomWidth
0
.pf-v5-c-text-input-group.pf-m-disabled--pf-v5-c-text-input-group--Color
#6a6e73
.pf-v5-c-text-input-group.pf-m-disabled--pf-v5-c-text-input-group__icon--Color
#6a6e73
.pf-v5-c-text-input-group.pf-m-disabled--pf-v5-c-text-input-group--BackgroundColor
#f0f0f0
.pf-v5-c-text-input-group.pf-m-plain--pf-v5-c-text-input-group--BackgroundColor
transparent
.pf-v5-c-text-input-group__main.pf-m-icon--pf-v5-c-text-input-group__text-input--PaddingLeft
2rem
.pf-v5-c-text-input-group__text:focus-within--pf-v5-c-text-input-group__text--after--BorderBottomWidth
2px
.pf-v5-c-text-input-group__text:focus-within--pf-v5-c-text-input-group__text--after--BorderBottomColor
#06c
.pf-v5-c-text-input-group__utilities .pf-v5-c-button--pf-v5-c-button--PaddingRight
0.25rem
.pf-v5-c-text-input-group__utilities .pf-v5-c-button--pf-v5-c-button--PaddingLeft
0.25rem

View source on GitHub