1111 */
1212
1313import { AriaListBoxProps } from '@react-types/listbox' ;
14- import { DOMAttributes , KeyboardDelegate , LayoutDelegate , RefObject } from '@react-types/shared' ;
14+ import { DOMAttributes , KeyboardDelegate , LayoutDelegate , Orientation , RefObject } from '@react-types/shared' ;
1515import { filterDOMProps , mergeProps , useId } from '@react-aria/utils' ;
1616import { listData } from './utils' ;
1717import { ListState } from '@react-stately/list' ;
@@ -55,7 +55,13 @@ export interface AriaListBoxOptions<T> extends Omit<AriaListBoxProps<T>, 'childr
5555 * - 'override': links override all other interactions (link items are not selectable).
5656 * @default 'override'
5757 */
58- linkBehavior ?: 'action' | 'selection' | 'override'
58+ linkBehavior ?: 'action' | 'selection' | 'override' ,
59+
60+ /**
61+ * The primary orientation of the items. Usually this is the direction that the collection scrolls.
62+ * @default 'vertical'
63+ */
64+ orientation ?: Orientation
5965}
6066
6167/**
@@ -68,6 +74,7 @@ export function useListBox<T>(props: AriaListBoxOptions<T>, state: ListState<T>,
6874 let domProps = filterDOMProps ( props , { labelable : true } ) ;
6975 // Use props instead of state here. We don't want this to change due to long press.
7076 let selectionBehavior = props . selectionBehavior || 'toggle' ;
77+ let orientation = props . orientation || 'vertical' ;
7178 let linkBehavior = props . linkBehavior || ( selectionBehavior === 'replace' ? 'action' : 'override' ) ;
7279 if ( selectionBehavior === 'toggle' && linkBehavior === 'action' ) {
7380 // linkBehavior="action" does not work with selectionBehavior="toggle" because there is no way
@@ -119,6 +126,7 @@ export function useListBox<T>(props: AriaListBoxOptions<T>, state: ListState<T>,
119126 'aria-multiselectable' : 'true'
120127 } : { } , {
121128 role : 'listbox' ,
129+ 'aria-orientation' : orientation ,
122130 ...mergeProps ( fieldProps , listProps )
123131 } )
124132 } ;
0 commit comments