Skip to content

How to make breadcrumb item client-side navigation as next/link instead of browser routing #621

Answered by connorlanigan
hiimnhan asked this question in Q&A
Discussion options

You must be logged in to vote

The Breadcrumb component provides an onFollow event that you can use to perform the client-side navigation.
NextJS provides the useRouter hook, which has a push method for this use case.

You can combine them like this:

import BreadcrumbGroup from "@cloudscape-design/components/breadcrumb-group";
import { useRouter } from 'next/router';

function MyApp() {
  const router = useRouter();

  return (
    <BreadcrumbGroup
      items={[
        { text: 'System', href: '#' },
        { text: 'Components', href: '#components' },
        {
          text: 'Breadcrumb group',
          href: '#components/breadcrumb-group',
        },
      ]}
      ariaLabel="Breadcrumbs"
      onFollow={event => {

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by hiimnhan
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants