Format definition
@startuml
scale 0.75
left to right direction
frame "How is a PlantUML hyperlink?" #aliceblue {
rectangle rb [
""[[""
]
frame "optional" as fu #palegreen {
frame u [
URL
]
}
frame "optional" as ft #palegreen {
rectangle tb [
""{""
]
frame t [
a tooltip
]
rectangle te [
""}""
]
}
frame "optional" as l #palegreen {
rectangle s [
""␣""
]
frame ll [
a label
]
}
rectangle fe [
""]]""
]
}
rb -- u
u -- tb
tb -- t
t -- te
te - s
ll -- fe
u -- s
s -- ll
u -- fe
te -- fe
@enduml
Simple link
Simple links are define using two square brackets (or three square brackets for field or method on class diagram).
Example:
* [[http://plantuml.com]]
* [[]]
(empty link)
Link with optional label
It is possible to give an optional label that will be printed instead of the link itself. A space is used as separator after the URL itself.
Example:
[[http://plantuml.com This label is printed]]
Link with optional tooltip
Finally you can also have an optional tooltip using round brackets, just after the URL and before the optional label.
Example:
[[http://plantuml.com{Optional tooltip} This label is printed]]
Links contained curly bracket
A link can contain some curly brackets.
@startuml
[[link{with_bracket}&id=10]]:Some activity\n(with link with brackets)\n""link{with_bracket}&id=10"";
[["link{with_bracket}"{}]]:Some activity\n(with link with brackets and empy tooltip)\n"""link{with_bracket}"{}"";
[["link{with_bracket}"{with tooltip}]]:Some activity\n(with link finished by brackets and tooltip)\n"""link{with_bracket}"{with tooltip}"";
[["link{with_bracket}&id=10"{with tooltip}]]:Some activity\n(with link with brackets and tooltip)\n"""link{with_bracket}&id=10"{with tooltip}"";
@enduml
[Ref. QA-13489]
Links in sequence diagram
The following example lists some links features:
@startuml
actor Bob [[http://plantuml.com/sequence]]
actor "This is [[http://plantuml.com/sequence Alice]] actor" as Alice
Bob -> Alice [[http://plantuml.com/start]] : hello
note left [[http://plantuml.com/start]]
a note with a link
end note
Alice -> Bob : hello with [[http://plantuml.com/start{Tooltip for message} some link]]
note right [[http://plantuml.com/start]] : another note
note left of Bob
You can use [[http://plantuml.com/start links in notes]] also.
end note
@enduml
Links in class diagram
@startuml
class Car [[http://plantuml.com/link]]
class Wheel [[http://plantuml.com/sequence]]
note left [[http://plantuml.com]]
foo
end note
Car *-- Wheel [[http://plantuml.com/class]] : has some
@enduml
There is a special syntax with 3 square brackets in class definition when you want to define a link on field or method. For example:
@startuml
class Car {
- Some field [[[http://plantuml.com]]]
Some method() [[[http://plantuml.com/link]]]
}
@enduml
@startuml
Object <|-- Foo
class Foo {
+ Object[] [[[http://www.google.com]]]
+ methods1() [[[http://www.yahoo.com/A1{Some explainations about this method}]]]
+ methods2() [[[http://www.yahoo.com/A2]]]
}
class Foo2 {
+ methods1() [[[http://www.yahoo.com/B1]]]
+ methods2() [[[http://www.yahoo.com/B2]]]
}
class Object [[http://www.yahoo.com]]
@enduml
Links in activity diagram
On partition
@startuml
start
partition "[[http://plantuml.com partition_name]]" {
:read doc. on [[http://plantuml.com plantuml_website]];
:test diagram;
}
end
@enduml
[Ref. QA-542]
Links in notes
It is also possible to specify a link at the beginning of a note (the link applies to the full note), or inside a note (for a portion of the note).
@startuml
:Foo:
note left of Foo [[http://www.google.com]]
This is a note
end note
note right of Foo
Yet another link to [[http://www.google.com]] as demo.
You can also [[http://www.yahoo.fr specify a text]] for the link.
And even [[http://www.yahoo.fr{This is a tooltip} add a tooltip]] to the link.
end note
@enduml
[Ref. Incubation: URL in diagrams]
Links with explicit URL directive
You can use the url of XXX is [[yyy]]
syntax:
On component or deployment diagram
@startuml
node Mamal
component Dog
url of Mamal is [[http://www.google.com]]
url of Dog is [[http://www.yahoo.com{This is Dog}]]
@enduml
[Ref. Incubation: URL in diagrams]
Links in arrow (or Hyperlinks in link or connection)
Specific SkinParameter for Link
hyperlinkColor
You can change the color
value of the links with the hyperlinkColor
setting.
[Ref. QA-2322]
hyperlinkUnderline
You can underline or not the links with the hyperlinkUnderline
setting.
@startuml
skinparam hyperlinkUnderline true
:hyperlinkColor setting;
:[[http://plantuml.com]];
@enduml
@startuml
skinparam hyperlinkUnderline false
:hyperlinkColor setting;
:[[http://plantuml.com]];
@enduml
🚩'hyperlinkUnderline false' seems broken… 🏁
Other SkinParameter for Link
You can see also on: * link::svg#34q86jw7xgn8k362kjon[Specific SkinParameter for SVG]
Using (global) style
With style
You can use link::style-evolution[style] to change rendering of elements.
@startuml
title test on HyperlinkColor [[test link]]
class test <> {
* aaa
+ [[normal model]]
- bb
}
class test_with_stereo AS "[[http://www.plantuml.com test]]" <> {
* aaa
+ [[red model]]
- bb
}
@enduml
[Ref. QA-8071]