---
title: selectedIndex
framework: appkit
role: symbol
role_heading: Instance Property
path: appkit/nstoolbaritemgroup/selectedindex
---

# selectedIndex

The index value for the most recently selected subitem of a grouped toolbar item.

## Declaration

```swift
var selectedIndex: Int { get set }
```

## Discussion

Discussion When using the NSToolbarItemGroup.SelectionMode.selectAny or NSToolbarItemGroup.SelectionMode.momentary selection mode, don’t assume that this value represents the selected subitem. This method returns the index of the most recently selected subitem. To determine if a specific subitem of a grouped toolbar item is selected, use the isSelected(at:) method.

## See Also

### Working with subitems

- [subitems](appkit/nstoolbaritemgroup/subitems.md)
- [isSelected(at:)](appkit/nstoolbaritemgroup/isselected(at:).md)
- [setSelected(_:at:)](appkit/nstoolbaritemgroup/setselected(_:at:).md)
