# AIContextResource

typedef

An individual resource item within a [`AIContextProvider`](module_ai_aichat_model_aichatcontext-AIContextProvider.md).

Represents a single selectable item in the resources list displayed when a user clicks on a custom context menu option. The [`label`](#member-label) is displayed to the user as the resource name, and the [`type`](#member-type) indicates what kind of context item this represents (file, document, or URL).

When selected, the resource will be attached to the AI prompt to provide additional context for generating responses. If the [`data`](#member-data) property is provided, it contains the content of the resource. If [`data`](#member-data) is `undefined`, the content will be retrieved using the [`getData`](module_ai_aichat_model_aichatcontext-AIContextProvider.md#member-getData) callback from the parent [`AIContextProvider`](module_ai_aichat_model_aichatcontext-AIContextProvider.md) when the resource is selected by the user.

```typescript
{
	id: 'user-guide-intro',
	type: 'text',
	label: 'User Guide - Introduction',
	data: {
		content: '<p>Lorem ipsum dolor sit amet...</p>',
		type: 'html'
	}
}
```

<a id="properties">

## Properties

<a id="member-data">

### `data?: string | File | AIContextTextResource`

The content of the resource.

**Note**: When `undefined`, for instance, because the resource content is large and obtaining it should be done on demand, the content will be retrieved using the optional [`getData`](module_ai_aichat_model_aichatcontext-AIContextProvider.md#member-getData) callback from the parent [`AIContextProvider`](module_ai_aichat_model_aichatcontext-AIContextProvider.md) when the resource is selected by the user.

**Note**: For the `'text'` [resource type](#member-type), `data` should be in the [`AIContextTextResource`](module_ai_aichat_model_aichatcontext-AIContextTextResource.md) format.

<a id="member-id">

### `id: string`

The unique identifier of the resource.

<a id="member-label">

### `label: string`

The human-readable name of the resource.

<a id="member-type">

### `type: AIContextItemType`

The type of the resource.

#### Value

`object`

---

Full index of the CKEditor 5 API reference: [llms.txt](llms.txt)
