Stencil building blocks

All optional props without a default remain undefined. class accepts Svelte ClassValue; style is a CSS string.

These primitives require and provide no cropper context. Supply their data and callbacks explicitly. Unless listed, they have no exported instance methods. Container children are optional Snippet values rendered without arguments.

BoundingBox

Positions resize controls and emits anchor, displacement and ResizeOptions. reference is the crop at gesture start. Custom controls must retain the native event so Shift can preserve aspect ratio.

PropTypeDefault
stylestringundefined
classClassValueundefined
handlerSnippet<[HandlerSnippetProps]>SimpleHandler
handlersboolean | Partial<Record<OrdinalDirection, boolean>>All eight directions
linesboolean | Partial<Record<CardinalDirection, boolean>>All four cardinal directions
lineSnippet<[LineSnippetProps]>SimpleLine
disabledbooleanfalse
onResize(anchor: ResizeAnchor, directions: MoveDirections, options: ResizeOptions) => voidundefined
onResizeEnd() => voidundefined
childrenSnippetundefined
referenceCoordinates | nullnull

handler and line use the typed control snippet contracts. A boolean controls all positions; a map enables only true entries.

Selectors are listed in the complete styling inventory.

StencilWrapper

Positions the crop region with width, height, left and top. Transitions interpolate its box. Coordinates are in boundary pixels.

PropTypeDefault
childrenSnippetundefined
classClassValueundefined
stylestringundefined
transitionsCropperTransitionsundefined
widthnumberundefined
heightnumberundefined
leftnumberRequired
topnumberRequired

Selectors are listed in the complete styling inventory.

StencilOverlay

Overlay surface surrounding the crop region. Its children render inside the overlay.

PropTypeDefault
classClassValueundefined
stylestringundefined
childrenSnippetundefined

Selectors are listed in the complete styling inventory.

StencilGrid

Shows a configurable grid. Hidden grids retain their previous row and column counts until shown again.

PropTypeDefault
visiblebooleanfalse
columnsnumber3
rowsnumber3
classClassValueundefined
stylestringundefined

Selectors are listed in the complete styling inventory.

HandlerWrapper

Draggable hit target for one resize handle. position takes precedence over the split horizontal/vertical fields. Movement uses layout pixels; pass through the native event.

PropTypeDefault
classClassValueundefined
stylestringundefined
childrenSnippetundefined
onMove(shift: MoveDirections, event: MouseEvent | TouchEvent) => voidundefined
onMoveEnd() => voidundefined
onLeave() => voidundefined
onEnter() => voidundefined
disabledbooleanundefined
positionOrdinalDirectionundefined
horizontalPositionHorizontalCardinalDirection | nullundefined
verticalPositionVerticalCardinalDirection | nullundefined

Selectors are listed in the complete styling inventory.

LineWrapper

Draggable hit target for one edge. Activation distance is zero; forwards movement and completion.

PropTypeDefault
classClassValueundefined
stylestringundefined
childrenSnippetundefined
onMove(directions: MoveDirections, event: TouchEvent | MouseEvent) => voidundefined
onMoveEnd() => voidundefined
onLeave() => voidundefined
onEnter() => voidundefined
disabledbooleanundefined
positionHorizontalCardinalDirection | VerticalCardinalDirectionundefined

Selectors are listed in the complete styling inventory.

SimpleHandler

Default handle appearance using HandlerWrapper. Its props type is SimpleHandlerProps. class and style land on the outer hit target. It consumes position, horizontalPosition, verticalPosition, disabled, onMove and onMoveEnd; wrapper children and hover callbacks are not forwarded.

PropTypeDefault
classClassValueundefined
stylestringundefined
onMove(shift: MoveDirections, event: MouseEvent | TouchEvent) => voidundefined
onMoveEnd() => voidundefined
disabledbooleanundefined
positionOrdinalDirectionundefined
horizontalPositionHorizontalCardinalDirection | nullundefined
verticalPositionVerticalCardinalDirection | nullundefined

Selectors are listed in the complete styling inventory.

SimpleLine

Default edge appearance using LineWrapper. Its props type is SimpleLineProps. class and style land on the outer hit target. It consumes position, disabled, onMove and onMoveEnd; wrapper children and hover callbacks are not forwarded.

PropTypeDefault
classClassValueundefined
stylestringundefined
onMove(directions: MoveDirections, event: TouchEvent | MouseEvent) => voidundefined
onMoveEnd() => voidundefined
disabledbooleanundefined
positionHorizontalCardinalDirection | VerticalCardinalDirectionundefined

Selectors are listed in the complete styling inventory.