<!--
{
  "availability" : [
    "macOS: -"
  ],
  "documentType" : "symbol",
  "framework" : "AppKit",
  "identifier" : "/documentation/AppKit/NSSlider",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "AppKit"
    ],
    "preciseIdentifier" : "c:objc(cs)NSSlider"
  },
  "title" : "NSSlider"
}
-->

# NSSlider

A display of a bar representing a continuous range of numerical values and a knob representing the currently selected value.

```
class NSSlider
```

## Overview

A slider is a UI element that displays a range of values in the app. Sliders can be vertical or horizontal bars or circular dials. An indicator, or knob, notes the current setting. The user can move the knob in the slider’s bar—or rotate the knob in a circular slider—to change the setting.

The `NSSlider` class uses the [`NSSliderCell`](/documentation/AppKit/NSSliderCell) class to implement its user interface.

## Topics

### Creating sliders

[`+  sliderWithTarget:action:`](/documentation/AppKit/NSSlider/init(target:action:))

Creates a continuous horizontal slider whose values range from `0.0` to `1.0`.

[`+  sliderWithValue:minValue:maxValue:target:action:`](/documentation/AppKit/NSSlider/init(value:minValue:maxValue:target:action:))

Creates a continuous horizontal slider that represents values over the specified range.

### Managing the slider’s appearance

[`sliderType`](/documentation/AppKit/NSSlider/sliderType-swift.property)

The type of the slider, such as vertical or circular.

[`SliderType`](/documentation/AppKit/NSSlider/SliderType-swift.enum)

The types of sliders, used by [`sliderType`](/documentation/AppKit/NSSliderCell/sliderType).

[`altIncrementValue`](/documentation/AppKit/NSSlider/altIncrementValue)

The amount by which the slider changes its value when the user Option-drags the slider knob.

[`knobThickness`](/documentation/AppKit/NSSlider/knobThickness)

The knob’s thickness, in pixels.

[`-  setKnobThickness:`](/documentation/AppKit/NSSlider/setKnobThickness:)

[`vertical`](/documentation/AppKit/NSSlider/isVertical)

An integer indicating the orientation (horizontal or vertical) of the slider.

[`trackFillColor`](/documentation/AppKit/NSSlider/trackFillColor)

The color of the filled portion of the slider track, in appearances that support it.

[`tintProminence`](/documentation/AppKit/NSSlider/tintProminence)

The tint prominence of the slider. The automatic behavior for a regular slider tints its track fill, while a slider with tick marks is untinted. Setting the tint prominence will override this default behavior and choose an explicit track fill tint behavior. See [`NSTintProminence`](/documentation/AppKit/NSTintProminence) for a list of possible values.

[`NSTintProminence`](/documentation/AppKit/NSTintProminence)

Controls how strongly the tint color applies in a view.

### Asking about the value limits

[`maxValue`](/documentation/AppKit/NSSlider/maxValue)

The maximum value the slider can send to its target.

[`minValue`](/documentation/AppKit/NSSlider/minValue)

The minimum value the slider can send to its target.

### Handling mouse-down events

[`-  acceptsFirstMouse:`](/documentation/AppKit/NSSlider/acceptsFirstMouse(for:))

Returns a Boolean value indicating whether a mouse-down event both activates the window and starts dragging the slider’s knob.

### Managing tick marks

[`allowsTickMarkValuesOnly`](/documentation/AppKit/NSSlider/allowsTickMarkValuesOnly)

A Boolean value that indicates whether the slider fixes its values to those values represented by its tick marks.

[`-  closestTickMarkValueToValue:`](/documentation/AppKit/NSSlider/closestTickMarkValue(toValue:))

Returns the value of the tick mark closest to the specified value.

[`-  indexOfTickMarkAtPoint:`](/documentation/AppKit/NSSlider/indexOfTickMark(at:))

Returns the index of the tick mark closest to the location of the slider represented by the given point.

[`numberOfTickMarks`](/documentation/AppKit/NSSlider/numberOfTickMarks)

The number of tick marks associated with the slider.

[`-  rectOfTickMarkAtIndex:`](/documentation/AppKit/NSSlider/rectOfTickMark(at:))

Returns the bounding rectangle of the tick mark at the given index.

[`tickMarkPosition`](/documentation/AppKit/NSSlider/tickMarkPosition-swift.property)

Determines where the slider’s tick marks are displayed.

[`TickMarkPosition`](/documentation/AppKit/NSSlider/TickMarkPosition-swift.enum)

The position where a linear slider’s tick marks appear (above, below, leading, or trailing).

[`-  tickMarkValueAtIndex:`](/documentation/AppKit/NSSlider/tickMarkValue(at:))

Returns the slider’s value represented by the tick mark at the specified index.

### Managing the slider’s image

[`-  setImage:`](/documentation/AppKit/NSSlider/setImage:)

Sets the image the slider displays in the bar behind its knob.

[`-  image`](/documentation/AppKit/NSSlider/image)

Returns `nil`.

### Managing the slider’s title

[`-  title`](/documentation/AppKit/NSSlider/title)

Returns the slider’s title.

[`-  titleCell`](/documentation/AppKit/NSSlider/titleCell)

This method has been deprecated. Returns `nil`.

[`-  titleColor`](/documentation/AppKit/NSSlider/titleColor)

This method has been deprecated. Returns `nil`.

[`-  titleFont`](/documentation/AppKit/NSSlider/titleFont)

This method has been deprecated. Returns `nil`.

[`-  setTitle:`](/documentation/AppKit/NSSlider/setTitle:)

Sets the title the slider displays in the bar behind its knob.

[`-  setTitleCell:`](/documentation/AppKit/NSSlider/setTitleCell:)

Sets the cell used to draw the slider’s title.

[`-  setTitleColor:`](/documentation/AppKit/NSSlider/setTitleColor:)

Sets the color used to draw the slider’s title.

[`-  setTitleFont:`](/documentation/AppKit/NSSlider/setTitleFont:)

Sets the font used to draw the slider’s title.

## Relationships

### Conforms To

[`NSAccessibilityElementProtocol`](/documentation/AppKit/NSAccessibilityElementProtocol)

[`NSUserActivityRestoring`](/documentation/AppKit/NSUserActivityRestoring)

[`NSStandardKeyBindingResponding`](/documentation/AppKit/NSStandardKeyBindingResponding)

[`CVarArg`](/documentation/Swift/CVarArg)

[`NSTouchBarProvider`](/documentation/AppKit/NSTouchBarProvider)

[`NSDraggingDestination`](/documentation/AppKit/NSDraggingDestination)

[`NSCoding`](/documentation/Foundation/NSCoding)

[`NSAnimatablePropertyContainer`](/documentation/AppKit/NSAnimatablePropertyContainer)

[`NSAppearanceCustomization`](/documentation/AppKit/NSAppearanceCustomization)

[`CustomDebugStringConvertible`](/documentation/Swift/CustomDebugStringConvertible)

[`NSAccessibilityProtocol`](/documentation/AppKit/NSAccessibilityProtocol)

[`Hashable`](/documentation/Swift/Hashable)

[`CustomStringConvertible`](/documentation/Swift/CustomStringConvertible)

[`NSObjectProtocol`](/documentation/ObjectiveC/NSObjectProtocol)

[`SendableMetatype`](/documentation/Swift/SendableMetatype)

[`NSUserInterfaceItemIdentification`](/documentation/AppKit/NSUserInterfaceItemIdentification)

[`NSAccessibilitySlider`](/documentation/AppKit/NSAccessibilitySlider)

[`Sendable`](/documentation/Swift/Sendable)

[`Equatable`](/documentation/Swift/Equatable)

### Inherits From

[`NSControl`](/documentation/AppKit/NSControl)

---

Copyright &copy; 2026 Apple Inc. All rights reserved. | [Terms of Use](https://www.apple.com/legal/internet-services/terms/site.html) | [Privacy Policy](https://www.apple.com/privacy/privacy-policy)