#`UnstyledButton` with react-router `NavLink`

4 messages · Page 1 of 1 (latest)

sterile valley
#

I'm trying to build a sidebar using this https://ui.mantine.dev/category/navbars/ (the second one), each item is an UnstyledButton.

I'm passing them the react-router NavLink as the component prop, it works wonders, but they are not highlighted as active when the route is active.

It gets the aria-current="page" prop and the class active added but nothing happens.

(the first one in the image is the one matching the current active route)

#

My current code is this

<UnstyledButton
    component={RouterNavLink}
    to={to}
    className={classes.link}
>
    <Icon size={20} stroke={1.5} />
</UnstyledButton>
fathom echo
#

You need to change styles to use aria-current="page" selector

sterile valley