Skip to documentation

EmojiPicker

EmojiPicker is a component that allows users to select emoji icons or upload custom avatars. It supports multiple tabs, custom emoji sets, model avatars from @lobehub/icons, and includes options for uploading and deleting avatars.

import { EmojiPicker } from '@lobehub/ui';
Data Entry

Default

Loading preview

Upload

Loading preview

Custom Emoji

Loading preview

Custom Tabs

Loading preview

Model Avatar

Loading preview

Controlled

Loading preview

APIs

EmojiPicker properties
allowDelete
boolean
allowModelAvatar
boolean
allowUpload
false | true | { enableEmoji?: boolean; }
altAvatarProps
string

Alias for the native `alt` attribute of the rendered image

animationAvatarProps
boolean

Play the animated emoji variant instead of the static one

backgroundAvatarProps
string

Background color, ignored when the avatar is an image or a custom node

borderedAvatarProps
boolean

Show the outer ring

borderedColorAvatarProps
string

Custom color for the outer ring

classNamesAvatarProps
AvatarClassNames

Custom class names for each part

compressSize
number

Defaults to 256.

contentProps
Omit<FlexBasicProps, 'style' | 'className' | 'ref'>
crossOriginAvatarProps
'' | 'anonymous' | 'use-credentials'

Native `crossOrigin` attribute forwarded to the rendered image

customEmojis
EmojiPickerCustomEmoji[]
customRender
(avatar: string) => ReactNode
customTabs
EmojiPickerCustomTab[]
defaultAvatar
string
defaultOpen
boolean

Defaults to false.

draggableAvatarProps
boolean

Native `draggable` attribute of the rendered image

Defaults to false.

emojiScaleWithBackgroundAvatarProps
boolean

Scale the emoji down when a background color is present

Defaults to true.

loading
boolean

Show the full-size loading overlay

locale
string

Defaults to "en-US".

onChange
(emoji: string) => void
onDelete
() => void
onOpenChange
(open: boolean) => void
onUpload
(file: File) => void
open
boolean
popupClassName
string
popupProps
Omit<PopoverProps, 'children' | 'content' | 'defaultOpen' | 'onOpenChange' | 'open' | 'trigger'>
popupStyle
CSSProperties
refAvatarProps
null | (instance: HTMLDivElement | null) => void | (() => VoidOrUndefinedOnly) | DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES[keyof DO_NOT_USE_OR_YOU_WILL_BE_FIRED_CALLBACK_REF_RETURN_VALUES] | RefObject<HTMLDivElement | null>

Allows getting a ref to the component instance. Once the component unmounts, React will set `ref.current` to `null` (or call the ref with `null` if you passed a callback ref).

shadowAvatarProps
boolean

Apply the lobe shadow style

shapeAvatarProps
'circle' | 'square'

Defaults to 'square'.

size
number

Width and height in pixels

Defaults to 48.

sliceTextAvatarProps
boolean

Slice fallback text to its first two characters

Defaults to true.

stylesAvatarProps
AvatarStyles

Custom styles for each part

texts
{ draggerDesc?: string; fileTypeError?: string; uploadBtn?: string; } & { delete?: string; emoji?: string; upload?: string; }
titleAvatarProps
string

Fallback text when no avatar content resolves; also used as the default image alt text

tooltipPropsAvatarProps
Record<string, unknown>

Reserved for tooltip integration; not rendered yet

unoptimizedAvatarProps
boolean

Accepted for compatibility with next/image-based avatars; has no effect on the native img

value
string
variantAvatarProps
'filled' | 'outlined' | 'borderless'

Visual variant

Defaults to 'borderless'.

Also accepts all native HTML and ARIA attributes.

EmojiPickerCustomEmoji

PropertyDescriptionTypeDefault
idUnique identifier for the emoji setstring-
nameName of the emoji setstring-
emojisArray of emoji definitionsArray<{ id: string; name: string; keywords?: string[]; skins: Array<{ src: string }> }>-

EmojiPickerCustomTab

PropertyDescriptionTypeDefault
valueUnique identifier for the tabstring-
labelLabel to display for the tabReactNode-
renderRender function for the tab content(handleAvatarChange: (avatar: string) => void) => ReactNode-