Pulled ALL skills from 15 source repositories: - anthropics/skills: 16 (docs, design, MCP, testing) - obra/superpowers: 14 (TDD, debugging, agents, planning) - coreyhaines31/marketingskills: 25 (marketing, CRO, SEO, growth) - better-auth/skills: 5 (auth patterns) - vercel-labs/agent-skills: 5 (React, design, Vercel) - antfu/skills: 16 (Vue, Vite, Vitest, pnpm, Turborepo) - Plus 13 individual skills from various repos Mosaic Stack is not limited to coding — the Orchestrator and subagents serve coding, business, design, marketing, writing, logistics, analysis, and more. Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
90 lines
1.8 KiB
Markdown
90 lines
1.8 KiB
Markdown
---
|
|
category: Sensors
|
|
---
|
|
|
|
# usePointer
|
|
|
|
Reactive [pointer state](https://developer.mozilla.org/en-US/docs/Web/API/Pointer_events).
|
|
|
|
## Basic Usage
|
|
|
|
```ts
|
|
import { usePointer } from '@vueuse/core'
|
|
|
|
const { x, y, pressure, pointerType } = usePointer()
|
|
```
|
|
|
|
## Component Usage
|
|
|
|
By default, the component will track the pointer on `window`
|
|
|
|
```vue
|
|
<template>
|
|
<UsePointer v-slot="{ x, y }">
|
|
x: {{ x }}
|
|
y: {{ y }}
|
|
</UsePointer>
|
|
</template>
|
|
```
|
|
|
|
To track local position in the element, set `target="self"`:
|
|
|
|
```vue
|
|
<template>
|
|
<UsePointer v-slot="{ x, y }" target="self">
|
|
x: {{ x }} y: {{ y }}
|
|
</UsePointer>
|
|
</template>
|
|
```
|
|
|
|
## Type Declarations
|
|
|
|
```ts
|
|
export interface UsePointerState extends Position {
|
|
pressure: number
|
|
pointerId: number
|
|
tiltX: number
|
|
tiltY: number
|
|
width: number
|
|
height: number
|
|
twist: number
|
|
pointerType: PointerType | null
|
|
}
|
|
export interface UsePointerOptions extends ConfigurableWindow {
|
|
/**
|
|
* Pointer types that listen to.
|
|
*
|
|
* @default ['mouse', 'touch', 'pen']
|
|
*/
|
|
pointerTypes?: PointerType[]
|
|
/**
|
|
* Initial values
|
|
*/
|
|
initialValue?: MaybeRef<Partial<UsePointerState>>
|
|
/**
|
|
* @default window
|
|
*/
|
|
target?: MaybeRef<EventTarget | null | undefined> | Document | Window
|
|
}
|
|
/**
|
|
* Reactive pointer state.
|
|
*
|
|
* @see https://vueuse.org/usePointer
|
|
* @param options
|
|
*/
|
|
export declare function usePointer(options?: UsePointerOptions): {
|
|
isInside: ShallowRef<boolean, boolean>
|
|
pressure: Ref<number, number>
|
|
pointerId: Ref<number, number>
|
|
tiltX: Ref<number, number>
|
|
tiltY: Ref<number, number>
|
|
width: Ref<number, number>
|
|
height: Ref<number, number>
|
|
twist: Ref<number, number>
|
|
pointerType: Ref<PointerType | null, PointerType | null>
|
|
x: Ref<number, number>
|
|
y: Ref<number, number>
|
|
}
|
|
export type UsePointerReturn = ReturnType<typeof usePointer>
|
|
```
|