Framework Components

Svelte

Integrate PichaFlow into your Svelte and SvelteKit applications with ease.

The @pichaflow/svelte package provides a reactive upload component built specifically for Svelte.

Usage

<script>
  import { PichaUpload } from '@pichaflow/svelte';

  function handleSuccess(event) {
    const response = event.detail;
    console.log('Upload successful:', response.url);
  }
</script>

<PichaUpload
  apiKey="pk_live_your_public_key"
  useSecure={true}
  signatureUrl="/api/media/v1/upload/sign"
  tags={['ecommerce', 'svelte']}
  on:success={handleSuccess}
/>

Props

PropTypeDefaultDescription
apiKeystringRequiredYour PichaFlow Public Key (pk_live_...).
useSecurebooleanfalseEnable the HMAC-SHA256 handshake flow for secure browser uploads.
signatureUrlstringundefinedThe endpoint on your backend that signs the upload request (Required if useSecure is true).
baseUrlstringhttps://api.pichaflow.comOptional API base URL.
tagsstring[][]Tags to apply to the upload.

Events

Svelte events are emitted using the dispatch system.

EventPayloadDescription
successUploadResponseFired when upload completes successfully.
erroranyFired on network or server errors.
progressnumberFired during upload progress updates.