Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Chron's avatar
Level 6

Link component still renders href even if it's empty

<Link data-bs-toggle="collapse" role="button">Dropdown</Link>

This snippet still renders an anchor tag with href. Adding null or undefined doesn't work. I'm getting missing required prop warning. Is there a solution for this? I don't want to use any other tags for consistency.

0 likes
5 replies
tykus's avatar

The Link component requires a href; that is its API. If you can't provide one, then do not use the Link. Otherwise, use a the URI fragment # as your href

Chron's avatar
Level 6

@tykus I did empty fragment but it returns href="" when it renders

tykus's avatar

@Chron why don't you just write your own Link component that exposes the API you want; the Inertia Link clearly is not suited to your needs 🤷‍♂️

Please or to participate in this conversation.