Skip to content

DrawText

Draws text on the canvas.

Usage

tsx
import { Canvas, DrawText } from 'flexium/canvas';

<Canvas width={300} height={100}>
  <DrawText
    x={10}
    y={50}
    text="Hello Canvas"
    fill="black"
    fontSize={24}
  />
</Canvas>

Props

PropTypeDescription
textstring | Signal<string>The text content.
xnumber | Signal<number>The x-coordinate.
ynumber | Signal<number>The y-coordinate.
fillstring | Signal<string>The text color.
fontSizenumber | Signal<number>Font size in pixels.
fontFamilystringFont family.
textAlign'left' | 'center' | 'right'Text alignment.

Released under the MIT License.