Render link as button - best practice? #1559
Unanswered
aaronadamsCA
asked this question in
Q&A
Replies: 1 comment 1 reply
-
Hey, great question! The answer depends on what <Link href="/about" passHref>
<Button as="a">About us</Button>
</Link> If you just need to render a |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Does anyone have a good pattern for rendering a
Link
that looks like aButton
?I can't just
<Link variant="buttons.primary">
, because that fails to pick up the styles hard-coded into theButton
component.<Button as={Link}>
seems to grab both button and link styles, which is awkward since the link styles add undesirable colours/hovers to the button.<Link><Button as="span" /></Link>
is what I've settled on for now; it generates compliant HTML5, and (at least with my theme) the link style doesn't affect the button's appearance.But I wonder if anyone has a less awkward solution?
Beta Was this translation helpful? Give feedback.
All reactions