-
Notifications
You must be signed in to change notification settings - Fork 1.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Button: Cannot make button as link properly #6535
Button: Cannot make button as link properly #6535
Comments
@melloware Do I understand correctly, that after this PR fix I can create a link with passed |
I have to study the code and see what PrimeTek original intent of this and what PrimeVue is doing. But right now this code does not look like it is doing as it was intended. |
What specific changes or enhancements are you aiming to make to the button component in your application, particularly in terms of its appearance and functionality? The showcase seems fine to me can you be more elaborate? |
@galimovkirill i think this is just confusion over what you want to do and I just updated the docs. There are 3 scenarios. Button Rendered As Link This renders the buttons as Link and navigates you to <Button label="Link" link onClick={() => window.open('https://react.dev', '_blank')} /> Link Rendered as Button This is a normal HTML link that just is "styled" to look like a button <a href="https://react.dev" target="_blank" rel="noopener noreferrer" className="p-button font-bold">
Navigate
</a> What you want is something more like this.... Button pretending to be a Link This is a normal button with all the behaviors like "disabled" etc it just simply performs a navigation. // open a new URL
<Button label="Open URL" link onClick={() => window.open('https://react.dev', '_blank')} />
// use NextJS Router to go to another URL
<Button label="Navigate In App" link onClick={() => router.push('/desired-url');} />
``` |
I think that current button implementation cannot provide functionality for my needs. You can see example at MUI's component: https://mui.com/material-ui/react-button/#text-button The 3rd button is a link, but we render it with |
@galimovkirill yes the equivalent in PR. MUI: <Button href="#text-buttons">Link</Button> PR: <Button label="Open URL" link onClick={() => window.location.hash = "#text-buttons";} /> |
Describe the bug
Component's API offers to make tag with p-button class, but I want use properties to style this link (or for additional functionality like disabled or loading) The current showcase definitely do not look right and is displaying "Link" and "Navigate".
Reproducer
https://primereact.org/button/#link
PrimeReact version
10.6.4
React version
18.x
Language
TypeScript
Build / Runtime
Vite
Browser(s)
No response
Steps to reproduce the behavior
No response
Expected behavior
No response
The text was updated successfully, but these errors were encountered: