# ListItemGroup The **\** component is used to display list item groups. It must be used with the **[\](ts-container-list.md)** and, if not otherwise specified, takes up the entire width of the **\** component. > **NOTE** > > This component is supported since API version 9. Updates will be marked with a superscript to indicate their earliest API version. ## Usage Guidelines If the **listDirection** attribute of the parent **\** component is set to **Axis.Vertical**, the **height** attribute of the **\** component cannot be set. The height of a **\** component is the sum of its header height, footer height, and total height of the list items. If the **listDirection** attribute of the parent **\** component is set to **Axis.Horizontal**, the **width** attribute of the **\** component cannot be set. The width of a **\** component is the sum of its header width, footer width, and total width of the list items. Currently, the list items in the **\** component cannot be edited, selected, or dragged. That is, the **editable** and **selectable** attributes of these list items do not take effect. ## Child Components This component supports the **[\](ts-container-listitem.md)** child component. ## APIs ListItemGroup(options?: {header?: CustomBuilder, footer?: CustomBuilder, space?: number | string}) **Parameters** | Name| Type| Mandatory| Description| | -------- | -------- | -------- | -------- | | header | [CustomBuilder](ts-types.md#custombuilder8) | No| Header of the **\** component.| | footer | [CustomBuilder](ts-types.md#custombuilder8) | No| Footer of the **\** component.| | space | number \| string | No| Spacing between list items. This parameter is valid only between list items, but not between a header and list item or between a footer and list item.| ## Attributes | Name| Type| Description| | -------- | -------- | -------- | | divider | {
strokeWidth: [Length](ts-types.md#length),
color?: [ResourceColor](ts-types.md#resourcecolor),
startMargin?: [Length](ts-types.md#length),
endMargin?: [Length](ts-types.md#length)
} \| null | Style of the divider for the list items. By default, there is no divider.
- **strokeWidth**: stroke width of the divider.
- **color**: color of the divider.
**startMargin**: distance between the divider and the start of the list.
**endMargin**: distance between the divider and the end of the list.| ## Example ```ts // xxx.ets function itemHeadBuilder(text: string) { @Builder function itemHead() { Text(text) .fontSize(20) .backgroundColor(0xAABBCC) .width("100%") .padding(10) } return itemHead } function itemFootBuilder(num: number) { @Builder function itemFoot() { Text('' + num + " lessons in total ") .fontSize(16) .backgroundColor(0xAABBCC) .width("100%") .padding(5) } return itemFoot } @Entry @Component struct ListItemGroupExample { private timetable: any = [ { title: 'Monday', projects: ['Language', 'Math', 'English'] }, { title: 'Tuesday', projects: ['Physics', 'Chemistry', 'Biologics'] }, { title: 'Wednesday', projects: ['History', 'Geography', 'Politics'] }, { title: 'Thursday', projects: ['Art', 'Music', 'Sports'] } ] build() { Column() { List({ space: 20 }) { ForEach(this.timetable, (item) => { ListItemGroup({ header:itemHeadBuilder(item.title), footer:itemFootBuilder(item.projects.length) }) { ForEach(item.projects, (project) => { ListItem() { Text(project) .width("100%").height(100).fontSize(20) .textAlign(TextAlign.Center).backgroundColor(0xFFFFFF) } }, item => item) } .borderRadius(20) .divider({ strokeWidth: 1, color: 0xDCDCDC }) // Divider between lines }) } .width('90%') .sticky(StickyStyle.Header|StickyStyle.Footer) }.width('100%').height('100%').backgroundColor(0xDCDCDC).padding({ top: 5 }) } } ```