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

Function TagGroupInner

starters/hooks/src/TagGroup.tsx:73–103  ·  view source on GitHub ↗
({
  collection,
  ...props
}: AriaTagGroupProps<object> &
  Omit<ListProps<object>, 'children'> & {
    label?: ReactNode;
    collection: ICollection<Node<object>>;
  })

Source from the content-addressed store, hash-verified

71}
72
73function TagGroupInner({
74 collection,
75 ...props
76}: AriaTagGroupProps<object> &
77 Omit<ListProps<object>, 'children'> & {
78 label?: ReactNode;
79 collection: ICollection<Node<object>>;
80 }) {
81 let ref = useRef<HTMLDivElement>(null);
82 let state = useListState({...props, collection, children: undefined});
83 /*- begin highlight -*/
84 let {gridProps, labelProps} = useTagGroup(props, state, ref);
85 /*- end highlight -*/
86
87 return (
88 <div className="react-aria-TagGroup">
89 {props.label && (
90 <span {...labelProps} className="react-aria-Label">
91 {props.label}
92 </span>
93 )}
94 <div {...gridProps} ref={ref} className="react-aria-TagList">
95 <ListStateContext.Provider value={state}>
96 {[...state.collection].map(item => (
97 <Fragment key={item.key}>{item.render!(item)}</Fragment>
98 ))}
99 </ListStateContext.Provider>
100 </div>
101 </div>
102 );
103}

Callers

nothing calls this directly

Calls 2

useListStateFunction · 0.90
useTagGroupFunction · 0.90

Tested by

no test coverage detected