flowbite-svelte
flowbite-svelte copied to clipboard
Allow a button to look like a link or link to work like a button
Summary
Its common to have an element that looks like a link but behaves like a button. Its a button that looks like a link.
Basic example
Currently with the link component you can add an on:click but this still triggers a page load with a # as the href.
<!-- this will work but it sends the page scroll to the top because of the default href as # -->
<A on:click={()=> show_full_link = !show_full_link}>view full link</A>
As for button there is no way to make a button look like a link, a prop detailing it should look like a link would be amazing:
<Button as="link" on:click={()=> show_full_link = !show_full_link}>view full link</Button>
Motivation
To be able to have buttons that look like links.
I think this can be confusing for users, especially those who rely on visual cues to navigate. Screen readers might also misinterpret the element.
This is beneficial to screen readers - you dont want someone using a link just to get something that looks like a link when they should be using a button.