Get the Live Selection Element and enable it

When enabled, Live Selection will automatically detect and highlight user’s presence on the following elements:

  • input
  • textarea
  • button
  • contenteditable

You can learn more about customizing and controlling which elements are highlighted and its styling here.

const { client } = useVeltClient();
useEffect(() => {
  if (client) {
    const selectionElement = client.getSelectionElement();
    selectionElement.enableLiveSelection();
    selectionElement.disableLiveSelection();
  }
}, [client]);