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

Function DisclosureRow

packages/dev/s2-docs/src/DisclosureRow.tsx:68–90  ·  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 delete buttonProps['aria-controls']; // there is no panel element in this implementation
73
74 return (
75 <TableBody>
76 <TableRow>
77 <td colSpan={3} className={tableCell}>
78 <Button
79 {...buttonProps}
80 className={p => buttonStyles({...p, isExpanded: state.isExpanded})}>
81 {/* @ts-ignore */}
82 <Chevron styles={chevronStyles({isExpanded: state.isExpanded})} />
83 {title}
84 </Button>
85 </td>
86 </TableRow>
87 {state.isExpanded && children}
88 </TableBody>
89 );
90}

Callers

nothing calls this directly

Calls 2

useDisclosureStateFunction · 0.90
useDisclosureFunction · 0.90

Tested by

no test coverage detected