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

feat: add side-nav router integration API #7131

Merged
merged 9 commits into from
Feb 20, 2024

Conversation

tomivirkki
Copy link
Member

Description

This PR adds onNavigate and location properties to <vaadin-side-nav>. The properties can be used to integrate the component with a client-side router.

Example usage with React router:

import { SideNav, SideNavItem } from "@vaadin/react-components";
import { useNavigate, useLocation } from "react-router";

function SideNavigation() {
  const navigate = useNavigate();
  const location = useLocation();

  return (
    <SideNav onNavigate={({ path }) => navigate(path)} location={location}>
      <SideNavItem path="contacts">Contacts</SideNavItem>
      <SideNavItem path="hello">Hello</SideNavItem>
    </SideNav>
  );
}

Fixes #6468

Note: Once navigation API is available in all supported browsers, we can update <vaadin-side-nav-item> to use it and remove the location property.

Type of change

Feature

@tomivirkki tomivirkki force-pushed the feat/side-nav-item-click-callback branch 4 times, most recently from 42e9435 to 8ca868f Compare February 16, 2024 12:35
Copy link

sonarcloud bot commented Feb 20, 2024

Quality Gate Passed Quality Gate passed

Issues
3 New issues

Measures
0 Security Hotspots
No data about Coverage
0.0% Duplication on New Code

See analysis details on SonarCloud

@tomivirkki tomivirkki merged commit 4034234 into main Feb 20, 2024
9 checks passed
@tomivirkki tomivirkki deleted the feat/side-nav-item-click-callback branch February 20, 2024 07:51
@vaadin-bot
Copy link
Collaborator

This ticket/PR has been released with Vaadin 24.4.0.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Side nav issues with other routers
3 participants