Tiptap images

Tiptap image upload, resize and galleries for React

Tiptap’s Image extension shows an image from a URL. Post Canvas, built on Tiptap, adds the rest: an upload adapter with progress, paste and drop, image widths, and galleries in four layouts that render to safe HTML on your server.

npm install post-canvas
Layouts
4
Upload
Your storage
Licence
MIT
React
18.2 and 19

Compare

Tiptap’s image extensions and Post Canvas

What Tiptap’s own open-source extensions cover, and what Post Canvas adds. Checked against each project's own pages on November 19, 2026; the numbers link to them.
FeaturePost CanvasTiptap Image and FileHandler
Upload to your storageAn upload adapter: one upload() function for S3, Cloudinary or your route[5]Not included; the Image extension takes a URL[1]
Paste and drop filesBuilt in, with type and size checks[5]FileHandler catches the events; you write the upload[2]
Progress, cancel and retryBuilt in, from onProgress and an AbortSignal[5]Yours to build[2]
ResizeFive widths for an image (centre, wide, full, left, right); collage photos resize by drag or pinch[7][6]A resize option on the Image extension since 3.10.0[3]
GalleriesCarousel, grid, masonry and collage, with reordering, alt text and captions[6]No gallery extension among the open-source packages[4]
HTML on the serverrenderToHTML() sanitizes first and needs no DOM[8][10]getHTML() in the editor, or a static renderer[9]

Live demo

One gallery, four layouts

Switch the layout here, or select the gallery and use its own menu. Photos you add go to a demo adapter and stay in your browser.

Live editorPick a layout here, or select the gallery and use its own menu.

Loading the editor

Layouts

Carousel, grid, masonry and collage

The same photos in each layout. Readers see the layout the writer picked.
A gallery in the carousel layout: one large coast photo with the next photo peeking in from the sideA gallery in the carousel layout: one large coast photo with the next photo peeking in from the side
Carousel: one photo at a time, with arrows and dots.
A gallery in the grid layout: six coast photos in two rows of even square tilesA gallery in the grid layout: six coast photos in two rows of even square tiles
Grid: even square tiles.
A gallery in the masonry layout: five photos in three columns, each at its own proportionsA gallery in the masonry layout: five photos in three columns, each at its own proportions
Masonry: columns that keep each photo's shape.
Arranging a collage: the collage editor open with a hint to drag, pinch or use handles to place, resize and turn each photoArranging a collage: the collage editor open with a hint to drag, pinch or use handles to place, resize and turn each photo
Collage: drag, resize and turn each photo.

Upload

An upload adapter with progress, cancel and retry

One upload() function sends the file to your storage and returns its URL. The uploads guide has recipes for S3, Cloudinary and your own route, and the progress helper this uses.
import { PostCanvas, type UploadAdapter } from 'post-canvas';
import 'post-canvas/styles.css';
import { xhrUpload } from './xhr-upload'; // progress and abort, from the uploads guide

const upload: UploadAdapter = {
  async upload(file, { signal, onProgress }) {
    // 1. Ask your server for a presigned S3 URL.
    const res = await fetch('/api/uploads', {
      method: 'POST',
      body: JSON.stringify({ name: file.name, type: file.type }),
      signal,
    });
    const { uploadUrl, publicUrl, key } = await res.json();

    // 2. Send the file straight to the bucket, reporting progress.
    await xhrUpload({ method: 'PUT', url: uploadUrl, body: file, signal, onProgress,
      headers: { 'Content-Type': file.type } });

    // 3. Return the public https URL. Width and height are measured for you.
    return { src: publicUrl, id: key };
  },
  maxBytes: { image: 10 * 1024 * 1024 },
};

export function Editor() {
  return (
    <PostCanvas
      adapters={{ upload }}
      features={{ gallery: { layouts: ['carousel', 'grid', 'masonry', 'collage'], maxPhotos: 10 } }}
    />
  );
}

FAQ

Questions

Does Tiptap have image upload built in?

No. Tiptap’s Image extension inserts an image from a URL and does not upload files. Its FileHandler extension catches pasted and dropped files, and you write the upload yourself. Post Canvas adds an upload adapter with progress, cancel and retry on top of Tiptap.

How do I resize images in Tiptap?

Tiptap’s Image extension has had a resize option since 3.10.0. In Post Canvas, a single image has five widths (centre, wide, full, left and right), and photos in a collage resize with a handle, a drag or a pinch.

Is there a Tiptap image gallery extension?

We found none among Tiptap’s open-source packages. Post Canvas ships a gallery node with four layouts (carousel, grid, masonry and collage), a gallery manager for reordering, and alt text and captions on each photo.

Can I use the galleries without the rest of Post Canvas?

Yes, with usePostCanvasEditor and the post-canvas/extensions entry you can build your own interface around the same nodes. Turn off what you do not need with the features prop, as the demo on this page does.

Compare more

Add galleries to your Tiptap editor

Install Post Canvas, pass an upload adapter, and your writers get all four layouts.

npm install post-canvas