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

Function SideNavItemLink

packages/@react-spectrum/s2/src/SideNav.tsx:662–696  ·  view source on GitHub ↗
(props: SideNavItemLinkProps)

Source from the content-addressed store, hash-verified

660}
661
662export const SideNavItemLink = (props: SideNavItemLinkProps): ReactNode => {
663 let {children} = props;
664 let linkFocus = useContext(SideNavItemLinkContext);
665 let {isCollapsed = false} = useContext(SideNavPanelContext);
666 let textId = useId();
667
668 return (
669 <Link
670 {...props}
671 {...linkFocus}
672 aria-labelledby={textId}
673 data-do-not-hide
674 className={treeRowLink({isDisabled: linkFocus.isDisabled})}>
675 <Provider
676 values={[
677 [
678 TextContext,
679 {
680 id: textId,
681 styles: treeContent({isCollapsed})
682 }
683 ],
684 [
685 IconContext,
686 {
687 render: centerBaseline({slot: 'icon', styles: treeIcon({isCollapsed})}),
688 styles: style({size: '1lh', flexShrink: 0})
689 }
690 ]
691 ]}>
692 {typeof children === 'string' ? <Text>{children}</Text> : children}
693 </Provider>
694 </Link>
695 );
696};

Callers

nothing calls this directly

Calls 2

useIdFunction · 0.90
centerBaselineFunction · 0.90

Tested by

no test coverage detected