# components/KeyValue (zidane-ui)

Import: `import { … } from 'zidane-ui'`. Source: [ui/src/components/KeyValue.tsx](https://github.com/Tahul/zidane/blob/main/ui/src/components/KeyValue.tsx).

## Components

### `KeyValue`

Component.

Renders labelled values as a `dl`.

```ts
function KeyValue(props: KeyValueProps): Element
```

**Parameters**

- `props` (`KeyValueProps`): [`KeyValueProps`](https://zidane.si/docs/reference/ui-components-key-value.md#KeyValueProps).

**Returns** `Element`

**Props**

- `className?` (`string`): Extra classes on the list.
- `items` (`readonly KeyValueItem[]`): The rows, in order.
- `layout?` (`'grid' | 'split'`, default `'grid'`): `grid` lines the values up after the longest label. `split` sets each value at the row's end.
- `meta?` (`boolean`): Show the values in the metadata voice (mono, tabular, small, muted).
- `size?` (`'label' | 'ui'`, default `'label'`): `ui`: values at the row step (13 px), as a view's rows read. Labels stay small and muted.
- `style?` (`CSSProperties`): Inline styles on the list.

Source: [ui/src/components/KeyValue.tsx:42](https://github.com/Tahul/zidane/blob/main/ui/src/components/KeyValue.tsx#L42)

## Interfaces

### `KeyValueItem`

Interface.

One row of a [`KeyValue`](https://zidane.si/docs/reference/ui-components-key-value.md#KeyValue).

```ts
interface KeyValueItem
```

**Properties**

- `id?` (`string`): A stable key. Default: the label when it is a string, else the index.
- `label` (`ReactNode`): What the value is.
- `value` (`ReactNode`): The value.

Source: [ui/src/components/KeyValue.tsx:9](https://github.com/Tahul/zidane/blob/main/ui/src/components/KeyValue.tsx#L9)

### `KeyValueProps`

Interface.

Props for [`KeyValue`](https://zidane.si/docs/reference/ui-components-key-value.md#KeyValue).

```ts
interface KeyValueProps
```

**Properties**

- `className?` (`string`): Extra classes on the list.
- `items` (`readonly KeyValueItem[]`): The rows, in order.
- `layout?` (`'grid' | 'split'`, default `'grid'`): `grid` lines the values up after the longest label. `split` sets each value at the row's end.
- `meta?` (`boolean`): Show the values in the metadata voice (mono, tabular, small, muted).
- `size?` (`'label' | 'ui'`, default `'label'`): `ui`: values at the row step (13 px), as a view's rows read. Labels stay small and muted.
- `style?` (`CSSProperties`): Inline styles on the list.

Source: [ui/src/components/KeyValue.tsx:19](https://github.com/Tahul/zidane/blob/main/ui/src/components/KeyValue.tsx#L19)
