Drag the knobs — the lower slider snaps to its tick marks (allowsTickMarkValuesOnly)
Slider
/ NSSlider · Slider(value:in:step:) /
also called slider control, seek bar, track bar, range control
“The dot you drag along a line” is a slider — NSSlider. The circle is the knob, the groove is the track, and the leading portion up to the knob is tinted with the accent color. A continuous slider picks any value in the range; give it tick marks (the little lines below) and allowsTickMarkValuesOnly, and the knob snaps between fixed stops — the Key Repeat slider in System Settings is the classic tick-marked one.
Anatomy — every part, named
- 1Knob (thumb)
NSSlider.knobThickness“The round dot you drag” is the knob — AppKit calls it the knob; the web calls the same thing a thumb.
- 2Filled track
Slider + .tint“The blue part of the line before the knob” is the filled side of the track — it shows how far along the range the value sits.
- 3Track
NSSlider.SliderType.linear“The groove the dot slides along” is the track — the full range, end to end.
- 4Tick marks
NSSlider.numberOfTickMarks“The little lines under the slider” are tick marks — with allowsTickMarkValuesOnly the knob only lands on them.
Prompt — paste into your agent
Use a native macOS slider — NSSlider (SwiftUI: Slider(value:in:step:)): horizontal linear style, round knob, the leading side of the track tinted with the accent color. For discrete values add tick marks below with numberOfTickMarks and tickMarkPosition = .below, and snap the knob to them with allowsTickMarkValuesOnly = true. Set isContinuous = true so the value updates while dragging.
In code
The exact names this thing goes by in code — each row is one framework’s word for it. Use the row that matches your project (or paste it into your prompt).
| AppKit | NSSlider | |
| SwiftUI | Slider(value:in:step:) | |
| AppKit | NSSlider.numberOfTickMarks | |
| AppKit | NSSlider.allowsTickMarkValuesOnly | snap to ticks |
| AppKit | NSSlider.tickMarkPosition | .below / .above |
| AppKit | NSSlider.isContinuous | act while dragging, not just on release |