Dashboard filters are available through Forge's Early Access Program (EAP). To request access, submit the dashboard filters module EAP form.
EAP features are offered to selected users for testing and feedback purposes. They are unsupported and subject to change without notice.
Hook for accessing the persisted dashboard filter group and any session-only overrides.
For module configuration and setup instructions, see Dashboard filter (EAP).
Install Forge hooks using the @forge/hooks npm package.
Import @forge/hooks using a bundler, such as Webpack.
To add the useFilters hook to your app:
1 2import { useFilters } from "@forge/hooks/dashboards";
Here is an example of accessing persisted filters and overrides:
1 2 3 4 5 6 7 8 9 10 11 12 13 14import React from "react"; import { useFilters } from "@forge/hooks/dashboards"; function FilterSummary() { const { filterGroup, overrides } = useFilters(); return ( <div> <p>Root operator: {filterGroup?.operator}</p> <p>Active overrides: {Object.keys(overrides).length}</p> </div> ); }
1 2 3 4 5 6 7function useFilters(): UseFiltersResult; interface UseFiltersResult { filterGroup: FilterGroup | null; overrides: Record<string, FilterOverride>; }
For the FilterGroup and FilterOverride types, see the filter model.
Rate this page: