Navigation
Edit this pageOnce your routes have been created within an application, anchor tags can be used to help users navigate between different views or pages.
<A>
component
While you can use the native HTML anchor tag, Solid Router does provide a <A>
component.
While similar to an anchor tag, the <A>
component supports automatically applying the base URL path and relative paths.
Styling links
In addition, the <A>
component also provides an active
and inactive
prop.
This prop accepts a string that, when provided, will apply the specified class to the anchor tag based on the current route.
If the current route matches the href
prop, the active
class will be applied, otherwise the inactive
class will be applied.
Matching routes
By default, matching using the <A>
component will include locations that are descendants of the specified route.
This would include /users
, /users/1
, /users/1/posts
, etc. if /users
is the specified route.
To match the exact route only, you can use the end
prop: