Filter group
Filter buttons
Use EuiFilterGroup to wrap EuiFilterButtons into a container that looks nice against form fields (like search). These buttons are used in two different patterns. The most simplest use is that of an on/off pattern to show whether a filter is on. Add the prop
withNext
to remove the border between it and the next EuiFilterButton to visually group similar or opposite style filters.
Add the prop withNext
to remove the border between it and the next EuiFilterButton to visually group similar or opposite style filters.
Set hasActiveFilters
to true when the filter is active.
Use isToggle
to change the visual and functional type of the button element that's being rendered from a regular button to a toggle button.
Multi-select
To provide a long list of grouped filters, we recommend wrapping the filter button within an
EuiPopover and passing the items to a searchable EuiSelectable.Indicating number of filters
You can use the numFilters
prop to display the total number of filters
available and numActiveFilters
to set the number of currently active filters.
Pass hasActiveFilters
to visually indicate that there are active filters.
numActiveFilters
accepts integer numbers. In special cases, you may pass
a percentage value as a string if UX justifies it.
Layout
By default, the bar is auto-width based on its contents. To expand the bar to fill its parent's width add fullWidth
. This will also set each button to grow. If you do not want the button to grow, set grow=false
.
Props
EuiFilterGroup
Prop | Description and type | Default value |
---|---|---|
Prop className# | Description and type Type: string | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop fullWidth# | Description and type Expand the whole bar to fill its parent's width boolean | Default value false |
Prop compressed# | Description and type When boolean | Default value |
EuiFilterButton
Prop | Description and type | Default value |
---|---|---|
Prop hasActiveFilters# | Description and type Highlights active filters boolean | Default value |
Prop numFilters# | Description and type Pass the total number of filters available and it will number | Default value |
Prop numActiveFilters# | Description and type The number of active (selected) filters. Accepted values are integers and percentages (e.g., 20%). string | number | Default value |
Prop isToggle# | Description and type Switches between toggle and regular button boolean | Default value false |
Prop isSelected# | Description and type Applies a visual state to the button. boolean | Default value |
Prop grow# | Description and type Should the button grow to fill its container, best used for dropdown buttons boolean | Default value true |
Prop withNext# | Description and type Remove border after button, good for opposite filters boolean | Default value |
Prop badgeColor# | Description and type Change color of the counter badge "accent" | "success" | "subdued" | Default value accent |
Prop color# | Description and type Any of the named color palette options. Do not use the following colors for standalone buttons directly,
"primary" | "text" | "accent" | "accentSecondary" | "success" | "warning" | "danger" | Default value text |
Prop target# | Description and type Type: string | Default value |
Prop rel# | Description and type Type: string | Default value |
Prop className# | Description and type Type: string | Default value |
Prop css# | Description and type Type: Interpolation<Theme> | Default value |
Prop isLoading# | Description and type Force disables the button and changes the icon to a loading spinner boolean | Default value |
Prop contentProps# | Description and type Object of props passed to the CommonProps & EuiButtonDisplayContentType | Default value |
Prop type# | Description and type Type: "button" | "reset" | "submit" | Default value button |
Prop iconType# | Description and type Any IconType | Default value |
Prop iconSide# | Description and type Can only be one side ButtonContentIconSide | Default value right |
Prop textProps# | Description and type Object of props passed to the This span wrapper can be removed by passing false | (HTMLAttributes<HTMLSpanElement> & CommonProps & { ref?: Ref<HTMLSpanElement>; 'data-text'?: string; }) | Default value |
Prop iconSize# | Description and type Type: "s" | "m" | Default value |
Prop isDisabled# | Description and type
boolean | Default value |
Prop aria-label# | Description and type Defines a string value that labels the current element. string | Default value |
Prop data-test-subj# | Description and type Type: string | Default value |
Prop href# | Description and type Type: string | Default value |
Prop onClick# | Description and type Type: MouseEventHandler<HTMLAnchorElement> | MouseEventHandler<HTMLButtonElement> | Default value |
Prop buttonRef# | Description and type Type: Ref<HTMLAnchorElement | HTMLButtonElement> | Default value |