
Slider
From syxUI — written for both platforms, not translated between them.
A slider input — self-contained SwiftUI, styled from system tokens.
Inputs · SwiftUI · iOS 17
- inputs
- swiftui
The actual source
SliderField.swift
// Slider · syxUI · https://syxui.dev/components/input-slider
// Free in any project. Keep this line and credit syxUI where a person can read it.
import SwiftUI
extension View {
func formaCard(_ pad: CGFloat = 18) -> some View {
self.padding(pad)
.background(Color(.systemBackground), in: RoundedRectangle(cornerRadius: 20, style: .continuous))
.overlay(RoundedRectangle(cornerRadius: 20, style: .continuous).stroke(Color.primary.opacity(0.06), lineWidth: 1))
.shadow(color: .black.opacity(0.05), radius: 14, x: 0, y: 6)
}
}
// 18. Slider
struct SliderField: View {
@State private var value = 0.64
var body: some View {
VStack(alignment: .leading, spacing: 14) {
HStack { Text("Budget").font(.system(size: 15, weight: .medium)); Spacer(); Text("$640").font(.system(size: 15, weight: .semibold).monospacedDigit()) }
GeometryReader { g in
ZStack(alignment: .leading) {
Capsule().fill(Color.primary.opacity(0.10)).frame(height: 6)
Capsule().fill(Color.primary).frame(width: g.size.width * value, height: 6)
Circle().fill(Color(.systemBackground)).frame(width: 26, height: 26)
.overlay(Circle().stroke(Color.primary.opacity(0.12)))
.shadow(color: .black.opacity(0.15), radius: 4, y: 2)
.offset(x: g.size.width * value - 13)
}
}.frame(height: 26)
}
.formaCard()
}
}
iOS 17 · 1 dependencies
Dependencies
- SwiftUI
- formaCard
Requires iOS 17


