API Reference
DynamicIsland.mascot
Control the mascot companion from your extension.
DynamicIsland.mascot
The mascot is an animated companion character that can appear in the island. Users choose from multiple characters in Settings.
Methods
mascot.setExpression(expression)
Set the mascot's current expression.
DynamicIsland.mascot.setExpression("happy");Available expressions: "idle", "working", "alert", "happy", "tired", "clicked"
mascot.getExpression()
Returns the current expression string.
const expr = DynamicIsland.mascot.getExpression(); // "idle"mascot.getSelected()
Returns the ID of the currently selected mascot character.
const id = DynamicIsland.mascot.getSelected(); // e.g. "otto"mascot.list()
Returns an array of all available mascot IDs.
const ids = DynamicIsland.mascot.list(); // ["otto", ...]mascot.setInput(text)
Feed text input to the mascot (drives lip sync / reaction animations).
DynamicIsland.mascot.setInput("Processing your request...");Using mascot in a view
Use View.mascot() to render the mascot inside your extension's view:
expanded() {
const isWorking = DynamicIsland.store.get("busy") ?? false;
if (isWorking) {
DynamicIsland.mascot.setExpression("working");
}
return View.hstack([
View.mascot({ size: 48, expression: isWorking ? "working" : "idle" }),
View.vstack([
View.text("Assistant", { style: "subheadline", bold: true }),
View.text(isWorking ? "Thinking..." : "Ready", { color: "#888" }),
], { spacing: 2 }),
], { spacing: 12 });
}Example: React to timer events
setInterval(() => {
if (running) {
DynamicIsland.mascot.setExpression("working");
} else {
DynamicIsland.mascot.setExpression("idle");
}
}, 5000);