A floating pill at the top of the screen that shows live activities and brief notifications, like the Dynamic Island.
Island is an open-source interaction from suiss/ui for React, React Native, SwiftUI and Jetpack Compose. The @esuiss/ui CLI copies its source into your project, so you own the code.
import { BellIcon, ChatCircleIcon } from "@phosphor-icons/react"import { Island, IslandProvider, useIsland,} from "@/components/interactions/island"import { Button } from "@/components/ui/button"function NotifyButtons() { const { notify } = useIsland() return ( <div className="flex flex-wrap justify-center gap-3"> <Button variant="secondary" onClick={() =>
Island renders a dark pill fixed to the top of the viewport, below the safe-area inset. It morphs between four views: hidden, compact, expanded, and notice. The pill measures the active part and animates its width, height, and corner radius with a spring curve, so content changes feel continuous.
A live activity is an IslandCompact and IslandExpanded pair rendered inside Island. Mounting an IslandCompact shows the pill; tapping it expands to the details. Notifications come from the notify function returned by useIsland; a notice temporarily takes over the pill and then returns to the activity, or hides the pill when no activity is mounted. Use it for ongoing, glanceable status such as downloads, timers, or calls.
Installation
$ pnpm dlx shadcn@latest add @esuiss/island
Works in any project with a components.json. See Installation for the one-line registry setup. Or use the suiss/ui CLI:
$ pnpm dlx @esuiss/ui@latest add interactions island
Copy and paste the following code into your project.
components/interactions/island.tsx
"use client"import { cva } from "class-variance-authority"import * as React from "react"import { cn } from "@/lib/utils"type IslandView = "hidden" | "compact" | "expanded" | "notice"type IslandNotice = { icon?: React.ReactNode title: React.ReactNode description?: React.ReactNode duration?: number}type IslandContextProps = {
Update the import paths to match your project setup.
Usage
import { Island, IslandCompact, IslandExpanded, IslandProvider, IslandRing, useIsland,} from "@/components/interactions/island"import { Button } from "@/components/ui/button"
function NotifyButton() { const { notify } = useIsland() return ( <Button onClick={() => notify({ icon: <ChatCircleIcon />, title: "Jordan Lee", description: "Are we still on for Saturday?", }) } > Notify </Button> )}
Composition
Use the following composition to build a IslandProvider:
IslandProviderโโโ Island โโโ IslandCompact โ โโโ IslandRing โโโ IslandExpanded
Examples
Live activity
A download runs as a live activity, with a progress ring in the compact pill and details plus a cancel button when expanded.
import { CheckCircleIcon, DownloadSimpleIcon, FileZipIcon,} from "@phosphor-icons/react"import * as React from "react"import { Island, IslandCompact, IslandExpanded, IslandProvider, IslandRing, useIsland,} from "@/components/interactions/island"import { Button } from "@/components/ui/button"
Activity with notifications
A notification temporarily replaces a running live activity, which returns once the notice is dismissed.
import { BellIcon, ChatCircleIcon, CheckCircleIcon, DownloadSimpleIcon, FileZipIcon,} from "@phosphor-icons/react"import * as React from "react"import { Island, IslandCompact, IslandExpanded, IslandProvider, IslandRing, useIsland,} from "@/components/interactions/island"
Accessibility
IslandCompact is a button with aria-expanded reflecting the expanded state; give it an aria-label that describes the activity.
Expanding moves focus to the first enabled button, link, or input inside IslandExpanded, which has role="group" and is inert while not shown.
Escape or a pointer press outside collapses the expanded view. After Escape, focus returns to the compact button if it was inside the island.
Notices render as a button that dismisses on press, and their title and description are announced through a polite live region.
Inactive parts are removed from the tab order. IslandRing is aria-hidden.
API Reference
IslandProvider
Holds the island state and provides notify, dismiss, and the expanded state to everything inside it.
Prop
Type
Default
children
React.ReactNode
-
Wrap the app, or the part of it that posts notifications, in IslandProvider. Island, IslandCompact, IslandExpanded and useIsland throw outside of it.
Call notify({ icon, title, description, duration }) from useIsland to show a notice. It replaces any current notice and dismisses itself after duration milliseconds (4000 by default). Call dismiss to remove it early. useIsland also exposes view, expanded and setExpanded for custom controls.
Island
The fixed pill that sizes itself to the active view and renders the built-in notice.
Also accepts the props of React.ComponentProps<"div">.
Render a single Island. Mount IslandCompact and IslandExpanded as its children only while an activity is running; unmounting the compact part hides the pill and collapses it. The root sets data-slot="island" and data-view with the current view. Each part sets a data-slot, such as island-compact, and carries data-active while shown. Animations are disabled under prefers-reduced-motion.
IslandCompact
The button shown in the collapsed pill; tapping it expands the island.
Also accepts the props of React.ComponentProps<"button">.
IslandExpanded
The detailed view shown when the island is expanded.
Also accepts the props of React.ComponentProps<"div">.
IslandRing
A small circular progress ring for the compact pill.
Prop
Type
Default
value
number
Required
Also accepts the props of React.ComponentProps<"svg">.
value is progress from 0 to 1; values outside the range are clamped.
Web
Web preview
import { CheckCircleIcon, DownloadSimpleIcon, FileZipIcon,} from "phosphor-react-native"import * as React from "react"import { Pressable, View } from "react-native"import { Island, IslandExpandedRegion, IslandProvider, IslandRing,} from "@/components/interactions/island"import { Icon } from "@/components/ui/icon"import { Text } from "@/components/ui/text"
This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Island floats below the top safe area and morphs between views: hidden, compact, minimal, expanded and notice. Its width, height and corner radius spring to the measured size of the active view, and views cross-fade as it changes.
Content is passed through slots. compactLeading and compactTrailing sit at the two ends of the compact pill, minimal is a single small circle, and IslandExpandedRegion children fill the expanded view. The island appears while it has compact or minimal content and hides when it has none. Pressing it expands; pressing outside, swiping up or the Android back button collapses it. notify shows a notice that replaces the current view and dismisses itself after 4 seconds, on press or on swipe up. Use it for ongoing activity such as a download, timer or call.
import * as React from "react"
import { HapticsContext } from "./haptics"
const DEFAULT_PORTAL_HOST = "INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME"
type PortalEntries = ReadonlyMap<string, React.ReactNode>
const EMPTY_ENTRIES: PortalEntries = new Map()
let hosts: ReadonlyMap<string, PortalEntries> = new Map()
const listeners = new Set<() => void>()
function emit() {
for (const listener of listeners) listener()
}
Copy and paste the following code into components/interactions/island.tsx:
uniwind/components/interactions/island.tsx
import { cn } from "cn"import type { IconProps as PhosphorIconProps } from "phosphor-react-native"import * as React from "react"import { type AccessibilityActionEvent, AccessibilityInfo, Pressable, useWindowDimensions, View,} from "react-native"import { Gesture, GestureDetector } from "react-native-gesture-handler"import { ReduceMotion, runOnJS, type SharedValue, useAnimatedStyle,
Update the import paths to match your project setup.
import * as React from "react"
import { HapticsContext } from "./haptics"
const DEFAULT_PORTAL_HOST = "INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME"
type PortalEntries = ReadonlyMap<string, React.ReactNode>
const EMPTY_ENTRIES: PortalEntries = new Map()
let hosts: ReadonlyMap<string, PortalEntries> = new Map()
const listeners = new Set<() => void>()
function emit() {
for (const listener of listeners) listener()
}
Copy and paste the following code into components/interactions/island.tsx:
nativewind/components/interactions/island.tsx
import { cn } from "cn"import type { IconProps as PhosphorIconProps } from "phosphor-react-native"import * as React from "react"import { type AccessibilityActionEvent, AccessibilityInfo, Pressable, useWindowDimensions, View,} from "react-native"import { Gesture, GestureDetector } from "react-native-gesture-handler"import { ReduceMotion, runOnJS, type SharedValue, useAnimatedStyle,
Update the import paths to match your project setup.
import * as React from "react"
import { HapticsContext } from "./haptics"
const DEFAULT_PORTAL_HOST = "INTERNAL_PRIMITIVE_DEFAULT_HOST_NAME"
type PortalEntries = ReadonlyMap<string, React.ReactNode>
const EMPTY_ENTRIES: PortalEntries = new Map()
let hosts: ReadonlyMap<string, PortalEntries> = new Map()
const listeners = new Set<() => void>()
function emit() {
for (const listener of listeners) listener()
}
Copy and paste the following code into components/interactions/island.tsx:
stylesheet/components/interactions/island.tsx
import type { IconProps as PhosphorIconProps } from "phosphor-react-native"import * as React from "react"import { type AccessibilityActionEvent, AccessibilityInfo, Pressable, type StyleProp, StyleSheet, type TextStyle, useWindowDimensions, View, type ViewStyle,} from "react-native"import { Gesture, GestureDetector } from "react-native-gesture-handler"import { ReduceMotion,
Update the import paths to match your project setup.
Target iOS 17 or later.
Copy the theme files every view uses:
swift/Theme/Theme.swift
import CoreTextimport SwiftUIimport UIKitstruct RGBA: Sendable { let red: CGFloat let green: CGFloat let blue: CGFloat let alpha: CGFloat init(_ hex: UInt32, _ alpha: CGFloat = 1) { red = CGFloat((hex >> 16) & 0xFF) / 255 green = CGFloat((hex >> 8) & 0xFF) / 255 blue = CGFloat(hex & 0xFF) / 255 self.alpha = alpha }
swift/Theme/Tokens.swift
import SwiftUIpublic enum EsuissColor { public static let background = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x000000)) public static let foreground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7)) public static let card = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F)) public static let cardForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7)) public static let popover = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0x1D1D1F)) public static let popoverForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7)) public static let primary = Color.adaptive(light: .init(0x0071E3), dark: .init(0x0A84FF)) public static let primaryForeground = Color.adaptive(light: .init(0xFFFFFF), dark: .init(0xFFFFFF)) public static let secondary = Color.adaptive(light: .init(0x000000, 0.04), dark: .init(0xFFFFFF, 0.1)) public static let secondaryForeground = Color.adaptive(light: .init(0x1D1D1F), dark: .init(0xF5F5F7)) public static let muted = Color.adaptive(light: .init(0xF5F5F7), dark: .init(0x161617)) public static let mutedForeground = Color.adaptive(light: .init(0x6E6E73), dark: .init(0x86868B)) public static let accent = Color.adaptive(light: .init(0x000000, 0.06), dark: .init(0xFFFFFF, 0.1))
Copy the source:
swift/Interactions/Island.swift
import SwiftUIenum IslandMath { static func ringProgress(_ value: Double) -> Double { min(max(value, 0), 1) }}public struct IslandRing: View { let value: Double let color: Color public init(value: Double, color: Color = EsuissColor.primary) { self.value = value self.color = color }
Add the files to your app target.
Apply the Compose compiler plugin, enable Compose, set compileSdk to 37 or higher and minSdk to 24 or higher, and add the dependencies:
package com.esuiss.ui.themeimport androidx.compose.runtime.Immutableimport androidx.compose.ui.graphics.Colorimport androidx.compose.ui.text.font.FontWeightimport androidx.compose.ui.unit.dp@Immutabledata class Colors( val background: Color, val foreground: Color, val card: Color, val cardForeground: Color, val popover: Color, val popoverForeground: Color, val primary: Color,
Starts with the island expanded to show download details. Add IslandExpandedRegions with a region of leading, trailing, center or bottom: leading, center and trailing form a top row, and bottom regions stack below it at full width.
React Native
import { CheckCircleIcon, DownloadSimpleIcon, FileZipIcon,} from "phosphor-react-native"import * as React from "react"import { Pressable, View } from "react-native"import { Island, IslandExpandedRegion, IslandProvider, IslandRing, useIsland,} from "@/components/interactions/island"import { Icon } from "@/components/ui/icon"import { Text } from "@/components/ui/text"
This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
Starts in the minimal view with only the progress ring. If only one of the compact and minimal slots is given, the island uses it for both views.
React Native
import { CheckCircleIcon, DownloadSimpleIcon, FileZipIcon,} from "phosphor-react-native"import * as React from "react"import { Pressable, View } from "react-native"import { Island, IslandExpandedRegion, IslandProvider, IslandRing, useIsland,} from "@/components/interactions/island"import { Icon } from "@/components/ui/icon"import { Text } from "@/components/ui/text"
This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
import { BellIcon, ChatCircleIcon } from "phosphor-react-native"import * as React from "react"import { View } from "react-native"import { Island, IslandProvider, useIsland,} from "@/components/interactions/island"import { Button } from "@/components/ui/button"import { Icon } from "@/components/ui/icon"import { Text } from "@/components/ui/text"function NoticeOnMount() { const { notify } = useIsland() const shownRef = React.useRef(false)
import { BellIcon, ChatCircleIcon } from "phosphor-react-native"import * as React from "react"import { View } from "react-native"import { Island, IslandProvider, useIsland,} from "@/components/interactions/island"import { Button } from "@/components/ui/button"import { Icon } from "@/components/ui/icon"import { Text } from "@/components/ui/text"import { fontSize, palette, useTheme } from "@/components/ui/theme"function NoticeOnMount() { const { colors } = useTheme() const { notify } = useIsland()
A download that starts on press, with buttons that minimize the island and send notices over it.
Web
Web preview
import { BellIcon, ChatCircleIcon, CheckCircleIcon, DownloadSimpleIcon, FileZipIcon,} from "phosphor-react-native"import * as React from "react"import { Pressable, View } from "react-native"import { Island, IslandExpandedRegion, IslandProvider, IslandRing, useIsland,} from "@/components/interactions/island"
This code uses Tailwind classes that need Uniwind or NativeWind. With StyleSheet, pass the same values through the style props.
import ActivityKitimport SwiftUIimport Foundationstruct IslandLiveActivity: View { @State private var activity: Activity<DownloadActivityAttributes>? @State private var state = DownloadActivityAttributes.ContentState(progress: 0, fileName: "Design-Kit.zip", finished: false) @State private var failure: String? var body: some View { VStack(alignment: .leading, spacing: 16) { Text("Start a download, then leave the app. The activity shows in the Dynamic Island and on the Lock Screen.") .textStyle(.sm) .foregroundStyle(EsuissColor.mutedForeground) FlowRow(spacing: 12) { Button("Start") { start() }
Notices are announced with their title and description when they are text.
The compact and minimal views are buttons that expose expanded and have activate and expand actions.
The expanded view has the group role, a collapse action and closes on the escape gesture.
The notice is a button with activate and dismiss actions.
Inactive views and the progress ring are hidden from screen readers.
API Reference
IslandProvider
Holds the island mode, the notice and the notice timer.
Prop
Type
Default
children
React.ReactNode
-
Wrap the app in IslandProvider. useIsland returns view, notice, expand, collapse, minimize, notify and dismiss. A notice is { icon?, title, description?, duration? }; pass a duration of 0 or Infinity to keep it until dismissed. Dragging the island pauses the notice timer. The IslandNotice, IslandRegion and IslandView types are exported.
IslandExpandedRegion
A region of the expanded view.
Prop
Type
Default
region
"leading" | "trailing" | "center" | "bottom"
Required
Also accepts the props of ViewProps.
Island
The floating pill, rendered in a portal, with slots for the compact and minimal views.
Prop
Type
Default
className
string
-
compactLeading
React.ReactNode
-
compactTrailing
React.ReactNode
-
minimal
React.ReactNode
-
portalHost
string
-
Also accepts the props of React.ComponentProps<typeof View>.
Render one Island. Pass compactLeading, compactTrailing and minimal only while there is activity to show, and add IslandExpandedRegions as children. compactLeading and compactTrailing sit at the start and end of the compact pill. portalHost names a portal host to render into. Expanded and notice views are up to 384 points wide, and size and fade animations respect the system reduce motion setting.