Skip to main content

ImageFocalPoint (Component)

The ImageFocalPoint component is the main file of the library. It is a wrapper of the HTML image element that allows you to drag and drop a focal point button on top of the image element.

Internal HTML structure

<div class="root">
<button class="focalPoint"></button>
<img class="image" />
</div>

Props

NameTypeDefaultRequiredDescription
srcstring-The image source attribute.
onChange(focalPoint: FocalPoint) => void-Callback function that will be called when the user clicks on the focal point button and moves the cursor over the image.
focalPointFocalPoint{ x: 50, y: 50 }-Initial focal point value in percentage.
altstring--The image alt attribute.
labelsLabelProps{ focalPoint: 'Focal point'}-Labels to be used in the component.
classNamestring--CSS class name to be applied to the root element.
classesClassesProps--CSS class names to be applied to the component elements.

LabelProps

NameTypeDefaultRequiredDescription
focalPointstringFocal pointfalseLabel to be used in the focal point button.

ClassesProps

NameTypeDefaultRequiredDescription
rootstring-falseCSS class name to be applied to the root element.
focalPointstring-falseCSS class name to be applied to the focal point button.
imagestring-falseCSS class name to be applied to the image element.