Button as Link doesn't work as intended #2550
-
I want to use a button as a link specifically because the Anchor tag is underlined which I don't want. Here's what I'm trying to use: When I add an href I get the expected warning that I need to use "as='a'": But when I do what the warning says and add "as='a'" it gives me this warning and basically renders the button link unusable. Again, the trouble here is that I don't want the button to be underlined but it seems like the main workaround is to pass an onClick and explicitly handle navigation. Thanks for the help! |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
Hi @dholliday3 Can you explain your use case for an anchor with no underline? In general, buttons perform actions on the page the user is currently on and anchors take the user to another page. For consistency and clarity for users, Paste has a rule that all anchors have an underline and buttons do not have an underline (we have documentation about this in the Button vs. Anchor pattern). The link style button doesn’t have an underline because even though it looks similar to an anchor, it is a button. We throw an error when you try to make a link style button an anchor because generally, it is preferable to use the actual Anchor component. The only time we only allow a Button with If you need something that takes the user to another page, I would strongly suggest using the Anchor component. |
Beta Was this translation helpful? Give feedback.
Hi @dholliday3
Can you explain your use case for an anchor with no underline?
In general, buttons perform actions on the page the user is currently on and anchors take the user to another page. For consistency and clarity for users, Paste has a rule that all anchors have an underline and buttons do not have an underline (we have documentation about this in the Button vs. Anchor pattern).
The link style button doesn’t have an underline because even though it looks similar to an anchor, it is a button. We throw an error when you try to make a link style button an anchor because generally, it is preferable to use the actual Anchor component. The only time we only allow a Button with
as=“a”
i…