Docs
Data

Ring Breakdown

A composition ring you scrub by dragging around it, lifting each slice with a haptic while its name and share morph in the centre.

$npx swiftpieces add RingBreakdown
See it in a Pro app On a real screen in one of the Pro apps: open it with Pro, take it apart, remix it, and copy the SwiftUI.
Free · MIT + Commons ClauseiOS 17.0+Liquid Glasschartringdonutbreakdownscrublegendbudget
Type
RingBreakdown
Files
RingBreakdown.swift
Depends on
Nothing (Apple frameworks only)
Version
2.2.0
In a full screen · SwiftPieces ProBudgetA budget overview around a ring you can scrub, with category limits and period switching.

Ring chart with scrub-to-select, a lifted slice, and a built-in legend. The ring is content; its chrome is liquid glass. In the center a glass pill names the selection, morphing letter by letter, and the selected slice's share buds out of it as a chip tinted with the slice's color, resting joined to it. The legend rows are glass chips resting apart; the picked one takes its slice's tint.

Notes

  • Slices are solid color blocks from the house palette (red, sky, butter, sage, lilac, sand), separated by a 4 pt gap with rounded ends. Each slice is filled and stroked with a round join, so the corners stay soft at any size.
  • Drag anywhere on the ring and the selection follows your finger around it, with a .selection tick at every slice boundary. Release keeps the selection; tap the hole or the selected legend chip to clear it. Only changes made on the ring, the legend or with VoiceOver tick: a parent setting selection, or new data clearing it, stays silent.
  • The selected slice pulls 6 pt outward along its mid-angle with visible give and lifts a soft shadow, and drops back firmly when it lets go. The others step back to a solid resting color a beat later on a calmer spring, never a faded wash, so a selection reads as one wedge pulling out; clearing brings everything back together. The center is liquid glass over a semibold figure with dimmed decimals: a glass pill names the selection ("Total" when nothing is picked), morphing letter by letter, and the selected slice's share buds out of the pill's end as a chip tinted with the slice's color, resting joined to the pill by a liquid neck while the pair slides over to stay centered. Moving to another slice keeps the chip out: its share rolls and its tint changes in place. Clearing the selection drains its tint and melts it back into the pill. The figure and the share roll without overshoot. The legend is a stack of glass chips resting apart; the picked chip takes its slice's tint with ink text on the slice's beat, the other chips' text steps back on the same follow-through while their glass stays whole, and chips sink slightly when pressed.
  • The ring sweeps in clockwise from the top on first appearance, and again only when data lands in an empty ring, while the center pill and figure are there from the start. New values after that slide the seams to their new angles with no overshoot, even when the selection changes with them, the center figure rolls to its new value, and the selection stays while its label is still there. A slice that arrives opens from the seam between its neighbors as they make room, and one that leaves folds back into it, so the ring never shows more than the whole.
  • tint overrides the first slice; color on a slice overrides any slice. Style sets blocks, rest, ink, text, muted, gap, and cornerRadius. The default thickness is 34 pt. Every string is semibold; size sets the hierarchy.
  • The ring is one VoiceOver element: it reads the selected slice or the total, and swiping up or down moves the selection. Legend chips are 44 pt buttons with their value. Reduce Motion drops the lift, the share chip's bud (it fades in and out in place beside the pill), the letter morph (the name crossfades) and the press scale (a pressed chip dims instead), fades the ring in instead of sweeping it, and crossfades digits instead of rolling them. New values still slide the seams, and slices still open and fold, on a shorter spring with no overshoot. Colors, the shadow and the haptics stay. Under Reduce Transparency the glass draws solid.
  • Labels are the identity, so keep them unique. selection lets a parent drive or observe the selected slice, and a selection set before the ring appears is kept. An id that names no slice draws as no selection.
  • A full budget screen built on a spending ring ships in SwiftPieces Pro (spending-ring).

Usage

RingBreakdownExample().preferredColorScheme(.light)

Parameters

ParameterDescription
slicesParts of the whole, drawn clockwise from the top. Labels must be unique.
thicknessRing thickness in points.
tintColor of the first slice. Defaults to the style's first block; later slices take the next blocks unless a slice sets color.
formatNumber format for the center value and legend, for example .number or .currency(code: "USD"). Defaults to .number.
showsLegendShow the tappable legend rows below the ring.
selectionOptional binding to the selected slice id, for driving selection from outside.
styleSlice blocks, ink, and surface colors. Defaults to .standard: red, sky, butter, sage, lilac, and sand.

Install

Pick one. Run it from the folder that contains your .xcodeproj and the files land inside your app.

Terminal

$npx swiftpieces add RingBreakdown

Or ask your coding agent · Claude Code, Cursor or Xcode, once the MCP server is connected

>Add the SwiftPieces "Ring Breakdown" piece to my app

Or copy the source above into your app.

New to SwiftUI?If you know React, CSS or Tailwind, SwiftUI is easier to pick up than it looks.Try real app patterns first

Building a whole app? See SwiftPieces Pro →

All data and charts →

Build it yourself: SwiftUI animations guide

On this page

SwiftPiecesPro

Build the whole app with one library.

Production-ready screens, whole flows, complete app templates, a Build Kit your agent follows and Pro remixing.

54 screens · 46 patterns · 48 flows · 12 templates · 31 Build Kit skills

Explore Pro