Interactive previews iPhone

Slider Color

Customizing the color of the slider

Slider Color - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview

Platform Compatibility

iOS 15.0+ iPadOS 15.0+ macOS 12.0+ watchOS 8.0+ visionOS 1.0+

Tags

SwiftUI Code

Docs
@State private var speed = 42.0
@State private var isEditing = false

var body: some View {
    VStack {
        Slider(
            value: $speed,
            in: 0 ... 100,
            step: 2 // optional, by default 1,
        )
        Slider(
            value: $speed,
            in: 0 ... 100,
            step: 2 // optional, by default 1,

        ) {
            Text("Foo") // for accessibility
        } minimumValueLabel: {
            Text("0")
        } maximumValueLabel: {
            Text("100")
        } onEditingChanged: { editing in
            isEditing = editing
        }
    }
    .tint(.red)
}

Found an issue or have a suggestion?

Created: June 4, 2025Updated: December 27, 2025

More Slider Components

View all
SliderTickContentForEach - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

SliderTickContentForEach

A type of slider content that creates content by iterating over a collection.

Custom Slider Ticks - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Custom Slider Ticks

Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels and customizable ticks.

Stepped Min Max Label Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Min Max Label Slider

Creates a slider to select a value from a given range, subject to a step increment, which displays the provided labels

Stepped Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Stepped Slider

Creates a slider to select a value from a given range, subject to a step increment

Slider - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Slider

Creates a slider to select a value from a given range

Explore Other Components

Browse all
Toolbar Title Alignment - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Toolbar Title Alignment

Sets the preferred alignment of the navigation bar’s title. The navigation bar resolves the alignment of its title automatically based on context, and toolbar roles. Use this modifier to override that resolution.

Search Tab Role - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
initializer

Search Tab Role

On Liquid Glass, this tab is placed in its own group. In left-to-right (LTR) layouts, it will always appear on the right side of the TabView.

Standard Colors - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
type

Standard Colors

The SwiftUI standard colors

Color Gradient - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Color Gradient

The Color gradient modifier

Section Index Label and Visibility - iOS on iPhone - Portrait - Liquid Glass - Light Mode - Preview
modifier

Section Index Label and Visibility

Sets the label that is used in a section index to point to this section, typically only a single character long. Changes the visibility of the list section index.

ArrangementView - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
initializer

ArrangementView

Creates an arrangement view with a primary and secondary view.

Content NavigationSplitView - iOS on iPhone Duo - Landscape - Fully Open - Liquid Glass - Light Mode - Preview
initializer

Content NavigationSplitView

Creates a three-column navigation split view.

Delete Disabled - iOS on iPhone - Portrait - Flat Design - Light Mode - Preview
modifier

Delete Disabled

Adds a condition for whether the view’s view hierarchy is deletable.