Skip to content

Commit 8eb411c

Browse files
committed
Fix input on clear
1 parent 94170ba commit 8eb411c

File tree

1 file changed

+3
-0
lines changed
  • packages/components/src/components/Input

1 file changed

+3
-0
lines changed

packages/components/src/components/Input/index.tsx

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,7 @@ interface InputProps extends Omit<ComponentProps<'input'>, 'type'> {
2121
icon?: string
2222
errorMessage?: string
2323
}
24+
onClear?: () => void
2425
colors?: {
2526
primary?: string
2627
error?: string
@@ -49,6 +50,7 @@ export function Input({
4950
className,
5051
classNames,
5152
ref,
53+
onClear,
5254
...props
5355
}: InputProps) {
5456
const [value, setValue] = useState(defaultValue || '')
@@ -58,6 +60,7 @@ export function Input({
5860
}
5961
const handleClear = () => {
6062
setValue('')
63+
onClear?.()
6164
}
6265
const clearButtonVisible = value && !disabled && allowClear
6366

0 commit comments

Comments
 (0)