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

Function Link

packages/dev/s2-docs/src/Link.tsx:28–35  ·  view source on GitHub ↗
({href, ...props}: LinkProps)

Source from the content-addressed store, hash-verified

26}
27
28export function Link({href, ...props}: LinkProps) {
29 if (href?.startsWith('s2:') || href?.startsWith('react-aria:')) {
30 let url = new URL(href);
31 href = getBaseUrl(url.protocol.slice(0, -1) as any) + '/' + url.pathname;
32 }
33
34 return <S2Link {...props} ref={registerSpectrumLink} href={href} {...getAnchorProps(href)} />;
35}
36
37export function LinkButton({href, ...props}: LinkButtonProps) {
38 if (href?.startsWith('s2:') || href?.startsWith('react-aria:')) {

Callers

nothing calls this directly

Calls 3

getBaseUrlFunction · 0.90
sliceMethod · 0.80
getAnchorPropsFunction · 0.70

Tested by

no test coverage detected