Skip to contents

The studio guide for mascot(). The same page is read in the mascot studio.

Try it live. The mascot studio shows this function with live controls and the generated code. In an R session with the optional packages bslib and knitr installed, run:
mascot::mascot_studio(fn = "mascot")
It opens on this function's guide; change a control and watch the mascot.

Two calls, one id

Put mascot("helper") in the UI, then use the same id in the server to change its mood. In a module, namespace the UI id with ns(); the module server uses the local id.

UI
mascot("helper")
↔
server
update_mascot("helper", mood = "happy")
module UI
mascot(ns("helper"))
↔
module server
update_mascot("helper", mood = "happy")

Warnings, errors and common mistakes

mascot("has spaces")
Error: could not find function "mascot"
mascot("helper", click = c(help = "Help"))
Error: could not find function "mascot"
mascot("helper", character = "tessa", theme = "lilac_violet")

mascot() errors and lists this character's palettes. The hint names another character that has this id; each palette belongs to its own character.

Error: could not find function "mascot"
mascot("helper", character = "tessa", theme = "zzzzzz")

mascot() errors and lists this character's palettes. No character has this id, so there is no borrowed-palette hint.

Error: could not find function "mascot"