Skip to content

React Hooks

Annota provides a comprehensive set of React hooks for building annotation interfaces.

useAnnotator

Access the annotator instance for programmatic control.

View →

useAnnotations

Get all annotations as a reactive array.

View →

useAnnotation

Get a specific annotation by ID.

View →

useSelection

Access currently selected annotations.

View →

useTool

Activate and manage annotation tools.

View →

usePushToolCursor

Display push tool radius cursor.

View →

useLayers

Get all layers as a reactive array.

View →

useLayer

Get a specific layer by ID.

View →

useLayerManager

Create, update, and delete layers.

View →

useHistory

Access undo/redo functionality.

View →

useCanUndo

Check if undo is available.

View →

useCanRedo

Check if redo is available.

View →

useHover

Track hovered annotation.

View →

useEditing

Track annotation being edited.

View →

useViewer

Access OpenSeadragon viewer.

View →

useContextMenu

Manage context menu state.

View →

useContextMenuBinding

Bind context menu to annotations.

View →

usePopup

Manage popup/tooltip state.

View →

import {
// Core
useAnnotator,
useAnnotations,
useAnnotation,
useSelection,
// Tools
useTool,
usePushToolCursor,
// Layers
useLayers,
useLayer,
useLayerManager,
// History
useHistory,
useCanUndo,
useCanRedo,
// Interaction
useHover,
useEditing,
useViewer,
// UI
useContextMenu,
useContextMenuBinding,
usePopup,
} from "annota";