Skip to content

Canvas

widgetsdisplay

A raw Canvas widget providing a HTML5-like 2D drawing context for custom rendering

Installation

$ bunx termuijs add canvas

Copies the source into src/components/canvas/ and installs @termuijs/core, @termuijs/widgets.

Usage

ts
import { Canvas } from '@termuijs/widgets'
ts
new Canvas(style: Partial<Style> = {})

API Reference

Canvas

PropTypeDefaultDescription
childrenReactNoderequiredContent to render
styleStyles{}Ink style object
widthnumber | stringFixed width in columns
heightnumberFixed height in rows
#display#canvas