MCPcopy Create free account
hub / github.com/adobe/react-spectrum / ListBoxSectionInner

Function ListBoxSectionInner

packages/react-aria-components/src/ListBox.tsx:453–489  ·  view source on GitHub ↗
(
  props: ListBoxSectionProps<T>,
  ref: ForwardedRef<HTMLElement>,
  section: Node<T>,
  className = 'react-aria-ListBoxSection'
)

Source from the content-addressed store, hash-verified

451}
452
453function ListBoxSectionInner<T>(
454 props: ListBoxSectionProps<T>,
455 ref: ForwardedRef<HTMLElement>,
456 section: Node<T>,
457 className = 'react-aria-ListBoxSection'
458) {
459 let state = useContext(ListStateContext)!;
460 let {dragAndDropHooks, dropState} = useContext(DragAndDropContext)!;
461 let {CollectionBranch} = useContext(CollectionRendererContext);
462 let [headingRef, heading] = useSlot();
463 let {headingProps, groupProps} = useListBoxSection({
464 heading,
465 'aria-label': props['aria-label'] ?? undefined
466 });
467 let renderProps = useRenderProps({
468 ...props,
469 id: undefined,
470 children: undefined,
471 defaultClassName: className,
472 values: undefined
473 });
474
475 let DOMProps = filterDOMProps(props as any, {global: true});
476 delete DOMProps.id;
477
478 return (
479 <dom.section {...mergeProps(DOMProps, renderProps, groupProps)} ref={ref}>
480 <HeaderContext.Provider value={{...headingProps, ref: headingRef}}>
481 <CollectionBranch
482 collection={state.collection}
483 parent={section}
484 renderDropIndicator={useRenderDropIndicator(dragAndDropHooks, dropState)}
485 />
486 </HeaderContext.Provider>
487 </dom.section>
488 );
489}
490
491/**
492 * A ListBoxSection represents a section within a ListBox.

Callers

nothing calls this directly

Calls 6

useSlotFunction · 0.90
useListBoxSectionFunction · 0.90
useRenderPropsFunction · 0.90
filterDOMPropsFunction · 0.90
mergePropsFunction · 0.90
useRenderDropIndicatorFunction · 0.90

Tested by

no test coverage detected