Eazip
React

Build a headless React UI

Render Eazip task state inside your own component library without the ready-made tray.

Go headless when ZIP state must appear inside an existing panel or design system. Keep <EazipTray /> when a floating, complete download interface is acceptable.

Render the task states

ExportButton.tsx
import { useEazip } from '@eazip/react';

export function ExportButton({ files }: { files: File[] }) {
  const zip = useEazip();
  const task = zip.task;

  if (!task) {
    return (
      <button onClick={() => zip.download({ files })}>
        Download as ZIP
      </button>
    );
  }

  if (task.state === 'processing') {
    return (
      <div>
        {task.progress ? (
          <progress
            value={task.progress.filesCompleted}
            max={task.progress.filesTotal}
          />
        ) : (
          <progress />
        )}
        <button onClick={() => zip.cancel(task.id)}>
          Cancel
        </button>
      </div>
    );
  }

  if (task.state === 'failed' && task.canRetry) {
    return (
      <button onClick={() => zip.retry(task.id)}>
        Try again
      </button>
    );
  }

  if (task.state === 'completed' || task.state === 'partial') {
    return (
      <button onClick={() => zip.downloadAll(task.id)}>
        Download {task.zips.length > 1 ? 'all ZIPs' : 'ZIP'}
      </button>
    );
  }

  return null;
}

Cloud progress is indeterminate

task.progress is populated for Local jobs. Cloud tasks currently expose a processing state but not per-file or byte progress.

Preserve the important behavior

A complete custom UI should account for:

  • cancel while processing;
  • retry only when task.canRetry is true;
  • skipped counts on partial output;
  • every ZIP part rather than only the first;
  • Cloud expiry; and
  • an accessible status announcement.

Use Show ZIP progress and let users cancel or retry for a task-focused example and the React Reference for exact task fields.