Skip to main content


Creates a local emoji database.

import { createDatabase } from 'picmo';
  locale: Locale,
  factory: DataStoreFactory,
  staticMessages?: MessagesDataset | undefined,
  staticEmojis?: Emoji[] | undefined): Promise<void>

Initializes an emoji database before creating a picker. The database can be populated with bundled data, or downloaded from a CDN.

A separate database is maintained for each desired locale.

To use static data, staticMessages and staticEmojis must both be provided. If either one of them is undefined, the full data will be downloaded from the CDN.


This function is provided for convenience and troubleshooting purposes. It is not required to use. If no database exists, it will be created and populated the first time a picker is shown.

For IndexedDB databases, the name of the database in the browser will be PicMo-<locale>, e.g. PicMo-en for English.

In-memory databases are ephemeral and will be discarded when the page is closed.


  • locale: The locale to use for the emoji database.
  • factory: The data store factory to use to create the database.
  • staticMessages: An optional set of static message data from the emojibase-data package.
  • staticEmojis: An optional array of static Emoji records from the emojibase-data package.
    • Type: Emoji[] | undefined
    • Default value: undefined

Return value

A Promise that is resolved when the database is ready.