Skip to main content

FilterSelect

Features

  • Search functionality
  • Single/Multiple selection modes
  • Hierarchical data support
  • Controlled and uncontrolled modes
  • Customizable UI elements
  • Selection cascade support

Basic Usage

# FilterSelect component
dmc.FilterSelect(
id="unique-id",
data=categories, # Data to filter from
value=[], # Initially no selections
searchTerm="", # Initial search term
# Required props from interface
selectionMode="multiple", # Allow multiple selections
dataModel="tree", # Flat list of data
# Control flags
showSelectedOnlyToggle=True, # Show toggle for selected items
showClearButton=True, # Show clear selection button
showSelectAllButton=True, # Show select all button
# Optional but useful props
showSearch=True, # Show search input
showActionButtons=True, # Show Apply/Cancel buttons
size="small",
),

Props

Category Structure

Each entry in the data array should have the following structure:

{
"id": "unique_id",
"name": "Category Name",
"disabled": false,
"children": [
{
"id": "child_id",
"name": "Child Category",
"disabled": false,
"children": [...]
},
...
]
}

Required Props

NameTypeDescription
dataarrayThe data to be displayed in the filter select. Expects an object with Category
dataModellist | treeDefines the data structure between a flat list or an hierarchical tree of items
selectionModesingle | multipleDefines the selection mode between single (with radio button) or multiple (checkboxes)

Optional Props

NameTypeDefaultDescription
autoApplyOnSingleSelectbooleanfalseAutomatically apply selection and close dropdown in single selection mode
chipLabelMaxWidthstring"100px"Maximum width of chip labels
collapseIdenticalPathsbooleanfalseWhether to collapse identical paths in tree mode. Only works when dataModel is "tree".
enableSelectionCascadebooleantrueEnables cascading selection in hierarchical data
footerMessagestringundefinedMessage to display in the footer of the dropdown
helperTextstringundefinedHelper text below component input
isLoadingbooleanfalseShows loading state
labelstringundefinedLabel displayed above the filter select
limitTagsnumber1Maximum number of visible selected tags
placeholderstringundefinedInput placeholder text
preserveHierarchyOnSearchbooleanfalseMaintains hierarchy during search
showActionButtonsbooleanfalseShows/hides action buttons
showClearButtonbooleantrueShows/hides the clear selection button
showSearchbooleanfalseEnables/disables search functionality
showSelectedOnlyTogglebooleantrueShows/hides the selected-only toggle
showSelectionControlbooleantrueShows/hides selection controls (works for single selection only)
showSelectAllButtonbooleantrueShows/hides the select all button
showWarningMessagebooleanfalseShows/hides warning messages
warningMessagestringThis filter is being impacted by other filters.Warning message to display in the dropdown
size"small" | "medium""small"Size of the component
valuearrayundefinedSelected values (controlled mode)
visibleItemsCountnumber8Number of items to display in the dropdown. More than that will be visible if the user scrolls
disableClearablebooleanfalseDisables the clear button. True by default if selectionMode is single
expandedByDefaultbooleanfalseExpands the parent nodes to show first-level children
popoverWidthstringundefinedWidth of the popover. Use to override the default width calculated by the component

Callback Props

NameTypeDescription
onCancelfunctionCalled when selection is cancelled
onFilterSavefunctionCalled when filter settings are saved
onSearchChangefunctionCalled when search input changes

Notes

  • Use controlled mode when you need to manage the selection state in your application
  • Enable preserveHierarchyOnSearch when working with hierarchical data to maintain structure during search
  • The limitTags prop controls how many selected items are visible in the input field. -1 shows all (default). 0 shows only the "+X" overflow chip.
  • Items inside data with ID equal to null and/or name equals to n/a will not be visible in the dropdown.
  • Passing disabled: true to an item will disable it in the dropdown and in the selected items list.