MCPcopy Create free account
hub / github.com/primer/react / getChildText

Function getChildText

packages/react/src/SegmentedControl/SegmentedControl.tsx:92–98  ·  view source on GitHub ↗
(childArg: React.ReactNode)

Source from the content-addressed store, hash-verified

90 return React.isValidElement<SegmentedControlIconButtonProps>(childArg) ? childArg.props.icon : null
91 }
92 const getChildText = (childArg: React.ReactNode) => {
93 if (React.isValidElement<SegmentedControlButtonProps>(childArg) && childArg.type === Button) {
94 return childArg.props.children
95 }
96
97 return React.isValidElement<SegmentedControlIconButtonProps>(childArg) ? childArg.props['aria-label'] : null
98 }
99 const listSx = merge(getSegmentedControlStyles({isFullWidth, size}), sxProp as SxProp)
100
101 if (!ariaLabel && !ariaLabelledby) {

Callers 1

RootFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected