---
title: "KeyValue"
description: "Label/value pairs from a table |Key|Value."
---

> Documentation Index
> Fetch the complete documentation index at: https://gistui.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# KeyValue

```gistui
root = KeyValue(plan, cols:2)
plan = |Key|Value
|Plan|Team
|Monthly cost|$348
|Region|EU (Frankfurt)
|Tokens used|612k / 1M
```

## Signature

This is the line a model reads in the system prompt.

```gistui
KeyValue(data:data, cols:num)
```

- **Group:** Data
- **Children:** No
- **Positional arguments:** `data` (a trailing `?` means it may be left out)

## Props

| Prop | Type | How to write it | Notes |
|---|---|---|---|
| `data` | table | positional, required |  |
| `cols` | number | named: `cols:…` |  |

## Use your own component

Keep the name and schema, swap what is drawn. The prompt and the model's output do not change.

### React

```tsx
import { ui } from "@gistui/react/ui";

const lib = ui.extend({ KeyValue: MyKeyValue });
<GistUI library={lib} stream={response.body} />;
```
### Vue

```vue
<GistUI :source="answer" :components="{ KeyValue: MyKeyValue }" />
```
### Svelte

```svelte
<GistUI source={answer} components={{ KeyValue: MyKeyValue }} />
```
### Solid

```tsx
<GistUI source={answer()} components={{ KeyValue: MyKeyValue }} />
```
### Vanilla

```ts
import { ui } from "@gistui/vanilla/ui";

const lib = ui.extend({ KeyValue: (ctx) => ({ el: myElement(ctx) }) });
```

See [Custom components](/docs/guides/custom-components/) for the full contract. Style hook: `[data-gistui="KeyValue"]`.

Source: https://gistui.com/docs/components/data/key-value/index.mdx
