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

Function TabsInner

packages/react-aria-components/src/Tabs.tsx:282–324  ·  view source on GitHub ↗
({props, tabsRef: ref, collection}: TabsInnerProps)

Source from the content-addressed store, hash-verified

280}
281
282function TabsInner({props, tabsRef: ref, collection}: TabsInnerProps) {
283 let {orientation = 'horizontal'} = props;
284 let state = useTabListState({
285 ...props,
286 collection,
287 children: undefined
288 });
289 let {focusProps, isFocused, isFocusVisible} = useFocusRing({within: true});
290 let values = useMemo(
291 () => ({
292 orientation,
293 isFocusWithin: isFocused,
294 isFocusVisible
295 }),
296 [orientation, isFocused, isFocusVisible]
297 );
298 let renderProps = useRenderProps({
299 ...props,
300 defaultClassName: 'react-aria-Tabs',
301 values
302 });
303
304 let DOMProps = filterDOMProps(props, {global: true});
305
306 return (
307 <dom.div
308 {...mergeProps(DOMProps, renderProps, focusProps)}
309 ref={ref}
310 slot={props.slot || undefined}
311 data-focused={isFocused || undefined}
312 data-orientation={orientation}
313 data-focus-visible={isFocusVisible || undefined}
314 data-disabled={state.isDisabled || undefined}>
315 <Provider
316 values={[
317 [TabsContext, props],
318 [TabListStateContext, state]
319 ]}>
320 {renderProps.children}
321 </Provider>
322 </dom.div>
323 );
324}
325
326/**
327 * A TabList is used within Tabs to group tabs that a user can switch between. The ids of the items

Callers

nothing calls this directly

Calls 5

useTabListStateFunction · 0.90
useFocusRingFunction · 0.90
useRenderPropsFunction · 0.90
filterDOMPropsFunction · 0.90
mergePropsFunction · 0.90

Tested by

no test coverage detected