> ## Documentation Index
> Fetch the complete documentation index at: https://www.algolia.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Filter Toggle

> Lets users toggle a specific filter.

## About this widget

Filter Toggle is a filtering view that displays any [filter](https://www.algolia.com/doc/guides/managing-results/refine-results/filtering) and lets users refine their search results by toggling the view on or off.

## Examples

```dart Dart icon=code theme={"system"}
class SearchToggleFilter extends StatelessWidget {
  const SearchToggleFilter(
      this.filterState, this.groupID, this.filter, this.label,
      {super.key});

  final FilterState filterState;
  final FilterGroupID groupID;
  final Filter filter;
  final String label;

  @override
  Widget build(BuildContext context) {
    return StreamBuilder(
        stream: filterState.filters,
        builder: (context, snapshot) {
          final filters = snapshot.hasData ? snapshot.data! : StatelessFilters();
          final filterGroups = filters.toFilterGroups().expand((group) => group);
          return FilterChip(
            label: Text(label),
            onSelected: (selected) => selected
                ? filterState.add(groupID, {filter})
                : filterState.remove(groupID, {filter}),
            selected: filterGroups.contains(filter),
          );
        });
  }
}
```
