emoteer

API reference

Public types and helpers exported from the library

Everything public Emoteer exposes. Imported from either @emoteer/core (framework-agnostic) or @emoteer/react (re-exported for convenience).

NativeEmoji

The canonical shape of a Unicode emoji, mapped from emojibase.

@emoteer/core
interface NativeEmoji {
  unicode: string;       // e.g. '😀'
  label: string;         // human-readable name
  shortcodes: string[];  // without colons, e.g. ['grinning_face']
  group: number;         // emojibase group (0–9)
  hexcode: string;       // e.g. '1F600'
  tags?: string[];       // optional search tags
}

LocalEmote

A developer-defined image-based emote supplied through EmoteProvider.

@emoteer/core
interface LocalEmote {
  id: string;       // stable identifier
  name: string;     // display name, also used as shortcode without colons
  src: string;      // URL or path to the image
  category?: string;
}

See Custom emojis for the full integration.

Emote

Discriminated union of the two kinds an Emoteer component can render.

@emoteer/core
type Emote = NativeEmoji | LocalEmote;

function isLocalEmote(e: Emote): e is LocalEmote; // 'src' in e
function isNativeEmoji(e: Emote): e is NativeEmoji; // 'unicode' in e

Every onSelect callback in EmoteList and EmoteAutocomplete fires with an Emote. Use the helpers to narrow before consuming type-specific fields.

Reaction

The shape consumed by ReactionCounter.

@emoteer/react
interface Reaction {
  emoji: string; // unicode glyph or any string
  count: number;
  active: boolean;
}

Locale

Controls which shortcode dictionary is loaded. BCP 47 tag.

@emoteer/core
type SupportedLocale =
  | 'bn' | 'da' | 'de' | 'en' | 'en-gb' | 'es' | 'es-mx' | 'et' | 'fi'
  | 'fr' | 'hi' | 'hu' | 'it' | 'ja' | 'ko' | 'lt' | 'ms' | 'nb' | 'nl'
  | 'pl' | 'pt' | 'ru' | 'sv' | 'th' | 'uk' | 'vi' | 'zh' | 'zh-hant';

type Locale = SupportedLocale | (string & {});

Unsupported tags fall back to 'en' at runtime.

CloudConfig

Reserved for the forthcoming Emoteer Cloud tier.

@emoteer/core
interface CloudConfig {
  projectId: string;
  apiKey: string;
}

EmoteProviderProps

Props accepted by EmoteProvider.

@emoteer/react
interface EmoteProviderProps {
  children: React.ReactNode;
  natives?: boolean;       // load Unicode emojis (default: true)
  locals?: LocalEmote[];   // custom emotes
  locale?: Locale;         // default: 'en'
  cloud?: CloudConfig;     // reserved
}

useEmoteContext

Runtime context exposed by EmoteProvider.

@emoteer/react
interface EmoteContextValue {
  emojis: NativeEmoji[];
  locals: LocalEmote[];
  emotes: Emote[];                         // natives + locals
  shortcodeIndex: Map<string, Emote>;      // `:name:` → emote
  unicodeIndex: Map<string, NativeEmoji>;  // glyph → native
  isLoading: boolean;
  error: Error | null;
}

Imports

your-app.ts
// Framework-agnostic — safe in any environment
import {
  isLocalEmote,
  isNativeEmoji,
  type NativeEmoji,
  type LocalEmote,
  type Emote,
  type Locale,
  type SupportedLocale,
  type CloudConfig,
} from '@emoteer/core';

// Re-exported from the React binding
import {
  isLocalEmote,
  isNativeEmoji,
  type Emote,
  type EmoteProviderProps,
  type Reaction,
} from '@emoteer/react';

On this page