Patternfly Logo

Examples

Basic

Props

ContextSelector properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNonullcontent rendered inside the Context Selector
classNamestringNo''Classes applied to root element of Context Selector
isOpenbooleanNofalseFlag to indicate if Context Selector is opened
menuAppendToNo type infoNo'inline'
onSearchButtonClick(event?: React.SyntheticEvent<HTMLButtonElement>) => voidNo() => undefined as anyFunction callback for when Search Button is clicked
onSearchInputChange(value: string) => voidNo() => undefined as anyFunction callback called when user changes the Search Input
onSelect(event: any, value: React.ReactNode) => voidNo() => undefined as anyFunction callback called when user selects item
onToggle(event: any, value: boolean) => voidNo() => undefined as anyFunction callback called when user clicks toggle button
ouiaSafeNo type infoNotrue
screenReaderLabelstringNo''Labels the Context Selector for Screen Readers
searchButtonAriaLabelstringNo'Search menu items'Aria-label for the Context Selector Search Button
searchInputPlaceholderstringNo'Search'Search Input placeholder
searchInputValuestringNo''Value in the Search field
toggleTextstringNo''Text that appears in the Context Selector Toggle
ContextSelectorItem properties
NameTypeRequiredDefaultDescription
childrenReact.ReactNodeNonullAnything which can be rendered as Context Selector item
classNamestringNo''Classes applied to root element of the Context Selector item
indexnumberNoundefinedinternal index of the item
isDisabledbooleanNofalseRender Context Selector item as disabled
onClick(event: React.MouseEvent) => voidNo(): any => undefinedCallback for click event
sendRef(index: number, current: any) => voidNo() => {}Internal callback for ref tracking

View source on GitHub