<canvas-text>

<canvas-text>

A lightweight web component that rasterizes layered rich text and images onto a canvas. Perfect for memes, OG cards, and sticker tools.

Rasterize rich text
onto a canvas.

Features

Live demos

Quick Start

Installation

Install via npm:

npm install @profpowell/canvas-text render-tag

render-tag is a peer dependency — add it alongside the component.

Basic Usage

<script type="importmap"> { "imports": { "render-tag": "https://esm.sh/render-tag@0.1.7" } } </script> <script type="module" src="https://unpkg.com/@profpowell/canvas-text"></script> <canvas-text width="600" compose="text-only"> <strong>Hello</strong> world </canvas-text>

Layered (Meme) Usage

<canvas-text width="500" height="500"> <img slot="background" src="doge.jpg" crossorigin="anonymous"> <div slot="text-1" style="text-align:center; font-size:48px; font-weight:bold; color:white; -webkit-text-stroke:2px black; padding-top:20px;"> TOP TEXT </div> <div slot="text-2" style="text-align:center; font-size:48px; font-weight:bold; color:white; -webkit-text-stroke:2px black; padding-top:400px;"> BOTTOM TEXT </div> </canvas-text>

Related Components

Part of the ProfPowell vanilla web components suite: