0.0.2 • Published 4 months ago

svelte-cropper v0.0.2

Weekly downloads
-
License
MIT
Repository
-
Last release
4 months ago

SvelteCropper

CropperJS component for Svelte.

Example

<script lang="ts">
    import { Cropper, type CropperInstance, type CropperDefaultProps } from "svelte-cropper"
    
    let cropper: CropperInstance | null = null
    
    let image_src = "https://svelte-cropper.vercel.app/ok.jpg"
    
    const cropper_props: CropperDefaultProps = {
        viewMode: 2, // necessary,
        // optional
        dragMode: "crop",
        initialAspectRatio: 1 // not reactive as cropper initializes on component mount
    }
    
</script>

<Cropper bind:cropper src={image_src} {cropper_props}/>

More examples

Demo

Instalation

pnpm add svelte-cropper

Options

0.0.2

4 months ago

0.0.1

4 months ago