Defined in: [src/types/messages.ts:219](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L219)

Text content block within a message.

## Implements

-   [`TextBlockData`](/pr-cms-5569/docs/api/typescript/TextBlockData/index.md)
-   `JSONSerializable`<[`TextBlockData`](/pr-cms-5569/docs/api/typescript/TextBlockData/index.md)\>

## Constructors

### Constructor

```ts
new TextBlock(data): TextBlock;
```

Defined in: [src/types/messages.ts:230](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L230)

#### Parameters

| Parameter | Type |
| --- | --- |
| `data` | `string` |

#### Returns

`TextBlock`

## Properties

### type

```ts
readonly type: "textBlock";
```

Defined in: [src/types/messages.ts:223](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L223)

Discriminator for text content.

---

### text

```ts
readonly text: string;
```

Defined in: [src/types/messages.ts:228](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L228)

Plain text content.

#### Implementation of

[`TextBlockData`](/pr-cms-5569/docs/api/typescript/TextBlockData/index.md).[`text`](/pr-cms-5569/docs/api/typescript/TextBlockData/index.md#text)

## Methods

### toJSON()

```ts
toJSON(): TextBlockData;
```

Defined in: [src/types/messages.ts:238](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L238)

Serializes the TextBlock to a JSON-compatible TextBlockData object. Called automatically by JSON.stringify().

#### Returns

[`TextBlockData`](/pr-cms-5569/docs/api/typescript/TextBlockData/index.md)

#### Implementation of

`JSONSerializable.toJSON`

---

### fromJSON()

```ts
static fromJSON(data): TextBlock;
```

Defined in: [src/types/messages.ts:248](https://github.com/strands-agents/harness-sdk/blob/main/strands-ts/src/types/messages.ts#L248)

Creates a TextBlock instance from TextBlockData.

#### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| `data` | [`TextBlockData`](/pr-cms-5569/docs/api/typescript/TextBlockData/index.md) | TextBlockData to deserialize |

#### Returns

`TextBlock`

TextBlock instance