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

Function DisclosureRow

packages/dev/s2-docs/src/DisclosureRow.tsx:68–91  ·  view source on GitHub ↗
({title, children, defaultExpanded})

Source from the content-addressed store, hash-verified

66});
67
68export function DisclosureRow({title, children, defaultExpanded}) {
69 let state = useDisclosureState({defaultExpanded});
70 let ref = useRef(null);
71 let {buttonProps} = useDisclosure({}, state, ref);
72 // oxlint-disable-next-line react/react-compiler
73 delete buttonProps['aria-controls']; // there is no panel element in this implementation
74
75 return (
76 <TableBody>
77 <TableRow>
78 <td colSpan={3} className={tableCell}>
79 <Button
80 {...buttonProps}
81 className={p => buttonStyles({...p, isExpanded: state.isExpanded})}>
82 {/* @ts-ignore */}
83 <Chevron styles={chevronStyles({isExpanded: state.isExpanded})} />
84 {title}
85 </Button>
86 </td>
87 </TableRow>
88 {state.isExpanded && children}
89 </TableBody>
90 );
91}

Callers

nothing calls this directly

Calls 2

useDisclosureStateFunction · 0.90
useDisclosureFunction · 0.90

Tested by

no test coverage detected