Docs
Inputs

Size PickerNew

A glass row of sizes with a red pill that flows to your pick, sold out sizes struck through and shaking, and a stock note under it.

$npx swiftpieces add SizePicker
Free · MIT + Commons ClauseiOS 17.0+Liquid Glasssizepickershopstockselectionglasshaptics
Type
SizePicker
Files
SizePicker.swift
Depends on
Nothing (Apple frameworks only)
Version
1.0.0

Colors for SizePicker. .standard is the house palette.

Notes

  • Sizes are strings, so clothing letters, shoe numbers, cup sizes or plan tiers all work. Mark sold out ones in unavailable.
  • The chosen size is a red pill that flows: the edge facing the new size leads on a tight spring and the far edge follows.
  • Sold out sizes are dimmed and struck through. Tapping one shakes the row with an error haptic and the note says it is sold out; the selection stays where it was.
  • The note under the row comes from your note closure for the chosen size, such as "Only 2 left", and falls back to "In stock". It blurs to each new line.
  • Cells are 44pt and scale with Dynamic Type. A row wider than its space scrolls sideways.
  • One selection haptic fires per pick. VoiceOver reads each size with its note, or "Sold out". .disabled(true) dims the row.
  • Under Reduce Motion the pill slides whole on one short spring.

Usage

SizePickerExample()

Install

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

Terminal

$npx swiftpieces add SizePicker

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

>Add the SwiftPieces "Size Picker" 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 inputs and forms →

Build it yourself: SwiftUI haptics 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.

Explore Pro