# NoteApi

Canonical page: https://www.adaptabletools.com/docs/reference/noteapi

Notes attached to cells. Each note has text, a type, and the cell it belongs to.

```ts title="TypeScript"
export interface NoteApi 
```

## Methods

| Method | Returns | Description |
| --- | --- | --- |
| [addNote(text, primaryKeyValue, columnId, extra)](https://www.adaptabletools.com/docs/reference/noteapi.md#addnote) | `void` | Adds a new Note |
| [deleteNote(note)](https://www.adaptabletools.com/docs/reference/noteapi.md#deletenote) | `void` | Removes a note from state. |
| [editNote(note)](https://www.adaptabletools.com/docs/reference/noteapi.md#editnote) | `void` | Replaces a note already in state. |
| [getAllNotes()](https://www.adaptabletools.com/docs/reference/noteapi.md#getallnotes) | [`AdaptableNotes`](https://www.adaptabletools.com/docs/reference/adaptablenotes.md) | Gets all Notes |
| [getNoteByUuid(uuid)](https://www.adaptabletools.com/docs/reference/noteapi.md#getnotebyuuid) | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md)` \| undefined` | Returns a Note by uuid |
| [getNoteForCell(cellAddress)](https://www.adaptabletools.com/docs/reference/noteapi.md#getnoteforcell) | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | Gets all Notes for a cell |
| [getNoteState()](https://www.adaptabletools.com/docs/reference/noteapi.md#getnotestate) | [`NoteState`](https://www.adaptabletools.com/docs/reference/notestate.md) | Gets the Note State |
| [setNoteType(note, noteType)](https://www.adaptabletools.com/docs/reference/noteapi.md#setnotetype) | `void` | Sets Type of a Note (`'Info' \| 'Warning' \| 'Error' \| 'Success'`), which drives colour of Note indicator |
| [updateNoteText(text, note)](https://www.adaptabletools.com/docs/reference/noteapi.md#updatenotetext) | `void` | Replaces the text of a note. |

## Method Details

### addNote

Adds a new Note

```ts title="TypeScript"
addNote(text: string, primaryKeyValue: any, columnId: string, extra?: Partial<AdaptableNote>): void;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| text | `string` | Note text |
| primaryKeyValue | `any` | Primary key of the row |
| columnId | `string` | Column the note belongs to |
| extra | `Partial<`[`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md)`>` | optional additional Note properties (e.g. `Author`, `Metadata`, `IsReadOnly`);<br/> `Author` and `CreatedAt` are stamped automatically when not supplied |

###### Returns

`void`

### deleteNote

Removes a note from state.

```ts title="TypeScript"
deleteNote(note: AdaptableNote): void;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| note | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | Note to delete |

###### Returns

`void`

### editNote

Replaces a note already in state.

```ts title="TypeScript"
editNote(note: AdaptableNote): void;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| note | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | Note to save |

###### Returns

`void`

### getAllNotes

Gets all Notes

```ts title="TypeScript"
getAllNotes(): AdaptableNotes;
```

###### Returns

 All Notes

[`AdaptableNotes`](https://www.adaptabletools.com/docs/reference/adaptablenotes.md)

### getNoteByUuid

Returns a Note by uuid

```ts title="TypeScript"
getNoteByUuid(uuid: string): AdaptableNote | undefined;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| uuid | `string` | note uuid |

###### Returns

 A Note by uuid

[`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md)` | undefined`

### getNoteForCell

Gets all Notes for a cell

```ts title="TypeScript"
getNoteForCell(cellAddress: CellAddress): AdaptableNote;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| cellAddress | [`CellAddress`](https://www.adaptabletools.com/docs/reference/celladdress.md) | note position |

###### Returns

 All Notes for a cell

[`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md)

### getNoteState

Gets the Note State

```ts title="TypeScript"
getNoteState(): NoteState;
```

###### Returns

 The Note State

[`NoteState`](https://www.adaptabletools.com/docs/reference/notestate.md)

### setNoteType

Sets Type of a Note (`'Info' | 'Warning' | 'Error' | 'Success'`), which drives colour of Note indicator

```ts title="TypeScript"
setNoteType(note: AdaptableNote, noteType: AdaptableMessageType): void;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| note | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | the Note to update |
| noteType | [`AdaptableMessageType`](https://www.adaptabletools.com/docs/reference/adaptablemessagetype.md) | the new Note Type |

###### Returns

`void`

### updateNoteText

Replaces the text of a note.

```ts title="TypeScript"
updateNoteText(text: string, note: AdaptableNote): void;
```

###### Parameters

| Parameter | Type | Description |
| --- | --- | --- |
| text | `string` | New note text |
| note | [`AdaptableNote`](https://www.adaptabletools.com/docs/reference/adaptablenote.md) | Note to update |

###### Returns

`void`
