yew-nav-link
Navigation link component for Yew with automatic active state detection.
Table of Contents
Overview
yew-nav-link provides a NavLink component that wraps Yew Router's Link with automatic active state management. When the target route matches the current URL, an active CSS class is applied automatically.
Installation
[]
= "0.3"
Requirements
| Dependency | Version |
|---|---|
| yew | 0.22+ |
| yew-router | 0.19+ |
Usage
Component Syntax
use *;
use NavLink;
use *;
Function Syntax
For text-only links, use the nav_link helper:
use *;
use nav_link;
use *;
CSS Classes
The component applies these classes to the rendered <a> element:
| Class | When Applied |
|---|---|
nav-link |
Always |
active |
Route matches current URL |
Bootstrap Integration
to={Route::Home}>{ "Home" }>
<!-- Renders: <a class="nav-link active" href="/">Home</a> -->
Tailwind CSS
}
}
API Reference
NavLink<R> Component
| Prop | Type | Description |
|---|---|---|
to |
R: Routable |
Target route |
children |
Children |
Link content |
nav_link<R> Function
Creates a NavLink with text content.
Code coverage is tracked via Codecov. Target: 95%+ coverage.
Sunburst
The inner-most circle is the entire project, moving away from the center are folders then, finally, a single file. The size and color of each slice represents the number of statements and the coverage, respectively.
Grid
Each block represents a single file in the project. The size and color of each block represents the number of statements and the coverage, respectively.
Icicle
The top section represents the entire project. Proceeding with folders and finally individual files. The size and color of each slice represents the number of statements and the coverage, respectively.
License
Licensed under the MIT License.