Cursor

import { Cursor } from '@hanzo/ui'

Default

A bare dot follows the pointer over the wrapped area.

Move your mouse over this area
export function Default() {
return (
<Cursor>
<YStack p="$8" items="center" justify="center" bg="$color2" rounded="$4">
<SizableText>Move your mouse over this area</SizableText>
</YStack>
</Cursor>
)
}

Labelled

CursorText draws a short label inside the dot.

A label rides along with the dot
export function Labelled() {
return (
<Cursor cursorText="✨" cursorSize={28}>
<YStack p="$8" items="center" justify="center" bg="$color2" rounded="$4">
<SizableText>A label rides along with the dot</SizableText>
</YStack>
</Cursor>
)
}

Small dot

A tighter cursorSize for a subtler effect.

A smaller follower
export function Small() {
return (
<Cursor cursorSize={10}>
<YStack p="$8" items="center" justify="center" bg="$color2" rounded="$4">
<SizableText>A smaller follower</SizableText>
</YStack>
</Cursor>
)
}

Types

export type CursorPosition = { x: number; y: number }
export type CursorProps = {
/** Content the cursor effect plays over. */
children: ReactNode
/** Label drawn inside the follower dot; omit for a bare dot. */
cursorText?: string
/** Diameter of the follower dot, in px. */
cursorSize?: number
/** Class notation, converted to style props on the frame. */
className?: string
}

Exports

Cursortype CursorPositiontype CursorProps