# components/IconPicker (zidane-ui)

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

## Components

### `IconPicker`

Component.

The emoji / image picker body — directory icons here, space icons in
Settings › Workspace › Spaces. Hosts own the popover and the persistence.

```ts
function IconPicker(props: IconPickerProps): Element
```

**Parameters**

- `props` (`IconPickerProps`): The [`IconPickerProps`](https://zidane.si/docs/reference/ui-components-icon-picker.md#IconPickerProps).

**Returns** `Element`

**Props**

- `autoFocus?` (`boolean`, default `true`): Focus the emoji field as it opens. `false` where another field leads the card (a name).
- `hasIcon` (`boolean`): An icon is set: the reset row shows.
- `onPick` (`(icon: IconPick | null) => void`): `null` = reset to the default glyph.
- `resetLabel` (`string`): Label of the reset row (shown when an icon is set), such as "Reset to folder".

Source: [ui/src/components/IconPicker.tsx:124](https://github.com/Tahul/zidane/blob/main/ui/src/components/IconPicker.tsx#L124)

## Constants

### `ICON_PICKER_WIDTH`

Constant.

Width of the picker's popover — shared with other hosts of [`IconPicker`](https://zidane.si/docs/reference/ui-components-icon-picker.md#IconPicker) (space icons).

```ts
const ICON_PICKER_WIDTH = 232
```

Source: [ui/src/components/IconPicker.tsx:16](https://github.com/Tahul/zidane/blob/main/ui/src/components/IconPicker.tsx#L16)

## Interfaces

### `IconPickerProps`

Interface.

Props of [`IconPicker`](https://zidane.si/docs/reference/ui-components-icon-picker.md#IconPicker).

```ts
interface IconPickerProps
```

**Properties**

- `autoFocus?` (`boolean`, default `true`): Focus the emoji field as it opens. `false` where another field leads the card (a name).
- `hasIcon` (`boolean`): An icon is set: the reset row shows.
- `onPick` (`(icon: IconPick | null) => void`): `null` = reset to the default glyph.
- `resetLabel` (`string`): Label of the reset row (shown when an icon is set), such as "Reset to folder".

Source: [ui/src/components/IconPicker.tsx:107](https://github.com/Tahul/zidane/blob/main/ui/src/components/IconPicker.tsx#L107)

## Types

### `IconPick`

Type.

What the picker picks: an emoji, or a small image as a data URL.

```ts
type IconPick = { kind: 'emoji'; value: string } | { kind: 'image'; value: string }
```

Source: [ui/src/components/IconPicker.tsx:13](https://github.com/Tahul/zidane/blob/main/ui/src/components/IconPicker.tsx#L13)
