Skip to content

components/IconPicker

import { … } from 'zidane-ui'ui/src/components/IconPicker.tsx

Components#

IconPickerComponent#

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

TypeScript
function IconPicker(props: IconPickerProps): Element
Parameters
NameTypeDescription
propsIconPickerProps

The IconPickerProps.

Element
IconPicker props
NameTypeDefaultDescription
autoFocus?booleantrue

Focus the emoji field as it opens. false where another field leads the card (a name).

hasIconboolean

An icon is set: the reset row shows.

onPick(icon: IconPick | null) => void

null = reset to the default glyph.

resetLabelstring

Label of the reset row (shown when an icon is set), such as "Reset to folder".

ui/src/components/IconPicker.tsx:124

Constants#

ICON_PICKER_WIDTHConstant#

Width of the picker's popover — shared with other hosts of IconPicker (space icons).

TypeScript
const ICON_PICKER_WIDTH = 232

ui/src/components/IconPicker.tsx:16

Interfaces#

IconPickerPropsInterface#

Props of IconPicker.

TypeScript
interface IconPickerProps
IconPickerProps properties
NameTypeDefaultDescription
autoFocus?booleantrue

Focus the emoji field as it opens. false where another field leads the card (a name).

hasIconboolean

An icon is set: the reset row shows.

onPick(icon: IconPick | null) => void

null = reset to the default glyph.

resetLabelstring

Label of the reset row (shown when an icon is set), such as "Reset to folder".

ui/src/components/IconPicker.tsx:107

Types#

IconPickType#

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

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

ui/src/components/IconPicker.tsx:13