> ## Documentation Index
> Fetch the complete documentation index at: https://docs.rebellapp.com/llms.txt
> Use this file to discover all available pages before exploring further.

# my.createCanvasContext

> Create a canvas drawing context.

Use this API to create a canvas context for drawing graphics.

## Parameters

| Property | Type   | Required | Description             |
| -------- | ------ | -------- | ----------------------- |
| canvasId | String | Yes      | The canvas component ID |

## Return Value

Returns a CanvasContext object with drawing methods.

## Code Example

```javascript theme={null}
const ctx = my.createCanvasContext('myCanvas');

ctx.setFillStyle('red');
ctx.fillRect(10, 10, 150, 100);
ctx.draw();
```

```xml theme={null}
<canvas id="myCanvas" style="width: 300px; height: 200px;"></canvas>
```

## Related APIs

<CardGroup cols={2}>
  <Card title="my.createSelectorQuery" icon="crosshairs" href="/jsapi/ui/selector-query/my.createSelectorQuery">
    Query DOM elements
  </Card>
</CardGroup>
