---
category: Sensors
---
# useTextSelection
Reactively track user text selection based on [`Window.getSelection`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection).
## Usage
```vue
{{ state.text }}
```
## Type Declarations
```ts
export interface UseTextSelectionOptions extends ConfigurableWindow {}
export interface UseTextSelectionReturn {
text: ComputedRef
rects: ComputedRef
ranges: ComputedRef
selection: ShallowRef
}
/**
* Reactively track user text selection based on [`Window.getSelection`](https://developer.mozilla.org/en-US/docs/Web/API/Window/getSelection).
*
* @see https://vueuse.org/useTextSelection
*
* @__NO_SIDE_EFFECTS__
*/
export declare function useTextSelection(
options?: UseTextSelectionOptions,
): UseTextSelectionReturn
```