The Dynamic Island is one of Apple's most innovative UI elements in recent years, seamlessly blending hardware constraints with software elegance. In this post, I'll walk you through how I recreated this interactive UI component using React, Framer Motion, and pure CSS.
The iPhone Frame
First, let's look at how I built the iPhone frame using pure CSS and React. The frame consists of multiple layers that create a realistic iPhone 14 Pro appearance:
And yes, even the buttons, speaker and camera are written in CSS 🔥
The Dynamic Island Types
The implementation supports multiple island types:
- Pill: The default compact state
- Capsule: A wider variant for notifications
- Split: A unique state where the island splits into two parts
- Full: An expanded state for detailed information
Each type is managed through an enum:
The Circle Island Animation
The most interesting part is the fluid animation when the island splits into two parts. This is achieved using SVG path morphing and Framer Motion:
The fluid effect is created by carefully controlling the SVG path's bezier curves and morphing between different states. The morph
spring animation provides the natural, physics-based movement that makes the animation feel organic.
Interactive Situations
The Dynamic Island supports various interactive situations:
- Music and Counter: Shows music controls and a counter
- Call: Displays incoming call information with accept/reject buttons
- Flight: Shows flight tracking information
Each situation has its own component and animation states:
Status Bar Integration
The status bar dynamically responds to the Dynamic Island's state changes:
Conclusion
Building this Dynamic Island clone was an exciting challenge that pushed the boundaries of what's possible with React and CSS. The key to achieving the fluid, natural-feeling animations was the combination of SVG morphing, spring physics, and careful attention to timing and easing.
The complete implementation demonstrates how modern web technologies can recreate even the most sophisticated native UI elements. While this is just a demonstration, it shows the potential for web-based interfaces to deliver experiences that rival native applications.
You can find the complete source code on GitHub and try out the live demo to experience the animations firsthand.
Lastly, check out the GitHub Repo for the complete implementation.