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

Function Tabs

packages/react-aria/stories/tabs/example.tsx:24–53  ·  view source on GitHub ↗
({shouldSelectOnPressUp, ...props}: TabProps)

Source from the content-addressed store, hash-verified

22}
23
24export function Tabs({shouldSelectOnPressUp, ...props}: TabProps): JSX.Element {
25 let state = useTabListState(props);
26 let ref = React.useRef(null);
27 let {tabListProps} = useTabList(props, state, ref);
28 return (
29 <div style={{height: '150px'}}>
30 <div
31 {...tabListProps}
32 ref={ref}
33 style={{
34 display: 'flex',
35 borderBottom: '1px solid grey',
36 borderLeft: '10px solid grey',
37 borderRight: '20px solid grey',
38 maxWidth: '400px',
39 overflow: 'auto'
40 }}>
41 {[...state.collection].map(item => (
42 <Tab
43 key={item.key}
44 item={item}
45 state={state}
46 shouldSelectOnPressUp={shouldSelectOnPressUp}
47 />
48 ))}
49 </div>
50 <TabPanel key={state.selectedItem?.key} state={state} />
51 </div>
52 );
53}
54
55function Tab({shouldSelectOnPressUp, item, state}) {
56 let {key, rendered} = item;

Callers

nothing calls this directly

Calls 2

useTabListStateFunction · 0.90
useTabListFunction · 0.90

Tested by

no test coverage detected