Customization
Vue Croppa v1 exposes two different kinds of customization:
- Canvas-affecting props change the generated image.
- CSS changes only the component's presentation in the page.
Keeping those separate avoids a common surprise: changing the component background with CSS does not change exported pixels.
Appearance playground
Canvas color
canvas-color is painted into the canvas, so it affects exported output.
<croppa
v-model="croppa"
canvas-color="#ffffff"
></croppa>For transparent output, keep canvas-color="transparent" and use CSS for the visual background.
Placeholder
<croppa
v-model="croppa"
placeholder="Drop a profile photo"
placeholder-color="#0f766e"
:placeholder-font-size="16"
></croppa>An image can also be used as the placeholder:
Initial image layout
initial-size behaves similarly to CSS background sizing:
coverfills the crop viewport.containkeeps the whole image visible.naturalstarts at the source image's natural size.
prevent-white-space forces cover-like behavior because the viewport may not expose empty canvas.
initial-position accepts center, edges such as top left, or percentage values such as 30% 40%.
Responsive / auto sizing
v1 can size itself from the rendered component instead of the numeric width/height props.
<croppa
v-model="croppa"
auto-sizing
class="responsive-croppa"
></croppa>In v1, auto-sizing reacts to the window resize event. v2 uses ResizeObserver; its quality prop scales the backing canvas and export pixels.
Zoom behavior
zoom-speed controls wheel sensitivity and reverse-scroll-to-zoom reverses the wheel direction.
For a custom control surface, you can drive the exposed v1 scale state directly:
Directly mutating internal state is a v1 escape hatch. Prefer documented methods for ordinary application code.
Disable built-in interactions
Use disabled to disable everything, or disable specific behaviors:
<croppa
v-model="croppa"
:disable-click-to-choose="true"
:disable-drag-and-drop="true"
:disable-drag-to-move="true"
:disable-scroll-to-zoom="true"
:disable-pinch-to-zoom="true"
:disable-rotation="true"
></croppa>This is useful when your own toolbar should be the only way to manipulate the crop.
Custom loading
The built-in spinner is optional. For a fully custom loading state, listen to the lifecycle events.
Canvas attachments
The draw event runs after Croppa draws the image. Use it for watermarks, stickers, guides, or other output-visible canvas additions.
Custom clipping
For rounded rectangles, image-border-radius is the simplest API. For arbitrary paths, use addClipPlugin().