Skip to content

Support for onClick event on Breadcrumb items #3631

@jrutila

Description

@jrutila

Description

Breadcrumb uses Link (and LinkBase) to implement the item rendering and navigation. Link (through LinkBase) in itself supports onClick event/prop. Now, passing onClick to the breadcrumb item does not go all the way through to the LinkBase, and thus prevents the fine-grained control of the Breadcrumb component.

The usage would look something like this:

<template>
 <UBreadcrumb :items="items" />
</template>
<script setup>
const items = [
 { label: "click for one", onClick: () => alert("1"), to: "/one" },
 { label: "click for two", onClick: () => alert("2"), to: "/two" },
]
</script>

My need is to have some secondary effects happening besides the navigation when the user clicks on a breadcrumb item.

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestv3#1289

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions