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

[@mantine/core] NavLink: Use active styles when aria-current is present #6180

Merged
merged 1 commit into from
May 11, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 7 additions & 1 deletion apps/mantine.dev/src/pages/core/nav-link.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,13 @@ export default Layout(MDX_DATA.NavLink);

## Active

Set `active` prop to add active styles to `NavLink`. You can customize active styles with `color` and `variant` props:
Set `active` prop to add active styles to `NavLink`.

Note that if you're using a React Router or Remix `NavLink` inside `renderRoot`, the active styles will be based on the
[`aria-current` attribute that's set by React Router](https://reactrouter.com/en/main/components/nav-link#aria-current)
so you won't need to explicitly set the `active` prop.

You can customize active styles with `color` and `variant` props:

<Demo data={NavLinkDemos.active} />

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
pointer-events: none;
}

&:where([data-active]) {
&:where([data-active], [aria-current='page']) {
background-color: var(--nl-bg);
color: var(--nl-color);

Expand Down
Loading