Docs
AI

Prompt Chips

Liquid glass prompt chips above a composer that cascade in, then melt into the one you tap as it drops its text into the field.

$npx swiftpieces add PromptChips
Free · MIT + Commons ClauseiOS 17.0+Liquid Glasschipssuggestionspromptscrollgridaiblocks
Type
PromptChips
Files
PromptChips.swift
Depends on
Nothing (Apple frameworks only)
Version
3.1.0
In a full screen · SwiftPieces ProAskAn assistant home with a briefing, suggested prompts and a composer that grows, attaches and records.

Prompt suggestions as liquid glass chips, sized for thumb reach directly above a composer.

Notes

  • Each chip is a liquid glass capsule keyed by a 32pt tinted glyph disc concentric with its leading end; style.blocks cycle across chips (signal, sky, butter, sage, lilac) and symbols: gives each chip its own glyph. Pass tint for a single color. Chips are separate suggestions, so each is its own glass shape, 12pt apart, all in one glass group that only joins shapes inside 10pt: at rest they stay apart, and they melt together only while closing.
  • Two layouts. .row, the default, is a horizontal ScrollView with viewAligned snapping and 16pt content margins, sized for thumb reach directly above a composer. .grid(columns:) lays the chips out in equal columns that fill the width, wrapping onto as many rows as the suggestions need, for a starter screen with several prompts in view at once; a long title wraps to a second line instead of truncating.
  • Arriving, the group fades in on the calm reveal spring while the chips rise in reading order, 45ms apart, each lifting 12pt and growing from 94% (glass ignores opacity inside its group, so the group fades as a whole). A new set of suggestions arrives the same way.
  • Press: the chip's glass and words sink together about 2.5pt per edge, then spring back with a little give. The press is centered, so it never fights the row's scrolling.
  • Choosing gathers everything into the chosen chip: it swells to 104% on the success spring as its disc pops, and every other chip flows home into it, nearest first (40ms a place, counted along the row or across rows and columns in a grid), on the bounceless home spring. Each one's title and disc blur away the moment it leaves, and its glass shrinks to 72% as it travels, so it melts into the chosen chip through a liquid neck and disappears inside it. Chips scrolled out of a row travel in too.
  • Then the hand-off, once the farthest chip has arrived (440ms plus 40ms a place after the tap): the melted chips close out of sight, the chosen chip's title blurs away, and its glass condenses into a drop that falls 24pt toward the composer as it closes, while the chips close from their measured height so the composer below rises into their place. Nothing is clipped. onSelect fires on that beat, and selection is written back.
  • One selection haptic per choice, on the tap; there is no press haptic, so a touch that turns into a scroll stays silent.
  • One choice per set: once a chip is chosen, further taps, VoiceOver activations and selection changes are ignored until the suggestions change or the view is rebuilt. The chips that melted in leave the accessibility tree.
  • Style (PromptChips.Style): blocks, text, ink, cornerRadius (26 by default, a capsule at the chip's 52pt height). surface is kept for source compatibility and no longer used. Every string is semibold.
  • Under Reduce Motion nothing travels: the chips fade in together, the others close in place when one is chosen (their titles fade as their glass closes on a short ease), the chosen one closes the same way as it hands off (0.2s to onSelect), and a press shades instead of sinking. Reduce Transparency makes the glass solid.
  • v3: the motion was rebuilt around a cascade in and a hand-off toward the composer.
  • v3.1: a new close. The ripple away is replaced by a gather: the others flow into the chosen chip where it sits and melt into its glass, so nothing pools anywhere else, and the gathered chip falls into the composer as one drop. The public API is unchanged.
  • Need a full composer with attachments, recording and model picker? That is the Prompt Composer screen in SwiftPieces Pro.

Usage

PromptChipsExample().preferredColorScheme(.light)

Parameters

ParameterDescription
suggestionsChip titles, in order.
systemImageGlyph on every chip's colour disc. Pass nil for text-only chips.
symbolsOptional per-chip glyphs, matched to suggestions by index. Falls back to systemImage.
tintOne disc colour for every chip. nil cycles style.blocks.
styleText, disc colours and radius. Defaults to the house palette.
layout.row (the default) is one horizontally snapping row; .grid(columns:) wraps the chips into equal
selectionOptional two-way selection. Set it to a suggestion to choose it programmatically; the chips write the chosen title back when it hands off.
onSelectCalled with the chosen title as it hands off to the composer, once the other chips have melted into it

Install

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

Terminal

$npx swiftpieces add PromptChips

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

>Add the SwiftPieces "Prompt Chips" 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 ai →

Build it yourself: SwiftUI loading states guide · 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