- Label
- Icon label
- Field
- Form
- Frontmatter form
- Questionnaire
- Input
- Input group
- Input OTP
- Password input
- Password strength
- Code input
- Number field
- Tag input
- Textarea
- Checkbox
- Radio group
- Language toggle group
- Emoji appearance toggle group
- Emoji picker
- Avatar picker
- AI provider picker
- Select
- Native select
- Combobox
- Language combobox
- Slider
- Calendar
- Switch
- Alert
- Avatar
- Badge
- Card
- AI provider card
- Model info card
- Model list
- Empty
- Item
- Tree item
- File tree
- Icon media
- File type icon
- Font preview
- Image preview
- Kbd
- Table
- Data table
- Data table column header
- Chart
- Code Block
- Code card
- Markdown view
- Attachment
- Bubble
- Marker
- Message
- Chat message
- Chat suggestion item
- Message scroller
- Trace
- Progress
- Spinner
- Sonner
- Toast
- Unsaved changes toolbar
- Unsaved indicator
- Status indicator
- Permission card
- Separator
- Skeleton
- Animated grid pattern
- Meteors
A searchable, categorized emoji list with an optional frequent row and a category nav, mounting only the rows near the screen.
Installation#
pnpm dlx shadcn@latest add @zui/emoji-pickerThe CLI writes components/data-entry/emoji-picker.tsx, installs Button,
Icon, Input group,
Text, Toggle group, Utils, the
Fluent emoji lib and the emoji picker rows lib, and adds @zeroxsolutions/fluent-emoji, whose catalog entry holds
the emoji, and lucide-react-native.
Usage#
import {
EmojiPicker,
EmojiPickerContent,
EmojiPickerEmpty,
EmojiPickerNav,
EmojiPickerSearch,
} from '@/components/data-entry/emoji-picker';<EmojiPicker onSelect={setEmoji}>
<EmojiPickerSearch />
<EmojiPickerContent>
<EmojiPickerEmpty>
<Empty>
<EmptyHeader>
<EmptyTitle>No emoji found</EmptyTitle>
</EmptyHeader>
</Empty>
</EmojiPickerEmpty>
</EmojiPickerContent>
<EmojiPickerNav aria-label="Categories" />
</EmojiPicker>The root owns the query, the active category and the rows, and draws nothing of its own. The list mounts only the rows near the screen, so opening the catalog of about 1900 emoji draws one screenful and fetches only the artwork in view. Use it to pick an emoji glyph; for the Fluent artwork style itself, use Emoji appearance toggle group.
Composition#
EmojiPicker
|-- EmojiPickerSearch
|-- EmojiPickerContent
| `-- EmojiPickerEmpty
`-- EmojiPickerNavAPI reference#
EmojiPicker#
Holds the query, the active category and the rows, and draws nothing of its own:
| Prop | Type | Default |
|---|---|---|
onSelect | (emoji: string) => void | required |
frequent | EmojiPickerFrequent | - |
surface | 'background' | 'card' | 'popover' | 'background' |
children | ReactNode | required |
frequent is { name: string; emojis: string[] }: the recently used row's heading and nav item name, and its
glyphs, most recent first. The picker stores nothing; the caller keeps the list. An empty list keeps the nav item,
disabled, and drops the section; an omitted frequent has neither.
surface names what the picker sits on, the page, a Card or a
Popover, and the headings are drawn in its colour so the rows scrolling under
them stay hidden. It stands in for the web's --emoji-picker-surface variable;
Avatar picker sets it to popover.
EmojiPickerSearch#
Takes every prop of Input group's InputGroupInput except value,
defaultValue, onChange and onChangeText. The search field, bound to the picker's query, with a search icon
before it; placeholder defaults to "Search" and aria-label to "Search emoji", and className places the
group. A query matches an emoji whose catalog search text holds it, trimmed and in any case, and the matches show
in one list with no headings.
EmojiPickerContent#
Takes every prop of a View except style, plus:
| Prop | Type | Default |
|---|---|---|
size | 'sm' | 'md' | 'lg' | 'md' |
The scrolling list, in a box of the size height placed by className: a FlatList of the emoji eight to a row,
each a ghost icon button named by the emoji's name, under a heading per category that sticks to the top while its
rows scroll under it. Only the rows near the screen mount. children follow the rows, which is where an
EmojiPickerEmpty goes. A new search starts the list back at the top.
EmojiPickerEmpty#
Takes every prop of a View. The no-results state: draws its children, an Empty
the caller composes, only while a search matches nothing. Place it in EmojiPickerContent.
EmojiPickerNav#
Takes every prop of Toggle group except type, value,
onValueChange and children. The category nav: a single-choice group joined across the picker's width, one icon
item per category, announced as a radio named by the category. Choosing one scrolls the list to that category's
heading; the active one stays chosen when pressed again. Give the group its own aria-label. Hidden while
searching.
EmojiPickerGroupLabel#
Takes every prop of a View. A section heading in the muted colour on the colour of the picker's surface, which the
list draws for each category; a string child is drawn in a Text.
Differences from the web#
- The list is a FlatList, whose own windowing and sticky headers replace the web's.
- The headings take the colour
surfacenames; the web's take the colour of the card or popover they sit in, or the--emoji-picker-surfacevariable, neither of which a View can read. - The search and category icons are static; the web's play while hovered or focused. A cell has no tooltip.
EmojiPickerNavtakes nomultiple, since it is single-choice, and its items are radios, where the web's are pressed buttons.- The web's
data-slotattributes are not set; a View takes no data attributes.