diff --git a/packages/canon/src/components/Link/Link.tsx b/packages/canon/src/components/Link/Link.tsx index 8763575bf9..8b88009a86 100644 --- a/packages/canon/src/components/Link/Link.tsx +++ b/packages/canon/src/components/Link/Link.tsx @@ -28,28 +28,31 @@ export const Link = forwardRef((props, ref) => { weight = 'regular', style, className, + render, ...restProps } = props; - // Get the responsive values for the variant and weight const responsiveVariant = useResponsiveValue(variant); const responsiveWeight = useResponsiveValue(weight); - return ( - - {children} - - ); + const linkProps = { + ref, + className: clsx( + 'canon-Link', + responsiveVariant && `canon-Link--variant-${responsiveVariant}`, + responsiveWeight && `canon-Link--weight-${responsiveWeight}`, + className, + ), + style, + children, + ...restProps, + }; + + if (render) { + return render(linkProps); + } + + return ; }); Link.displayName = 'Link'; diff --git a/packages/canon/src/components/Link/types.ts b/packages/canon/src/components/Link/types.ts index 4c5b34e14e..7bde893de2 100644 --- a/packages/canon/src/components/Link/types.ts +++ b/packages/canon/src/components/Link/types.ts @@ -30,4 +30,5 @@ export interface LinkProps weight?: 'regular' | 'bold' | Partial>; className?: string; style?: CSSProperties; + render?: (props: Omit) => ReactNode; }