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

Update <Link> to be underlined by default #9483

Merged
merged 2 commits into from
Dec 4, 2023
Merged

Update <Link> to be underlined by default #9483

merged 2 commits into from
Dec 4, 2023

Conversation

fzaninotto
Copy link
Member

@fzaninotto fzaninotto commented Nov 29, 2023

Problem

In short, it’s not trendy anymore to not underline links - and we use that trend in react-admin.

Solution

  • Remove the underline="none" in our custom Link component. This also affects components that render internal links.
  • Retest all demos to make sure no unwanted underline has appeared
  • Write changelog / upgrade guide
Before After
localhost_8000_ (1) localhost_8000_

Breaking Change

In the default theme, links are now underlined by default.

If you use the <Link> component from react-admin, and you want to remove the underline, set the underline prop to none:

import { Link } from 'react-admin';

const MyComponent = () => (
-   <Link to="/foo">Foo</Link>
+   <Link to="/foo" underline="none">Foo</Link>
);

Some react-admin component use <Link> under the hood, and will also render underlined links:

  • <Count>
  • <EmailField>
  • <FileField>
  • <ReferenceField>
  • <ReferenceManyCount>
  • <UrlField>

<SingleFieldList> still disables the underline by default.

To remove the underline in these components, use the sx prop. For instance, to remove the underline in <ReferenceField>:

const CompanyField = () => (
-   <ReferenceField source="company_id" reference="companies" />
+   <ReferenceField source="company_id" reference="companies" sx={{
+      '& a': { textDecoration: 'none' }
+   }} />
)

@djhi djhi added this to the 5.0.0 milestone Dec 4, 2023
@djhi djhi merged commit 80b0edd into next Dec 4, 2023
11 checks passed
@djhi djhi deleted the link-remove-underline branch December 4, 2023 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
RFR Ready For Review v5
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants