useInputComposition

Tags:
This Hook is available since v1.4.0.

A React Hook that helps to track the composition state of an input element.

Demo

Source
isComposing:
false
Composition data:

Usage

See API for more details.

Source

Click links below to view source on GitHub.

API

const { isComposiing, data } = useInputComposition(elementTarget)

ElementTarget

ElementTarget is a union type that represents various kinds of elements that can be targeted.

See ElementTarget or ElementTarget Types for more details.

Returns

interface InputCompositionState { /** * Whether the input is in the composition state. */ isComposing: boolean /** * The composition data. */ data: string } export interface UseInputCompositionReturns extends InputCompositionState {}