diff --git a/README.md b/README.md index a1028f2..c9f2492 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,11 @@ It has the ability to be a single section or multiple for easy customization. ![Demo](mobile_menu.PNG) +# What's new + +* Built for .NET 9 Razor class libraries so it can be referenced from the latest Blazor Server, WebAssembly, or Auto render mode apps. +* Event callbacks and lifecycle updates have been hardened to support interactive hand-off when using Blazor's Auto render mode. + # Getting Setup You can install the package via the NuGet package manager just search for TailBlazor.NavBar. You can also install via powershell using the following command. @@ -39,7 +44,7 @@ Simply open up a component and add your content. - + ``` @@ -49,11 +54,11 @@ If you would like to add custom content, instead of using the default list of Na ... - + ... - - + + ... @@ -79,10 +84,10 @@ This allows you to open and close the mobile menu section, you will need a refer ``` - + - + @code { @@ -94,6 +99,10 @@ This allows you to open and close the mobile menu section, you will need a refer We set the default `background-color` for the navbar as `bg-blue-500`, from [TailWindCss(Background Color)](https://tailwindcss.com/docs/background-color). If you would like to change your default background color, just add a class of `.color-primary` to your css file, or just add the `Class` parameter to the `` component. +### Handling nav item clicks in interactive modes + +`NavItem` exposes an `OnClick` `EventCallback` so you can wire up actions that work in Blazor Server, WebAssembly, or Auto render modes without manually constructing anchor tags. You can continue to use the legacy `Action` property and it will be wrapped automatically. + ### Changing primary colors when using the `Items` parameter in the components. If you would like to add a different active class for the nav items, then just add `.color-primary-active` to your css file, or just input your class into the `ActiveItemClass` in the `NavItem` model. Lastly, if you would like to change the primary hover color for the nav items, then add `colorPrimaryHover` into your `tailwind.config.js` file. The default background-color for an active class or on hover is `bg-blue-700`. @@ -124,7 +133,7 @@ Parameter | Type | Default Value | Description `MobileMenuButtonPosition` | `MobileMenuButtonPosition [Enum]` | `MobileMenuButtonPosition.Left` | The mobile menu button position, either left or right. `MobileMenuButtonContent` | `RenderFragment` | `N/A` | The mobile menu button content, in case you would like to change the buttons that are used for the hamburger menu. `ChildContent` | `RenderFragment` | `N/A` | The children content for the navbar. You can use ``, `` or ``. Otherwise you can input your own custom code here. -`MobileMenuButtonOnClick` | `Action` | `N/A` | An action to open the mobile menu section.

**Note:** You will need to have ` ` component for this to work. +`MobileMenuButtonOnClick` | `EventCallback` | `N/A` | Invoked when the default mobile menu button toggles.

**Note:** You will need to have `` component for this to work. ### `````` --- diff --git a/src/TailBlazor.NavBar/CenterNavBarItem.razor b/src/TailBlazor.NavBar/CenterNavBarItem.razor index a114186..1a1ea34 100644 --- a/src/TailBlazor.NavBar/CenterNavBarItem.razor +++ b/src/TailBlazor.NavBar/CenterNavBarItem.razor @@ -1,4 +1,6 @@ -