# ClearAll

### Purpose

The ClearAll component is used to display a basic clear all button.

### Usage

When the `clearAll` method is used all applied filters will be removed and pagination set to the first page.

{% tabs %}
{% tab title="Basic" %}

```tsx
import React from "react";
import { ClearAll } from "@usereactify/search";

import { ExampleClearAll } from "./ExampleClearAll";

export const Component: React.FC = () => {
  return (
    <ClearAll
      render={ExampleClearAll}
    />
  );
};
```

{% endtab %}

{% tab title="ExampleClearAll" %}

```tsx
import React from "react";
import { ClearAllProps } from "@usereactify/search";

export type ExampleClearAllProps = React.ComponentProps<
  NonNullable<ClearAllProps["render"]>
>;

export const ExampleClearAll: React.FC<ExampleClearAllProps> = (props) => {
  return <a onClick={props.clearAll}>{"Clear All"}</a>;
};

```

{% endtab %}
{% endtabs %}

### Props

```typescript
type ClearAllProps = {
  /** Render method */
  render?: React.FC<{
    clearAll: () => void;
  }>;
  /** Render the component even when there are no filters selected (default: false) */
  showWhenEmpty?: boolean;
};
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://search.docs.reactify.com.au/components/clearall.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
