
Range Slider
From syxUI — written for both platforms, not translated between them.
A dual-thumb price-range slider.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
RangeSliderField.swift
// Range Slider · syxUI · https://syxui.dev/components/inp-range
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
let inpBlue = Color(red: 0.0, green: 0.47, blue: 1.0)
// Dual-thumb range slider
struct RangeSliderField: View {
var body: some View {
VStack(alignment: .leading, spacing: 14) {
HStack { Text("Price range").font(.system(size: 15, weight: .semibold)); Spacer(); Text("$25 – $75").font(.system(size: 14)).foregroundStyle(.secondary) }
GeometryReader { g in
ZStack(alignment: .leading) {
Capsule().fill(Color.primary.opacity(0.1)).frame(height: 4)
Capsule().fill(inpBlue).frame(width: g.size.width * 0.5, height: 4).offset(x: g.size.width * 0.25)
Circle().fill(.white).frame(width: 22, height: 22).shadow(radius: 2).overlay(Circle().stroke(inpBlue, lineWidth: 2)).offset(x: g.size.width * 0.25 - 11)
Circle().fill(.white).frame(width: 22, height: 22).shadow(radius: 2).overlay(Circle().stroke(inpBlue, lineWidth: 2)).offset(x: g.size.width * 0.75 - 11)
}
}.frame(height: 22)
}.padding(16).overlay(RoundedRectangle(cornerRadius: 14, style: .continuous).stroke(Color.primary.opacity(0.1))).frame(width: 300)
}
}
iOS 17 · No dependencies
Dependencies
- SwiftUI
- No external dependencies
Requires iOS 17


