Docs
πŸ—οΈ ⏐ Components
Form
Debounced Input

Debounced Input

The Debounced Input component is designed to optimize user input in applications by delaying the processing of text after a specified duration. This feature is particularly useful in scenarios where real-time input processing may be resource-intensive, such as live search functionalities or validations.

Examples

Basic Usage

This example illustrates the use of Debounced Input for both immediate and delayed text processing. Instant input processes text changes immediately, while delayed input waits for a specified duration before processing the text, minimizing unnecessary computations or API calls:

API

The Debounced Input component offers several configurable properties to tailor its functionality and appearance to suit your application's needs:

PropDescriptionDefault
debounceThe debounce time in milliseconds. Defaults to 100.
number
100
fullWidthIf true, the input will take up the full width of its container.
boolean
selectOnFocusIf true, the input will be focused during the first mount.
boolean
errorIf true, the input will show an error state.
boolean
containerClassnameAdditional classname for the input container element.
string
sizeSize of the input.
string
startContent to display before the input. @deprecated Use `startAdornment` instead.
ReactNode
endContent to display after the input. @deprecated Use `endAdornment` instead.
ReactNode
startAdornmentElement to display before the Button content.
ReactNode
endAdornmentElement to display after the Button content.
ReactNode
onValueChangeShortcut for the onChange value event.
(value: string) => void
themeTheme for the Input.
InputTheme
inputRefReference to the input element.
RefObject<HTMLInputElement>
containerRefReference to the container element.
RefObject<HTMLDivElement>
blurMethod to blur the input.
() => void
focusMethod to focus the input.
() => void
selectMethod to select the input.
() => void

Design and Usability Tips

  • Visual Feedback: Implement visual cues to indicate when the input is being processed or debounced, such as a loader icon or changing the input border color. This feedback reassures users that their input is recognized and will be processed shortly.
  • Adaptive Debouncing: Dynamically adjust the debounce duration based on the use case. For example, increase the duration for live search functionalities to reduce server load, but keep it minimal for local validations to maintain responsiveness.