Founding sponsorYour name here
Volume
Key Repeat

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.

If you called it…

the dot you drag left and right to change a valuevolume style control with a round knob on a linethe bar with a circle you slidethe little lines under the slider it snaps tothe blue filled part of the slider linedrag thing for picking a number between min and max

…you meant a slider.

Anatomy — every part, named

  1. 1
    Knob (thumb)NSSlider.knobThickness

    “The round dot you drag” is the knob — AppKit calls it the knob; the web calls the same thing a thumb.

  2. 2
    Filled trackSlider + .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.

  3. 3
    TrackNSSlider.SliderType.linear

    “The groove the dot slides along” is the track — the full range, end to end.

  4. 4
    Tick marksNSSlider.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.

Debug prompt — when it misbehaves

Paste this, then describe what you’re seeing — it hands your agent the classic failure modes to rule out first.

Debug my macOS slider (NSSlider, SwiftUI Slider). Rule out: actions flooding on every pixel because isContinuous is on (or missing when live updates were wanted); allowsTickMarkValuesOnly snapping values you did not expect; a value binding writing back during drag and fighting the gesture; vertical orientation inferred from frame shape in AppKit, not set explicitly. The symptom:

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).

AppKitNSSlider
SwiftUISlider(value:in:step:)
AppKitNSSlider.numberOfTickMarks
AppKitNSSlider.allowsTickMarkValuesOnlysnap to ticks
AppKitNSSlider.tickMarkPosition.below / .above
AppKitNSSlider.isContinuousact while dragging, not just on release

See also

Search

Describe the UI element you're thinking of