diff --git a/.changeset/young-yaks-poke.md b/.changeset/young-yaks-poke.md new file mode 100644 index 00000000000..ef43597f783 --- /dev/null +++ b/.changeset/young-yaks-poke.md @@ -0,0 +1,5 @@ +--- +'@shopify/polaris': minor +--- + +Added optional `onAddFilterClick` callback prop to the indexFilters component diff --git a/polaris-react/src/components/IndexFilters/IndexFilters.tsx b/polaris-react/src/components/IndexFilters/IndexFilters.tsx index dbbcb0a4a1b..87b7bee1c78 100644 --- a/polaris-react/src/components/IndexFilters/IndexFilters.tsx +++ b/polaris-react/src/components/IndexFilters/IndexFilters.tsx @@ -64,6 +64,8 @@ export interface IndexFiltersProps onSortKeyChange?: (value: string) => void; /** Optional callback when using saved views and changing the sort direction */ onSortDirectionChange?: (value: string) => void; + /** Callback when the add filter button is clicked, to be passed to AlphaFilters. */ + onAddFilterClick?: () => void; /** The primary action to display */ primaryAction?: IndexFiltersPrimaryAction; /** The cancel action to display */ @@ -99,6 +101,7 @@ export function IndexFilters({ onSort, onSortKeyChange, onSortDirectionChange, + onAddFilterClick, sortOptions, sortSelected, queryValue = '', @@ -405,6 +408,7 @@ export function IndexFilters({ onQueryClear={handleClearSearch} onQueryFocus={handleQueryFocus} onQueryBlur={handleQueryBlur} + onAddFilterClick={onAddFilterClick} filters={filters} appliedFilters={appliedFilters} onClearAll={onClearAll}