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

Feature Request: Add Support for Clickable Links in State Diagram Nodes #6314

Open
BambioGaming opened this issue Feb 23, 2025 · 0 comments
Open
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request

Comments

@BambioGaming
Copy link

Proposal

Feature Request

Mermaid.js currently supports clickable links in flowcharts using the click directive:

graph TD
    A[Start] --> B[Go to Google]
    B --> C[End]
    click B "https://google.com" "Visit Google"

However, state diagrams do not support clickable links in the same way.
It would be very useful to have a similar feature for state diagrams, allowing nodes to link to external URLs or trigger JavaScript functions.

Use Case

Making state transition diagrams interactive for documentation, tutorials, and apps.

Example:

stateDiagram
    [*] --> Idle
    Idle --> Google
    Google --> [*]
    click Google "https://google.com" "Visit Google"

This should allow clicking Google to open https://google.com.

Proposed Solution

  1. Introduce click directive support for state diagrams, just like flowcharts.
  2. Support both URL links and JavaScript function calls.
  3. Ensure accessibility and maintain SVG compatibility.

Related Discussions

#6304

Would love to hear thoughts on feasibility!

Example

No response

Screenshots

No response

@BambioGaming BambioGaming added Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request labels Feb 23, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Status: Triage Needs to be verified, categorized, etc Type: Enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

1 participant