Tab Button

Capsule-shaped tab button toggling between selected and unselected states for segmented controls

Free
Free with a ShipSwift account.

Copies a short instruction with your private download link. Paste it into your agent: it downloads the whole skill (the source code, the setup steps and the mistakes we already made for you) and builds the screen.

Works with

+70

What it does

Capsule-shaped tab button that toggles between selected (accent color) and unselected (gray) states. Suitable for building custom segmented controls or horizontal filter bars.

What you get

  • ✓34 lines of source code, ready to paste
  • ✓Source Code
  • ✓Usage
componentinputtabbuttonsegmentedfilterSwiftUI

Usage

@State private var selectedTab = 0

HStack {
    SWTabButton(title: "All", isSelected: selectedTab == 0) {
        selectedTab = 0
    }
    SWTabButton(title: "Favorites", isSelected: selectedTab == 1) {
        selectedTab = 1
    }
    SWTabButton(title: "Recent", isSelected: selectedTab == 2) {
        selectedTab = 2
    }
}