@@ -7,6 +7,7 @@ import vanillaDocs from 'docs:vanilla-starter/GridList';
77import ' ../../tailwind/tailwind.css' ;
88import Anatomy from ' react-aria-components/docs/GridListAnatomy.svg' ;
99import {InlineAlert , Heading , Content } from ' @react-spectrum/s2'
10+ import {VersionBadge } from ' ../../src/VersionBadge' ;
1011
1112export const tags = [' list view' ];
1213export const relatedPages = [
@@ -532,6 +533,57 @@ import {GridList} from 'vanilla-starter/GridList';
532533</GridList >
533534```
534535
536+ ### Sections <VersionBadge version = " alpha" />
537+
538+ Use the ` <GridListSection> ` component to group options. A ` <GridListHeader> ` element may also be included to label the section. Sections without a header must have an ` aria-label ` .
539+
540+ ``` tsx render
541+ " use client" ;
542+ import {GridList , GridListItem } from ' vanilla-starter/GridList' ;
543+ import {GridListHeader , GridListSection , Text } from ' react-aria-components' ;
544+
545+ <GridList
546+ layout = " grid"
547+ aria-label = " Photos" >
548+ <GridListSection >
549+ <GridListHeader >Fruit</GridListHeader >
550+ <GridListItem textValue = " Apple" >
551+ <img src = " https://images.unsplash.com/photo-1630563451961-ac2ff27616ab?q=80&w=687&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" width = { 600 } height = { 400 } />
552+ <Text >Apple</Text >
553+ <Text slot = " description" >PNG • 9/2/2021</Text >
554+ </GridListItem >
555+ <GridListItem textValue = " Peach" >
556+ <img src = " https://images.unsplash.com/photo-1642372849486-f88b963cb734?q=80&w=2858&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" width = { 600 } height = { 900 } />
557+ <Text >Peach</Text >
558+ <Text slot = " description" >JPEG • 1/16/2022</Text >
559+ </GridListItem >
560+ <GridListItem textValue = " Blueberry" >
561+ <img src = " https://images.unsplash.com/photo-1606757389667-45c2024f9fa4?q=80&w=1740&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" width = { 600 } height = { 900 } />
562+ <Text >Blueberry</Text >
563+ <Text slot = " description" >JPEG • 11/30/2020</Text >
564+ </GridListItem >
565+ </GridListSection >
566+ <GridListSection >
567+ <GridListHeader >Vegetables</GridListHeader >
568+ <GridListItem textValue = " Broccoli" >
569+ <img src = " https://images.unsplash.com/photo-1685504445355-0e7bdf90d415?q=80&w=928&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" width = { 600 } height = { 900 } />
570+ <Text >Broccoli</Text >
571+ <Text slot = " description" >PNG • 5/30/2023</Text >
572+ </GridListItem >
573+ <GridListItem textValue = " Brussels Sprouts" >
574+ <img src = " https://images.unsplash.com/photo-1685504507286-dc290728c01a?q=80&w=1740&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" width = { 600 } height = { 900 } />
575+ <Text >Brussels Sprouts</Text >
576+ <Text slot = " description" >PNG • 7/3/2021</Text >
577+ </GridListItem >
578+ <GridListItem textValue = " Peas" >
579+ <img src = " https://images.unsplash.com/photo-1587411768345-867e228218c8?q=80&w=1160&auto=format&fit=crop&ixlib=rb-4.1.0&ixid=M3wxMjA3fDB8MHxwaG90by1wYWdlfHx8fGVufDB8fHx8fA%3D%3D" width = { 600 } height = { 900 } />
580+ <Text >Peas</Text >
581+ <Text slot = " description" >PNG • 4/20/2020</Text >
582+ </GridListItem >
583+ </GridListSection >
584+ </GridList >
585+ ```
586+
535587## Selection and actions
536588
537589Use the ` selectionMode ` prop to enable single or multiple selection. The selected items can be controlled via the ` selectedKeys ` prop, matching the ` id ` prop of the items. The ` onAction ` event handles item actions. Items can be disabled with the ` isDisabled ` prop. See the [ selection guide] ( selection?component=GridList ) for more details.
@@ -931,6 +983,14 @@ function Example() {
931983
932984<PropTable component = { docs .exports .GridList } links = { docs .links } showDescription />
933985
986+ ### GridListSection
987+
988+ <PropTable component = { docs .exports .GridListSection } links = { docs .links } showDescription />
989+
990+ ### GridListHeader
991+
992+ ` <GridListHeader> ` labels the section within a GridList. It accepts all HTML attributes.
993+
934994### GridListItem
935995
936996<PropTable component = { docs .exports .GridListItem } links = { docs .links } showDescription />
0 commit comments