Skip to content
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

links should behave like text, instead of having padding and being centered #76

Open
luisrudge opened this issue Oct 18, 2024 · 5 comments

Comments

@luisrudge
Copy link

image

when I'm adding a link, I expect to be just a regular text. instead, current links behave more like button links (that's why you inherit from the button styles).

@jolbol1
Copy link
Owner

jolbol1 commented Oct 18, 2024

I have actually encountered this pain point myself. I think I will deviate from the shadcn style here and adjust it. Two possible solutions could be add a link "size" to the button variants removing padding, or simply style the Link in its own way and leave the button as is.

Thanks for the suggestion

@luisrudge
Copy link
Author

IMO, I'd go with a separate style for links. Perhaps you can export a LinkButton component that has the button styles (as today), but a standard Link component should behave like any other tag.

@imMatheus
Copy link

imMatheus commented Oct 21, 2024

I think the right thing here is to not have a Link component at all (IMO). If you want the link to be styled as a Button, you import the buttonVariants from button.ts file. That is also what ShadcnUI does, they have not Link component. And especially as all the current Link styling just seems to be a copy paste of styles from Shadcn

So the right thing would be like this

import { buttonVariants } from '@components/button'

const Page = () => {
   return <a className={buttonVariants({variant: 'ghost'})}>A link</a>
}

@jolbol1
Copy link
Owner

jolbol1 commented Oct 21, 2024

I think the right thing here is to not have a Link component at all (IMO). If you want the link to be styled as a Button, you import the buttonVariants from button.ts file. That is also what ShadcnUI does, they have not Link component. And especially as all the current Link styling just seems to be a copy paste of styles from Shadcn

So the right thing would be like this

import { buttonVariants } from '@components/button'

const Page = () => {
   return <a className={buttonVariants({variant: 'ghost'})}>A link</a>
}

I looked at how I would do this and came to the same conclusion. I don't think there's a good default style for a link. They are too dependent on where you put them and the content around them. Is it in a paragraph, is it in a navbar etc

Will look into making it clearer in the documentation. I still want the Link page as I think its important to let people know that they can use RAC link component and set it up to support NextJS routing, remix etc

@luisrudge
Copy link
Author

because tailwindcss resets all link styles, I think a Link component should be provided. Otherwise everyone will have to implement their own style for links, which is something this project is trying to address. If anything, don't add a ButtonLink, but add a TextLink. Just my 2c

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants