API Reference
DynamicIsland.island
Control and read the island's activation state.
DynamicIsland.island
Controls whether the island is currently showing content, and reads its current display state.
Methods
island.activate(autoDismiss?)
Activates the island (makes it visible and expanded).
// Activate and stay visible
DynamicIsland.island.activate();
// Activate and auto-dismiss after 3 seconds
DynamicIsland.island.activate(3.0);| Parameter | Type | Description |
|---|---|---|
autoDismiss | number (optional) | Seconds before automatic dismissal. Omit to stay visible indefinitely. |
island.dismiss()
Dismisses the island (returns to compact or hides).
DynamicIsland.island.dismiss();Properties
island.state
Read-only. The current display state.
console.log(DynamicIsland.island.state);
// "compact" | "expanded" | "fullExpanded"island.isActive
Read-only. Whether the island is currently showing content for this extension.
if (!DynamicIsland.island.isActive) {
DynamicIsland.island.activate(5.0);
}Example: Show an alert for 4 seconds
function showAlert(message) {
DynamicIsland.store.set("alertMessage", message);
DynamicIsland.island.activate(4.0);
DynamicIsland.playFeedback("warning");
}
DynamicIsland.registerModule({
expanded() {
const msg = DynamicIsland.store.get("alertMessage") ?? "Alert";
return View.hstack([
View.icon("exclamationmark.triangle.fill", { color: "#f59e0b" }),
View.text(msg, { style: "subheadline" }),
], { spacing: 8 });
},
});