Components

Sticker picker

A popover of stickers to choose from: a search field, category chips and a grid you walk with the arrow keys. Reach for it in a comment box, a reaction bar or a profile editor. The highlighted sticker peels its corner.

Install

terminal
npx shadcn@latest add @wobko/sticker-picker

First time here? Add the registry to components.json first. How to install

Examples

A sticker for the job

Type to search, click a category, or walk the grid with the arrow keys. The highlighted sticker peels its corner; Enter sticks it.

Your own set

Offer only the stickers you want, under your own names and words. Here a reaction picker: four to a row, it stays open so you can react more than once (choose one again to take it back), and the latest choice is marked.

In a comment box

The picker as a composer tool: choose a sticker, it waits beside the text (click it to take it off), and posting sends both. Recent stickers come first next time.

API reference

StickerPicker

A Popover (same open, defaultOpen, onOpenChange, modal) that also holds what the grid needs: the catalog, the recent list and what happens on choosing.

PropTypeDefaultDescription
onSelect(sticker: StickerPickerItem) => void-Called with { name, label, category, categoryLabel, tags } when one is chosen (Enter, or a tap).
valuestring | null-The sticker chosen elsewhere: it is marked in the grid (aria-selected, and a check).
stickers(string | { name; label?; category?; tags? })[]-Offer only these, in this order, under your own labels, categories and search words. Names that have not been drawn are skipped. Default: everything in the art library, grouped by the batch it was drawn in.
recentstring[]-Ids to show first under "Recent" (in the unfiltered view). Keep them in your own state.
closeOnSelectbooleantrueClose after choosing. Turn off to add several in a row.

StickerPickerContent

The slip that opens: search field, category chips, the grid, and a caption naming the highlighted sticker. Its body exists only while open, so the search starts fresh every time.

PropTypeDefaultDescription
columnsnumber5Stickers per row (at least 1).
sizenumber44Drawn size of a sticker in the grid, px.
placeholderstring"Search stickers"Placeholder of the search field.
align / side / …PopoverContent props-Everything PopoverContent takes (stock, pin, tape, arrow, sideOffset).

Accessibility

  • The search field is a combobox (aria-expanded, aria-controls, aria-autocomplete="list") and keeps focus; the grid is a listbox of options that the field points at with aria-activedescendant, grouped by category (role group, named by its heading).
  • Arrow keys move the highlight: Left and Right one sticker, Up and Down one row (a row is `columns` wide; between categories the column is kept as far as it goes). Home and End go to the first and last while the field is empty. With text in the field, Left and Right move the caret until it reaches the end it is heading for. Enter chooses. Escape closes and returns focus to the trigger.
  • Pressing a sticker with the mouse does not move the focus out of the search field, so with closeOnSelect off the arrow keys keep working between picks.
  • Each option is named by its sticker ("Rocket"); the count of matches is announced politely as you type ("12 stickers.", "No stickers found.").
  • The category chips are toggle buttons (aria-pressed) in their own tab stop; clicking one returns focus to the field. The row scrolls sideways on a narrow popover.
  • The highlighted sticker is shown by a highlighter swipe behind it, a small turn and the peeled corner, not by color alone. Windows high contrast keeps the stickers (intrinsic art).
  • The empty state has a status line and Stubby with a magnifier.

Source

The files the CLI copies into your project.

Loading the source