Components / Navigation

Fluid tabs

A shared selection pill that travels between variable-width labels with an interruptible spring.

iOS 17+Swift 6MITView source
Fluid tabs, rendered by SwiftUI on an iPhone simulator
Recorded in the iOS simulator

Real SwiftUI, captured on an iPhone 17 Pro simulator. Run the native gallery

Installation

Install the native Swift CLI, then add the component to your app.

Terminal
hugsy add fluid-tabs

Prefer to copy it yourself? Open the complete Swift file and add it to your iOS app target in Xcode. No package dependency is required.

Usage

SwiftUI
@State private var tab = "For you"

HugsyFluidTabs(
  tabs: ["For you", "Following", "Saved"],
  selection: $tab
)

Bind the selected label to your own content state. Duplicate labels are removed while preserving order. If the current selection no longer exists, the component selects the first available label. Keep labels concise and localize them in your app.

API reference

Fluid tabs parameters
ParameterType & behaviorDefault
tabs[String]

Display labels. Duplicates are removed while preserving order.

Required
selectionBinding<String>

Selected label. Invalid selections reset to the first available tab when labels change.

Required

Interaction

Switch between labels. The selection pill follows your finger and settles into the next tab.

SelectedTransitioningOverflowEmpty

Accessibility

Native buttons announce their selected state and maintain a minimum height of 44 points. Labels can scroll horizontally. Reduce Motion disables selection interpolation.

Test with VoiceOver, Dynamic Type, and Reduce Motion on a physical device before shipping. The gallery demonstrates the interaction, not every application-specific content state.