Skip to Content
Patternfly Logo

Select

Use a select to choose one or more values from a list. Related design guidelines: Data input

ExamplesPropsCSS Variables

Examples

Single

Grouped single

Checkbox input

Checkbox input no badge

Checkbox input no badge

Checkbox input no badge

Grouped checkbox input

Grouped checkbox input with filtering

Filter by status

Grouped checkbox input with filtering

Filter by status

Grouped checkbox input with filtering

Filter by status

Grouped checkbox input with filtering

Filter by status

Typeahead

Custom filtering

Multiple

Multiple with custom objects

Plain multiple typeahead

Panel

Props

Select properties
NameTypeRequiredDefaultDescription
childrenReact.ReactElement[]No[]Content rendered inside the Select
classNamestringNo''Classes applied to the root of the Select
direction'up' | 'down'NoSelectDirection.downFlag specifying which direction the Select menu expands
isOpenbooleanNofalseFlag to indicate if select is open
isGroupedbooleanNofalseFlag to indicate if select options are grouped
isPlainbooleanNofalseDisplay the toggle with no border or background
isDisabledbooleanNofalseFlag to indicate if select is disabled
isCreatablebooleanNofalseFlag to indicate if the typeahead select allows new items
createTextstringNo'Create'Text displayed in typeahead select to prompt the user to create an item
placeholderTextstring | React.ReactNodeNo''Title text of Select
noResultsFoundTextstringNo'No results found'Text to display in typeahead select when no results are found
selectionstring | SelectOptionObjectNo''Selected item for single select variants.
selectionsstring[] | SelectOptionObject[]No[]Array of selected items for multi select variants.
isCheckboxSelectionBadgeHiddenbooleanNoFlag indicating if selection badge should be hidden for checkbox variant,default false
toggleIdstringNonullId for select toggle element
aria-labelstringNo''Adds accessible text to Select
aria-labelledbystringNo''Id of label for the Select aria-labelledby
typeAheadAriaLabelstringNo''Label for input field of type ahead select variants
clearSelectionsAriaLabelstringNo'Clear all'Label for clear selection button of type ahead select variants
toggleAriaLabelstringNo'Options menu'Label for toggle of type ahead select variants
removeSelectionAriaLabelstringNo'Remove'Label for remove chip button of multiple type ahead select variant
onSelect( event: React.MouseEvent | React.ChangeEvent, value: string | SelectOptionObject, isPlaceholder?: boolean ) => voidNoCallback for selection behavior
onToggle(isExpanded: boolean) => voidYesCallback for toggle button behavior
onClear(event: React.MouseEvent) => voidNo() => undefined as voidCallback for typeahead clear button
onFilter(e: React.ChangeEvent<HTMLInputElement>) => React.ReactElement[]NonullOptional callback for custom filtering
onCreateOption(newOptionValue: string) => voidNo() => undefined as voidOptional callback for newly created options
variant'single' | 'checkbox' | 'typeahead' | 'typeaheadmulti'NoSelectVariant.singleVariant of rendered Select
widthstring | numberNo''Width of the select container as a number of px or string percentage
maxHeightstring | numberNoMax height of the select container as a number of px or string percentage
toggleIconReact.ReactElementNonullIcon element to render inside the select toggle
customContentReact.ReactNodeNonullCustom content to render in the select menu. If this prop is defined, the variant prop will be ignored and the select will render with a single select toggle
hasInlineFilterbooleanNofalseFlag indicating if select should have an inline text input for filtering
SelectOption properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNoOptional alternate display for the option
classNamestringNo''Additional classes added to the Select Option
indexnumberNo0Internal index of the option
componentReact.ReactNodeNo'button'Indicates which component will be used as select item
valuestring | SelectOptionObjectNo''The value for the option, can be a string or select option object
isDisabledbooleanNofalseFlag indicating if the option is disabled
isPlaceholderbooleanNofalseFlag indicating if the option acts as a placeholder
isNoResultsOptionbooleanNofalseFlad indicating if the option acts as a "no results" indicator
isSelectedbooleanNofalseInternal flag indicating if the option is selected
isCheckedbooleanNofalseInternal flag indicating if the option is checked
sendRef(ref: React.ReactNode, index: number) => voidNo() => {}Internal callback for ref tracking
keyHandler(index: number, position: string) => voidNo() => {}Internal callback for keyboard navigation
onClick(event: React.MouseEvent | React.ChangeEvent) => voidNo() => {}Optional callback for click event
SelectGroup properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNo[]Checkboxes within group
classNamestringNo''Additional classes added to the CheckboxSelectGroup control
labelstringNo''Group label
titleIdstringNo''ID for title label

CSS Variables

.pf-c-select--pf-global--Color--100
#151515
.pf-c-select--pf-global--Color--200
#6a6e73
.pf-c-select--pf-global--BorderColor--100
#d2d2d2
.pf-c-select--pf-global--primary-color--100
#06c
.pf-c-select--pf-global--link--Color
#06c
.pf-c-select--pf-global--link--Color--hover
#004080
.pf-c-select--pf-global--BackgroundColor--100
#fff
.pf-c-select--pf-c-select__toggle--PaddingTop
0.375rem
.pf-c-select--pf-c-select__toggle--PaddingRight
0.5rem
.pf-c-select--pf-c-select__toggle--PaddingBottom
0.375rem
.pf-c-select--pf-c-select__toggle--PaddingLeft
0.5rem
.pf-c-select--pf-c-select__toggle--MinWidth
44px
.pf-c-select--pf-c-select__toggle--FontSize
1rem
.pf-c-select--pf-c-select__toggle--FontWeight
400
.pf-c-select--pf-c-select__toggle--LineHeight
1.5
.pf-c-select--pf-c-select__toggle--BackgroundColor
#fff
.pf-c-select--pf-c-select__toggle--BorderWidth
1px
.pf-c-select--pf-c-select__toggle--BorderTopColor
#f0f0f0
.pf-c-select--pf-c-select__toggle--BorderRightColor
#f0f0f0
.pf-c-select--pf-c-select__toggle--BorderBottomColor
#8a8d90
.pf-c-select--pf-c-select__toggle--BorderLeftColor
#f0f0f0
.pf-c-select--pf-c-select__toggle--Color
#151515
.pf-c-select--pf-c-select__toggle--hover--BorderBottomColor
#06c
.pf-c-select--pf-c-select__toggle--active--BorderBottomWidth
2px
.pf-c-select--pf-c-select__toggle--active--BorderBottomColor
#06c
.pf-c-select--pf-c-select__toggle--expanded--BorderBottomWidth
2px
.pf-c-select--pf-c-select__toggle--expanded--BorderBottomColor
#06c
.pf-c-select--pf-c-select__toggle--disabled--BackgroundColor
#f0f0f0
.pf-c-select--pf-c-select__toggle--m-plain--BorderColor
transparent
.pf-c-select--pf-c-select__toggle--m-plain--Color
#151515
.pf-c-select--pf-c-select__toggle--m-plain--hover--Color
#151515
.pf-c-select--pf-c-select__toggle-wrapper--m-typeahead--PaddingTop
0
.pf-c-select--pf-c-select__toggle-wrapper--not-last-child--MarginRight
0.25rem
.pf-c-select--pf-c-select__toggle-wrapper--MaxWidth
calc(100% - 1.5rem)
.pf-c-select--pf-c-select__toggle-wrapper--c-chip-group--MarginTop
0.5rem
.pf-c-select--pf-c-select__toggle-wrapper--c-chip-group--MarginBottom
0.25rem
.pf-c-select--pf-c-select__toggle-wrapper--c-chip--c-button--PaddingTop
0.25rem
.pf-c-select--pf-c-select__toggle-wrapper--c-chip--c-button--PaddingBottom
0.25rem
.pf-c-select--pf-c-select__toggle-typeahead--FlexBasis
10em
.pf-c-select--pf-c-select__toggle-typeahead--BackgroundColor
transparent
.pf-c-select--pf-c-select__toggle-typeahead--BorderTop
none
.pf-c-select--pf-c-select__toggle-typeahead--BorderRight
none
.pf-c-select--pf-c-select__toggle-typeahead--BorderLeft
none
.pf-c-select--pf-c-select__toggle-typeahead-form--MinWidth
7.5rem
.pf-c-select--pf-c-select__toggle-typeahead--active--PaddingBottom
calc(0.375rem - 1px)
.pf-c-select--pf-c-select__toggle-icon--toggle-text--MarginLeft
0.25rem
.pf-c-select--pf-c-select__toggle-badge--PaddingLeft
0.5rem
.pf-c-select--pf-c-select__toggle-arrow--MarginLeft
1rem
.pf-c-select--pf-c-select__toggle-arrow--MarginRight
0.5rem
.pf-c-select--pf-c-select__toggle-arrow--with-clear--MarginLeft
0.5rem
.pf-c-select--pf-c-select__toggle-arrow--m-top--m-expanded__toggle-arrow--Transform
rotate(180deg)
.pf-c-select--pf-c-select__toggle-clear--PaddingRight
0.5rem
.pf-c-select--pf-c-select__toggle-clear--PaddingLeft
1rem
.pf-c-select--pf-c-select__toggle-button--PaddingLeft
0.5rem
.pf-c-select--pf-c-select__toggle-button--Color
#151515
.pf-c-select--pf-c-select__menu--BackgroundColor
#fff
.pf-c-select--pf-c-select__menu--BoxShadow
0 0.25rem 0.5rem 0rem rgba(3, 3, 3, 0.12), 0 0 0.25rem 0 rgba(3, 3, 3, 0.06)
.pf-c-select--pf-c-select__menu--PaddingTop
0.5rem
.pf-c-select--pf-c-select__menu--PaddingBottom
0.5rem
.pf-c-select--pf-c-select__menu--Top
calc(100% + 0.25rem)
.pf-c-select--pf-c-select__menu--ZIndex
200
.pf-c-select--pf-c-select__menu--m-top--Transform
translateY(calc(-100% - 0.25rem))
.pf-c-select--pf-c-select__menu-item--PaddingTop
0.5rem
.pf-c-select--pf-c-select__menu-item--PaddingRight
1rem
.pf-c-select--pf-c-select__menu-item--m-selected--PaddingRight
3rem
.pf-c-select--pf-c-select__menu-item--PaddingBottom
0.5rem
.pf-c-select--pf-c-select__menu-item--PaddingLeft
1rem
.pf-c-select--pf-c-select__menu-item--FontSize
1rem
.pf-c-select--pf-c-select__menu-item--FontWeight
400
.pf-c-select--pf-c-select__menu-item--LineHeight
1.5
.pf-c-select--pf-c-select__menu-item--Color
#151515
.pf-c-select--pf-c-select__menu-item--disabled--Color
#6a6e73
.pf-c-select--pf-c-select__menu-item--hover--BackgroundColor
#f0f0f0
.pf-c-select--pf-c-select__menu-item--disabled--BackgroundColor
transparent
.pf-c-select--pf-c-select__menu-item-icon--Color
#06c
.pf-c-select--pf-c-select__menu-item-icon--FontSize
0.625rem
.pf-c-select--pf-c-select__menu-item-icon--Right
1rem
.pf-c-select--pf-c-select__menu-item-icon--Top
50%
.pf-c-select--pf-c-select__menu-item-icon--Transform
translateY(-50%)
.pf-c-select--pf-c-select__menu-item--match--FontWeight
600
.pf-c-select--pf-c-select__menu-search--PaddingTop
0.5rem
.pf-c-select--pf-c-select__menu-search--PaddingRight
1rem
.pf-c-select--pf-c-select__menu-search--PaddingBottom
1rem
.pf-c-select--pf-c-select__menu-search--PaddingLeft
1rem
.pf-c-select--pf-c-select__menu-group--menu-group--PaddingTop
0.5rem
.pf-c-select--pf-c-select__menu-group-title--PaddingTop
0.5rem
.pf-c-select--pf-c-select__menu-group-title--PaddingRight
1rem
.pf-c-select--pf-c-select__menu-group-title--PaddingBottom
0.5rem
.pf-c-select--pf-c-select__menu-group-title--PaddingLeft
1rem
.pf-c-select--pf-c-select__menu-group-title--FontSize
0.875rem
.pf-c-select--pf-c-select__menu-group-title--FontWeight
500
.pf-c-select--pf-c-select__menu-group-title--Color
#6a6e73
.pf-c-select--pf-c-select-menu--c-divider--MarginTop
0.5rem
.pf-c-select--pf-c-select-menu--c-divider--MarginBottom
0.5rem
.pf-c-select .pf-c-divider:last-child--pf-c-select-menu--c-divider--MarginBottom
0
.pf-c-select__menu-search + .pf-c-divider--pf-c-select-menu--c-divider--MarginTop
0
.pf-c-select__toggle.pf-m-disabled--pf-c-select__toggle--BackgroundColor
#f0f0f0
.pf-c-select__toggle:hover::before--pf-c-select__toggle--BorderBottomColor
#06c
.pf-c-select__toggle:active::before--pf-c-select__toggle--BorderBottomColor
#06c
.pf-m-expanded > .pf-c-select__toggle::before--pf-c-select__toggle--BorderBottomColor
#06c
.pf-c-select__toggle.pf-m-plain--pf-c-select__toggle--Color
#151515
.pf-c-select__toggle.pf-m-plain:hover--pf-c-select__toggle--Color
#151515
.pf-c-select__toggle.pf-m-typeahead--pf-c-select__toggle--PaddingTop
0
.pf-c-select__toggle.pf-m-typeahead--pf-c-select__toggle--PaddingRight
0
.pf-c-select__toggle.pf-m-typeahead--pf-c-select__toggle--PaddingBottom
0
.pf-c-select__menu-item.pf-m-selected--pf-c-select__menu-item--PaddingRight
3rem