UNPKG

@base-ui/react

Version:

Base UI is a library of headless ('unstyled') React components and low-level hooks. You gain complete control over your app's CSS and accessibility features.

35 lines 1.3 kB
import type { Delay, ElementProps, FloatingContext, FloatingRootContext } from "../types.js"; import type { HandleClose } from "./useHoverShared.js"; export type { HandleCloseContext, HandleClose } from "./useHoverShared.js"; export interface UseHoverProps { /** * Accepts an event handler that runs on `mousemove` to control when the * floating element closes once the cursor leaves the reference element. * @default null */ handleClose?: HandleClose | null | undefined; /** * Waits until the user's cursor is at “rest” over the reference element * before changing the `open` state. * @default 0 */ restMs?: number | (() => number) | undefined; /** * Waits for the specified time when the event listener runs before changing * the `open` state. * @default 0 */ delay?: Delay | (() => Delay) | undefined; /** * Whether moving the cursor over the floating element will open it, without a * regular hover event required. * @default true */ move?: boolean | undefined; } /** * Opens the floating element while hovering over the reference element, like * CSS `:hover`. * @see https://floating-ui.com/docs/useHover */ export declare function useHover(context: FloatingRootContext | FloatingContext, props?: UseHoverProps): ElementProps;