Annotations.Root creates the AnnotationStore: the list (controlled or not), tools, colours, selection, undo/redo, keyboard shortcuts and PDF import/export. Layers render per page; floating parts and toolbars go anywhere inside.
Anatomy
Usage
- Workflow: text selection opens the menu; every creation is pending (Enter keeps, Esc discards); tools are one-shot; editing needs a double-click. See Annotation workflow.
- Note emoji: pass
noteEmojis(e.g.defaultNoteEmojis: 💬 🤔 💡 🤯 🧐 🤨 😍 📌) and notes show an emoji instead of the icon. While the note tool is active, or notes are selected, keys 1–8 pick one (store.pickingNoteEmoji);bind:noteEmojiholds the active one andAnnotations.NoteEmojiis its toolbar button. - Text box fonts:
freetextFontsets the family of new text boxes ('Handwritten','Helvetica','Times','Courier'); the context menu’s Font submenu changes one. Typefaces come from--pdf-font-handwritten,--pdf-font-sans,--pdf-font-serifand--pdf-font-mono. See Annotation model. - Read-only:
readonly, per-annotationlocked, andforeign('editable'·'readonly'·'hidden') for annotations found in the PDF. - Export:
store.exportPdf(),toMarkdown(),toJSON();importFromPdfloads annotations stored in the file. See PDF export & import. - Model: see Annotation model.
API reference
Annotations.Root
A provider: renders no element of its own.
data-pdf-annotation-announcerAnnotations.Layer
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-activedata-drawingdata-emojidata-partdata-pdf-annotation-focusdata-pdf-annotation-labeldata-pdf-annotation-layerdata-pdf-annotation-notedata-pdf-annotation-overlaydata-pdf-annotation-svgdata-pdf-annotation-uidata-pdf-draw-surfacedata-selecteddata-themedata-tooldata-underlayAnnotations.SelectionMenu
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-colordata-force-mountdata-partdata-pdf-annotation-uidata-pdf-selection-menudata-stateAnnotations.Popover
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-activedata-force-mountdata-kinddata-partdata-pdf-annotation-popoverdata-pendingdata-stateAnnotations.HoverCard
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-force-mountdata-partdata-pdf-annotation-hover-carddata-stateAnnotations.Margin
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-hovereddata-layoutdata-partdata-pdf-annotation-margindata-pdf-annotation-uidata-pdf-margin-markerdata-pdf-margin-notedata-placementdata-selecteddata-sideAnnotations.LineMarkers
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-hovereddata-lanedata-pdf-annotation-uidata-pdf-line-markerdata-pdf-line-markersdata-selecteddata-sideAnnotations.List
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-kinddata-partdata-pdf-annotation-listdata-pdf-annotation-list-itemdata-selectedAnnotations.Crop
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-pdf-annotation-cropAnnotations.Comment
Renders a <div> (or your element via child) and accepts its HTML attributes.
data-modedata-partdata-pdf-annotation-commentdata-pdf-annotation-uiAnnotations.Markdown
A provider: renders no element of its own.
Annotations.Tool
Renders a <button> (or your element via child) and accepts its HTML attributes.
data-activedata-pdf-annotation-toolAnnotations.Color
Renders a <button> (or your element via child) and accepts its HTML attributes.
data-activedata-pdf-annotation-colorAnnotations.NoteEmoji
Renders a <button> (or your element via child) and accepts its HTML attributes.
data-activedata-pdf-annotation-note-emojiAnnotations.Undo
Renders a <button> (or your element via child) and accepts its HTML attributes.
No props of its own besides ref, child and children.
Annotations.Redo
Renders a <button> (or your element via child) and accepts its HTML attributes.
No props of its own besides ref, child and children.