# Input group: Clear

> `<InputGroupClear />` fades in once there's a value. It clears through the browser's edit history, so Cmd+Z brings the text back, and it fires your `onChange`. Escape clears too. A second Escape is left for the dialog or popover around it.

Example: https://hextaui.com/docs/input-group/examples/clear
Component docs: https://hextaui.com/docs/input-group.md

## Add this example

```bash
npx shadcn@latest add https://hextaui.com/r/input-group-clear.json
```

This adds `components/examples/input-group/clear.tsx` with the Input group component and the HextaUI theme tokens.

## Source

```tsx title="components/examples/input-group/clear.tsx"
"use client"

import * as React from "react"
import { IconSearch } from "@tabler/icons-react"

import {
  InputGroup,
  InputGroupAddon,
  InputGroupClear,
  InputGroupInput,
} from "@/components/ui/input-group"

const fruits = ["Apple", "Apricot", "Banana", "Blackberry", "Cherry", "Fig"]

export function InputGroupClearDemo() {
  const [query, setQuery] = React.useState("ap")
  const matches = fruits.filter((fruit) =>
    fruit.toLowerCase().includes(query.trim().toLowerCase())
  )

  return (
    <div className="flex w-full max-w-sm flex-col gap-3">
      <InputGroup>
        <InputGroupInput
          type="search"
          value={query}
          onChange={(event) => setQuery(event.target.value)}
          placeholder="Filter fruit"
          aria-label="Filter fruit"
        />
        <InputGroupAddon>
          <IconSearch />
        </InputGroupAddon>
        <InputGroupAddon align="inline-end">
          <InputGroupClear />
        </InputGroupAddon>
      </InputGroup>
      <p className="text-sm text-muted-foreground">
        {matches.length > 0 ? matches.join(", ") : "No fruit matches."}
      </p>
    </div>
  )
}
```

## Props in this example

### InputGroupAddon

| Prop | Type | Default | Description |
| --- | --- | --- | --- |
| `align` | `"inline-start" \| "inline-end" \| "block-start" \| "block-end"` | `"inline-start"` |  |

## More Input group examples

- [Icon](https://hextaui.com/docs/input-group/examples/icon.md)
- [Character count](https://hextaui.com/docs/input-group/examples/count.md)
- [Text](https://hextaui.com/docs/input-group/examples/text.md)
- [Button](https://hextaui.com/docs/input-group/examples/button.md)
- [Keyboard hint](https://hextaui.com/docs/input-group/examples/kbd.md)
- [Textarea](https://hextaui.com/docs/input-group/examples/textarea.md)
- [Header](https://hextaui.com/docs/input-group/examples/block-start.md)
- [Password](https://hextaui.com/docs/input-group/examples/password.md)
- [Sizes](https://hextaui.com/docs/input-group/examples/sizes.md)
- [Invalid](https://hextaui.com/docs/input-group/examples/invalid.md)
- [Disabled](https://hextaui.com/docs/input-group/examples/disabled.md)
- [Loading](https://hextaui.com/docs/input-group/examples/loading.md)
- [Dropdown](https://hextaui.com/docs/input-group/examples/dropdown.md)
- [Long content](https://hextaui.com/docs/input-group/examples/long-content.md)
- [Right to left](https://hextaui.com/docs/input-group/examples/rtl.md)
