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';Default
Upload
Custom Emoji
Custom Tabs
Model Avatar
Controlled
APIs
allowDeletebooleanallowModelAvatarbooleanallowUploadfalse | true | { enableEmoji?: boolean; }altAvatarPropsstringAlias for the native `alt` attribute of the rendered image
animationAvatarPropsbooleanPlay the animated emoji variant instead of the static one
backgroundAvatarPropsstringBackground color, ignored when the avatar is an image or a custom node
borderedAvatarPropsbooleanShow the outer ring
borderedColorAvatarPropsstringCustom color for the outer ring
classNamesAvatarPropsAvatarClassNamesCustom class names for each part
compressSizenumberDefaults to
256.contentPropsOmit<FlexBasicProps, 'style' | 'className' | 'ref'>crossOriginAvatarProps'' | 'anonymous' | 'use-credentials'Native `crossOrigin` attribute forwarded to the rendered image
customEmojisEmojiPickerCustomEmoji[]customRender(avatar: string) => ReactNodecustomTabsEmojiPickerCustomTab[]defaultAvatarstringdefaultOpenbooleanDefaults to
false.draggableAvatarPropsbooleanNative `draggable` attribute of the rendered image
Defaults to
false.emojiScaleWithBackgroundAvatarPropsbooleanScale the emoji down when a background color is present
Defaults to
true.loadingbooleanShow the full-size loading overlay
localestringDefaults to
"en-US".onChange(emoji: string) => voidonDelete() => voidonOpenChange(open: boolean) => voidonUpload(file: File) => voidopenbooleanpopupClassNamestringpopupPropsOmit<PopoverProps, 'children' | 'content' | 'defaultOpen' | 'onOpenChange' | 'open' | 'trigger'>popupStyleCSSPropertiesrefAvatarPropsnull | (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).
shadowAvatarPropsbooleanApply the lobe shadow style
shapeAvatarProps'circle' | 'square'Defaults to
'square'.sizenumberWidth and height in pixels
Defaults to
48.sliceTextAvatarPropsbooleanSlice fallback text to its first two characters
Defaults to
true.stylesAvatarPropsAvatarStylesCustom styles for each part
texts{ draggerDesc?: string; fileTypeError?: string; uploadBtn?: string; } & { delete?: string; emoji?: string; upload?: string; }titleAvatarPropsstringFallback text when no avatar content resolves; also used as the default image alt text
tooltipPropsAvatarPropsRecord<string, unknown>Reserved for tooltip integration; not rendered yet
unoptimizedAvatarPropsbooleanAccepted for compatibility with next/image-based avatars; has no effect on the native img
valuestringvariantAvatarProps'filled' | 'outlined' | 'borderless'Visual variant
Defaults to
'borderless'.
Also accepts all native HTML and ARIA attributes.
EmojiPickerCustomEmoji
| Property | Description | Type | Default |
|---|---|---|---|
| id | Unique identifier for the emoji set | string | - |
| name | Name of the emoji set | string | - |
| emojis | Array of emoji definitions | Array<{ id: string; name: string; keywords?: string[]; skins: Array<{ src: string }> }> | - |
EmojiPickerCustomTab
| Property | Description | Type | Default |
|---|---|---|---|
| value | Unique identifier for the tab | string | - |
| label | Label to display for the tab | ReactNode | - |
| render | Render function for the tab content | (handleAvatarChange: (avatar: string) => void) => ReactNode | - |