---
name: "CanvasContext.setTextAlign"
mode: "api"
versionRequirements:
  - { name: "Base Library", version: "2.21.8" }
title: "setTextAlign"
---

## CanvasContext.setTextAlign

> [VERSION] Base Library >= 2.21.8

### Description

Set text alignment

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `align` | `"left" \| "right" \| "center"` | Yes | Text alignment |

### Return Value

None


### Examples

#### Set text alignment

```ts
const ctx = ty.createCanvasContext('myCanvas');
ctx.setTextAlign('center');
ctx.setFontSize(20);
ctx.fillText('Hello', 100, 50);
ctx.draw();
```
