<!--
{
  "availability" : [
    "iOS: 12.0.0 -",
    "iPadOS: 12.0.0 -",
    "macCatalyst: 13.1.0 -"
  ],
  "documentType" : "symbol",
  "framework" : "CarPlay",
  "identifier" : "/documentation/CarPlay/CPListSection",
  "metadataVersion" : "0.1.0",
  "role" : "Class",
  "symbol" : {
    "kind" : "Class",
    "modules" : [
      "CarPlay"
    ],
    "preciseIdentifier" : "c:objc(cs)CPListSection"
  },
  "title" : "CPListSection"
}
-->

# CPListSection

A container that groups your list items into sections.

```
class CPListSection
```

## Overview

A section contains zero or more list items. You can configure a section to display a header and a section index title, which CarPlay displays on the trailing edge of the screen. The section header and the section index title are optional.

To create a section, call the [`initWithItems:`](/documentation/CarPlay/CPListSection/initWithItems:) method and provide an array of list items. Alternatively, use [`initWithItems:header:sectionIndexTitle:`](/documentation/CarPlay/CPListSection/initWithItems:header:sectionIndexTitle:) if you want to display a header and a section index title. CarPlay doesn’t support custom list items, so you must use one of the types that the framework provides, such as [`CPListItem`](/documentation/CarPlay/CPListItem) or [`CPListImageRowItem`](/documentation/CarPlay/CPListImageRowItem).

At runtime, use [`maximumSectionCount`](/documentation/CarPlay/CPListTemplate/maximumSectionCount) to determine the maximum number of sections that your list can display. When creating items for your sections, use [`maximumItemCount`](/documentation/CarPlay/CPListTemplate/maximumItemCount) to establish the maximum number of items across all sections that can appear in your list.

## Topics

### Creating a Section

[`-  initWithItems:`](/documentation/CarPlay/CPListSection/initWithItems:)

Creates a section with list items.

[`-  initWithItems:header:sectionIndexTitle:`](/documentation/CarPlay/CPListSection/initWithItems:header:sectionIndexTitle:)

Creates a section with list items, a header, and a section index title.

[`-  initWithItems:header:headerSubtitle:headerImage:headerButton:sectionIndexTitle:`](/documentation/CarPlay/CPListSection/init(items:header:headerSubtitle:headerImage:headerButton:sectionIndexTitle:))

Creates a section with list items, a header, a section index title, and section header details.

[`CPListTemplateItem`](/documentation/CarPlay/CPListTemplateItem)

A description of the common properties of all list item types.

[`CPSelectableListItem`](/documentation/CarPlay/CPSelectableListItem)

A description of a selectable list item.

[`CPListItem`](/documentation/CarPlay/CPListItem)

A selectable row in a list template.

[`CPListImageRowItem`](/documentation/CarPlay/CPListImageRowItem)

A list template row that displays a series of images.

[`CPMessageListItem`](/documentation/CarPlay/CPMessageListItem)

A list template row that represents a conversation or contact.

### Getting Supplementary Information

[`header`](/documentation/CarPlay/CPListSection/header)

The section’s header text.

[`sectionIndexTitle`](/documentation/CarPlay/CPListSection/sectionIndexTitle)

The section’s index title.

### Getting Items

[`items`](/documentation/CarPlay/CPListSection/items)

The list of items for the section.

[`-  indexOfItem:`](/documentation/CarPlay/CPListSection/index(of:))

Returns the index of the specified item.

[`-  itemAtIndex:`](/documentation/CarPlay/CPListSection/item(at:))

Returns the item at the specified index.

### Configuring Section Headers

[`headerButton`](/documentation/CarPlay/CPListSection/headerButton)

A button that the section header displays.

[`headerImage`](/documentation/CarPlay/CPListSection/headerImage)

An image that the section header displays.

[`headerSubtitle`](/documentation/CarPlay/CPListSection/headerSubtitle)

A string that the header displays as a subtitle.

### Initializers

[`init(items:)`](/documentation/CarPlay/CPListSection/init(items:)-32d0q)

[`init(items:header:sectionIndexTitle:)`](/documentation/CarPlay/CPListSection/init(items:header:sectionIndexTitle:)-743we)

## Relationships

### Conforms To

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

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

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

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

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

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

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

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

### Inherits From

[`NSObject-swift.class`](/documentation/ObjectiveC/NSObject-swift.class)

---

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)