Skip to content

DrawText

Draws text on the canvas.

Usage

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

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

Props

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

Released under the MIT License.