Skip to main content

A searchable, categorised emoji picker widget for Textual TUI apps

Project description

textual-emoji-picker

A searchable, categorised emoji picker widget for Textual TUI applications.

Drop it into any Textual app as an embedded widget or push it as a modal screen. Covers the full Unicode 15 emoji set (3 600+ emoji) with skin-tone support and real-time search.

┌─────────────────────────────────────────┐
│ Search emoji…                           │
│ 🏳  🏻  🏼  🏽  🏾  🏿                   │
│                                         │
│ 😀 😃 😄 😁 😆 😅 🤣 😂                │
│ 🙂 🙃 🫠 😉 😊 😇 🥰 😍                │
│ 😘 😗 ☺  😚 😙 🥲 😋 😛                │
│ 😜 🤪 😝 🤑 🤗 🤭 🫢 🫣                │
│ 🤫 🤔 🫡 🤐 🤨 😐 😑 😶                │
│                                         │
│ Press Enter or click to select          │
└─────────────────────────────────────────┘

Install

pip install textual-emoji-picker

Requires Python 3.11+ and Textual 1.0+.

Usage

As an embedded widget

from textual.app import App, ComposeResult
from textual_emoji_picker import EmojiPicker

class MyApp(App[None]):
    def compose(self) -> ComposeResult:
        yield EmojiPicker()

    def on_emoji_picker_emoji_selected(self, event: EmojiPicker.EmojiSelected) -> None:
        self.notify(f"You picked: {event.emoji}")

    def on_emoji_picker_cancelled(self, event: EmojiPicker.Cancelled) -> None:
        self.notify("Cancelled")

As a modal screen

from textual.app import App
from textual_emoji_picker import EmojiPickerScreen

class MyApp(App[None]):
    async def action_pick_emoji(self) -> None:
        emoji = await self.push_screen_wait(EmojiPickerScreen())
        if emoji:
            self.notify(f"You picked: {emoji}")

Constructor options

EmojiPicker(
    # Restrict to specific Unicode groups. None = all groups.
    # Available: "smileys-emotion", "people-body", "animals-nature",
    #            "food-drink", "travel-places", "activities",
    #            "objects", "symbols", "flags"
    categories=["smileys-emotion", "people-body"],

    # Default Fitzpatrick skin tone. 1 = neutral (no modifier), 2–6 = light to dark.
    default_skin_tone=1,

    # Exclude emoji introduced after this version (avoids rendering boxes in
    # terminals with older font coverage). None = no filter.
    max_emoji_version=14.0,

    # Show a "recently used" category (in-memory only in v0.1).
    show_recent=False,
)

EmojiPickerScreen accepts the same keyword arguments and forwards them to the inner EmojiPicker.

Keyboard navigation

Key Action
Type anything Filter emoji by name
Arrow keys Navigate the emoji grid
Enter Select the focused emoji
Tab / Shift+Tab Move between search bar, skin-tone row, and grid
Escape Cancel (posts Cancelled / dismisses modal with "")

Skin tones

Select a skin tone swatch to apply a Fitzpatrick modifier to any compatible emoji (hands, gestures, people). Face emoji, hearts, and objects are not modified. Selecting the neutral swatch returns to the unmodified base emoji.

Emoji data

Emoji are sourced from the emoji library (Unicode 15 / Emoji 15.1, ~3 600 fully-qualified emoji). Category and display order follow the Unicode CLDR emoji-test.txt specification.

Feature comparison with emoji-mart

emoji-mart is the reference web emoji picker. This package is a TUI analogue — the goals and constraints differ, but the feature roadmap is informed by emoji-mart.

Feature emoji-mart (web) textual-emoji-picker (TUI)
Full Unicode emoji set Yes (14/15) Yes (15, ~3 600)
Search by name Yes Yes
Category navigation Yes (tabs) v0.2
Skin-tone selector Yes (per emoji + global) Yes (global selector)
Recently used Yes v0.2 (in-memory), v0.3 (persisted)
Custom emoji Yes (image/GIF/SVG) v0.4 (text/string only)
i18n / locale names Yes (22 locales) v0.3
Emoji version filter UI toggle max_emoji_version kwarg
Preview on hover Yes Status-bar label (v0.2)
Per-line count perLine option v0.2 (reactive to widget width)
Image spritesheets Yes Out of scope (terminal renders native glyphs)
GIF/pixel rendering Yes Out of scope
Hover positioning Pixel-accurate Out of scope

Changelog

v0.1.0

  • EmojiPicker(Widget) and EmojiPickerScreen(ModalScreen[str]).
  • Full Unicode 15 emoji set (filtered to max_emoji_version=14.0 by default).
  • Real-time search by CLDR name (English).
  • Skin-tone selector (Fitzpatrick modifiers, global).
  • Keyboard-navigable grid.
  • EmojiSelected and Cancelled message API.

License

MIT. Emoji data sourced from the emoji library (New BSD) and Unicode CLDR (emoji-test.txt, Unicode Data Files License).

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

textual_emoji_picker-0.1.0.tar.gz (71.5 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

textual_emoji_picker-0.1.0-py3-none-any.whl (34.0 kB view details)

Uploaded Python 3

File details

Details for the file textual_emoji_picker-0.1.0.tar.gz.

File metadata

  • Download URL: textual_emoji_picker-0.1.0.tar.gz
  • Upload date:
  • Size: 71.5 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: twine/6.1.0 CPython/3.13.12

File hashes

Hashes for textual_emoji_picker-0.1.0.tar.gz
Algorithm Hash digest
SHA256 1f844788872c7b2565898da087b2ea7cde9097504c97fec30cb58d47114fa1dd
MD5 082416c48075b7c005d53ce6623aacb4
BLAKE2b-256 e68fa94c1ed45d3dfb2426175e355bb2e957d40f8e5d44ebed375e97dd34f542

See more details on using hashes here.

Provenance

The following attestation bundles were made for textual_emoji_picker-0.1.0.tar.gz:

Publisher: publish.yaml on stevenpollack/textual-emoji-picker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

File details

Details for the file textual_emoji_picker-0.1.0-py3-none-any.whl.

File metadata

File hashes

Hashes for textual_emoji_picker-0.1.0-py3-none-any.whl
Algorithm Hash digest
SHA256 5aa3736b28bdca44a496121b09e7424f91ed00bc0cdd1f4bf51559a3e268a9ab
MD5 0e5167b7529a83facd1b8a2a8b7797f4
BLAKE2b-256 3d75f0b6f2feb61182043ec89b8ee4ceee16c1040447acdca06c58893126321d

See more details on using hashes here.

Provenance

The following attestation bundles were made for textual_emoji_picker-0.1.0-py3-none-any.whl:

Publisher: publish.yaml on stevenpollack/textual-emoji-picker

Attestations: Values shown here reflect the state when the release was signed and may no longer be current.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page