+
{primaryAction ?? null}
{secondaryAction ?? null}
diff --git a/packages/react/src/Link/Link.tsx b/packages/react/src/Link/Link.tsx
index 1326259fd12..33d0562e477 100644
--- a/packages/react/src/Link/Link.tsx
+++ b/packages/react/src/Link/Link.tsx
@@ -61,7 +61,7 @@ const StyledLink = styled.a
`
${sx};
`
-const Link = forwardRef(({as: Component = 'a', className, ...props}, forwardedRef) => {
+const Link = forwardRef(({as: Component = 'a', className, inline, underline, ...props}, forwardedRef) => {
const enabled = useFeatureFlag('primer_react_css_modules_staff')
const innerRef = React.useRef(null)
@@ -98,8 +98,8 @@ const Link = forwardRef(({as: Component = 'a', className, ...props}, forwardedRe
as={Component}
className={clsx(className, classes.Link)}
data-muted={props.muted}
- data-inline={props.inline}
- data-underline={props.underline}
+ data-inline={inline}
+ data-underline={underline}
{...props}
// @ts-ignore shh
ref={innerRef}
@@ -111,8 +111,8 @@ const Link = forwardRef(({as: Component = 'a', className, ...props}, forwardedRe
+}
+
+/**
+ * Utility to toggle rendering a styled component or a "plain" component based
+ * on the provided `as` prop. When the provided feature flag is enabled, the
+ * props will be passed through to an element or component created with the `as`
+ * prop. When it is disabled, the provided styled component is used instead.
+ *
+ * @param flag - the feature flag that will control whether or not the provided
+ * styled component is used
+ * @param Component - the styled component that will be used if the feature flag
+ * is disabled
+ */
+export function toggleStyledComponent(flag: string, Component: React.ComponentType) {
+ const Wrapper = React.forwardRef(function Wrapper({as: BaseComponent = 'div', ...rest}, ref) {
+ const enabled = useFeatureFlag(flag)
+ if (enabled) {
+ return
+ }
+ return
+ })
+
+ return Wrapper
+}