React API
Three components and one hook, exported from react-7tv.
Provider7tv
Shares an emote collection, matching syntax, and animation preference.
| Prop | Default | Purpose |
|---|---|---|
emoteSetId | — | Public set ID or global |
emotes | — | Controlled collection; disables fetching |
initialEmotes | Empty | SSR and loading fallback |
syntax | Plain | Default matching rules |
animated | true | Default image animation |
fetch / apiBaseUrl | 7tv API | Custom transport or proxy |
onError | — | Request error callback |
Text7tv
Transforms string children and nested intrinsic elements. Custom component output is left alone.
| Prop | Default | Purpose |
|---|---|---|
as | span | Wrapper element; Fragment removes it |
emotes / syntax / animated | Provider | Per-component overrides |
recursive | true | Visit intrinsic element children |
excludeElements | Safe defaults | Replace the excluded-tag list |
emoteProps | — | Pass options to the image renderer |
renderEmote | Emote7tv | Custom React renderer |
Emote7tv
Requires an EmoteModel7tv. Accepts animated, size, formatPreference, and image attributes except src/srcSet. The default image height is 1.5em.
use7tv
Must be called inside a provider. getEmote uses an exact alias lookup, independent of the configured matching syntax.
const { emotes, status, error, getEmote } = use7tv();
// status: "idle" | "loading" | "ready" | "error"
const emote = getEmote("PETPET");