react-pdf-highlighter-plus

The props type for ShapeHighlight.

interface ShapeHighlightProps {
    bounds?: string | Element;
    colorPresets?: string[];
    deleteIcon?: ReactNode;
    endPoint?: {
        x: number;
        y: number;
    };
    highlight: ViewportHighlight;
    isScrolledTo?: boolean;
    shapeType?: ShapeType;
    startPoint?: {
        x: number;
        y: number;
    };
    strokeColor?: string;
    strokeWidth?: number;
    style?: CSSProperties;
    styleIcon?: ReactNode;
    onChange?(rect): void;
    onContextMenu?(event): void;
    onDelete?(): void;
    onEditEnd?(): void;
    onEditStart?(): void;
    onStyleChange?(style): void;
}

Properties

bounds?: string | Element

react-rnd bounds on the highlight area.

colorPresets?: string[]

Custom color presets for the style panel.

deleteIcon?: ReactNode

Custom delete icon. Replaces the default trash icon.

endPoint?: {
    x: number;
    y: number;
}

For arrows: end point as percentage of bounding box (0-1).

Type declaration

  • x: number
  • y: number

The highlight to be rendered as a ShapeHighlight.

isScrolledTo?: boolean

Has the highlight been auto-scrolled into view?

shapeType?: ShapeType

The type of shape to render.

Default

"rectangle"
startPoint?: {
    x: number;
    y: number;
}

For arrows: start point as percentage of bounding box (0-1).

Type declaration

  • x: number
  • y: number
strokeColor?: string

Stroke color for the shape.

Default

"#000000"
strokeWidth?: number

Stroke width for the shape.

Default

2
style?: CSSProperties

Custom styling for the container.

styleIcon?: ReactNode

Custom style icon. Replaces the default palette icon.

Methods

  • A callback triggered whenever the highlight position or size changes.

    Parameters

    • rect: LTWHP

      The updated highlight area.

    Returns void

  • A callback triggered on context menu.

    Parameters

    • event: MouseEvent<HTMLDivElement, MouseEvent>

    Returns void