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

## CanvasContext.setTextBaseline

> [VERSION] Base Library >= 2.21.8

### Description

Set vertical text alignment

### Parameters

`Params`

| Parameter | Type | Required | Description |
| --- | --- | --- | --- |
| `textBaseline` | `"top" \| "bottom" \| "middle" \| "normal"` | Yes | Vertical text alignment |

### Return Value

None


### Examples

#### Set text baseline

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