Filters

Intuitive data filtering components.

Props#

FiltersProvider#

PropTypeDefaultDescription
activeFiltersFilter[]
childrenstring | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>
defaultFiltersFilter[]
filtersFilterItem[]
onBeforeEnableFilter( filter: Filter, filterItem?: FilterItem | undefined, ) => Promise<Filter>
onChange(activeFilters: Filter[]) => void
operatorsFilterOperators<Operator, Type>

FilterMenu#

PropTypeDefaultDescription
itemsrequiredFilterItems
arrowPaddingnumber8The padding required to prevent the arrow from reaching the very edge of the popper.
autoSelectbooleantrueIf true, the first enabled menu item will receive focus and be selected when the menu opens.
boundaryHTMLElement | "clippingParents" | "scrollParent"clippingParentsThe boundary area for the popper. Used within the preventOverflow modifier
buttonPropsButtonProps
closeOnBlurbooleantrueIf true, the menu will close when you click outside the menu list
closeOnSelectbooleantrueIf true, the menu will close when a menu item is clicked
commandstring
computePositionOnMountboolean
defaultIsOpenboolean
direction"ltr" | "rtl"If rtl, proper placement positions will be flipped i.e. 'top-right' will become 'top-left' and vice-verse
eventListenerstype ONLY_FOR_FORMAT = | boolean | { scroll?: boolean | undefined resize?: boolean | undefined }trueIf provided, determines whether the popper will reposition itself on scroll and resize of the window.
flipbooleantrueIf true, the popper will change its placement and flip when it's about to overflow its boundary area.
gutternumber8The distance or margin between the reference and popper. It is used internally to create an offset modifier. NB: If you define offset prop, it'll override the gutter.
iconstring | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>
idstring
initialFocusRefRefObject<{ focus(): void }>The ref of the element that should receive focus when the popover opens.
inputDefaultValuestring
inputValuestring
isLazybooleanfalsePerformance 🚀: If true, the MenuItem rendering will be deferred until the menu is open.
isOpenboolean
labelstring | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>
lazyBehaviorLazyModeunmountPerformance 🚀: The lazy behavior of menu's content when not visible. Only works when `isLazy={true}` - "unmount": The menu's content is always unmounted when not open. - "keepMounted": The menu's content initially unmounted, but stays mounted when menu is open.
listPropsMenuListProps
matchWidthbooleanfalseIf true, the popper will match the width of the reference at all times. It's useful for autocomplete, `date-picker` and select patterns.
modifiersPartial<Modifier<string, any>>[]Array of popper.js modifiers. Check the docs to see the list of possible modifiers you can pass.
multipleboolean
offset[number, number]The main and cross-axis offset to displace popper element from its reference element.
onChange(value?: FilterValue | undefined) => void
onClose() => void
onInputChange( value: string, activeItemId?: string | undefined, ) => void
onOpen() => void
onSelect(item: FilterItem | FilterItem[]) => void
placeholderstring
placementPlacementWithLogicalbottomThe placement of the popper relative to its reference.
preventOverflowbooleantrueIf true, will prevent the popper from being cut off and ensure it's visible within the boundary area.
strategy"fixed" | "absolute"absoluteThe CSS positioning strategy to use.
valuestring | number | boolean | string[] | Date

ActiveFilter#

PropTypeDefaultDescription
idrequiredstring
defaultOperatorFilterOperatorId
defaultValuestring | number | boolean | string[] | Date
formatLabel(label?: string | undefined) => stringCustom label formatter
formatValue(value: FilterValue) => stringFormat the value of the filter, eg timestamps, numbers, etc.
iconstring | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>
isAttachedbooleanfalseIf true, the borderRadius of button that are direct children will be altered to look flushed together
isDisabledbooleanfalseIf true, all wrapped button will be disabled
itemsFilterItems
labelstring
multiplebooleanEnable multiple select
onChange(filter: Filter) => void
onOperatorChange(id: FilterOperatorId) => void
onRemove() => void
onValueChange(value: FilterValue) => void
operatorFilterOperatorId
operatorsFilterItem[]
renderValueFilterRenderFnRender the value of the filter, can render custom components like inputs. Return undefined to use the default value rendering
spacingResponsiveValue<number | "px" | (string & {}) | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "auto" | "1" | "-1" | "2" | "-2" | "3" | "-3" | "4" | "-4" | "5" | "-5" | ... 54 more ... | "-3.5">'0.5rem'The spacing between the buttons
typeFilterType
valuestring | number | boolean | string[] | Date

ActiveFiltersList#

PropTypeDefaultDescription
alignResponsiveValue<AlignItems>The `align-items` value (for main axis alignment)
directionResponsiveValue<FlexDirection>The `flex-direction` value
formatValue(value: FilterValue) => string
justifyResponsiveValue<JustifyContent>The `justify-content` value (for cross-axis alignment)
renderValueFilterRenderFn
shouldWrapChildrenbooleanfalseIf true, the children will be wrapped in a WrapItem
spacingResponsiveValue<number | "px" | (string & {}) | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "auto" | "1" | "-1" | "2" | "-2" | "3" | "-3" | "4" | "-4" | "5" | "-5" | ... 54 more ... | "-3.5">The space between each child (even if it wraps)
spacingXResponsiveValue<number | "px" | (string & {}) | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "auto" | "1" | "-1" | "2" | "-2" | "3" | "-3" | "4" | "-4" | "5" | "-5" | ... 54 more ... | "-3.5">The horizontal space between the each child (even if it wraps). Defaults to spacing if not defined.
spacingYResponsiveValue<number | "px" | (string & {}) | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "auto" | "1" | "-1" | "2" | "-2" | "3" | "-3" | "4" | "-4" | "5" | "-5" | ... 54 more ... | "-3.5">The vertical space between the each child (even if it wraps). Defaults to spacing if not defined.

NoFilteredResults#

PropTypeDefaultDescription
childrenstring | number | bigint | boolean | ReactElement<any, string | JSXElementConstructor<any>> | Iterable<ReactNode> | ReactPortal | Promise<...>
clearLabelstring
onReset() => void
resourcestring
spacingResponsiveValue<number | "px" | (string & {}) | "-moz-initial" | "inherit" | "initial" | "revert" | "revert-layer" | "unset" | "auto" | "1" | "-1" | "2" | "-2" | "3" | "-3" | "4" | "-4" | "5" | "-5" | ... 54 more ... | "-3.5">
titlestring

Types#

FilterItem#

PropTypeDefaultDescription
idrequiredstringThe filter id
activeLabelstringThe active filter label e.g. "Contact"
defaultOperatorFilterOperatorIdThe default operator
iconReactElement<any, string | JSXElementConstructor<any>>Icon displayed before the label
itemsFilterItemsThe available
labelstringThe filter label e.g. "Contact is lead"
multiplebooleanEnable multiple select if true
operatorsFilterOperatorId[]The available operators
typeFilterTypeThe filter type
valuestring | number | boolean | string[] | DateThe filter value

Was this helpful?