reka-ui
Version:
Vue port for Radix UI Primitives.
19 lines (14 loc) • 435 B
text/typescript
import { nextTick, ref } from 'vue'
export function useComposing(onEnd?: (event: CompositionEvent) => void) {
const isComposing = ref(false)
function handleCompositionStart() {
isComposing.value = true
}
function handleCompositionEnd(event: CompositionEvent) {
nextTick(() => {
isComposing.value = false
onEnd?.(event)
})
}
return { isComposing, handleCompositionStart, handleCompositionEnd }
}