Previews

No matching results.

x
1
2
3
4
<a href="#" data-view-component="true" class="Link"><span data-view-component="true" class="Link-content">Link with trailing icon
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-link-external">
<path d="M3.75 2h3.5a.75.75 0 0 1 0 1.5h-3.5a.25.25 0 0 0-.25.25v8.5c0 .138.112.25.25.25h8.5a.25.25 0 0 0 .25-.25v-3.5a.75.75 0 0 1 1.5 0v3.5A1.75 1.75 0 0 1 12.25 14h-8.5A1.75 1.75 0 0 1 2 12.25v-8.5C2 2.784 2.784 2 3.75 2Zm6.854-1h4.146a.25.25 0 0 1 .25.25v4.146a.25.25 0 0 1-.427.177L13.03 4.03 9.28 7.78a.751.751 0 0 1-1.042-.018.751.751 0 0 1-.018-1.042l3.75-3.75-1.543-1.543A.25.25 0 0 1 10.604 1Z"></path>
</svg></span></a>
1
2
3
4
render(Primer::Beta::Link.new(href: "#")) do |component|
component.with_trailing_visual_icon(icon: :"link-external")
"Link with trailing icon"
end

app/components/primer/beta/link.css

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
/* Links */
.Link {
color: var(--fgColor-accent);
-webkit-text-decoration: none;
text-decoration: none;
}
.Link:hover {
-webkit-text-decoration: underline;
text-decoration: underline;
cursor: pointer;
}
.Link:focus {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.Link:focus,.Link:focus-visible {
outline-offset: 0;
}
.Link--underline {
-webkit-text-decoration: underline;
text-decoration: underline;
}
.Link--primary {
color: var(--fgColor-default) !important;
}
.Link--primary:hover {
color: var(--fgColor-accent) !important;
}
.Link--secondary {
color: var(--fgColor-muted) !important;
}
.Link--secondary:hover {
color: var(--fgColor-accent) !important;
}
.Link--muted {
color: var(--fgColor-muted) !important;
}
.Link--muted:hover {
color: var(--fgColor-accent) !important;
-webkit-text-decoration: none;
text-decoration: none;
}
/* Set the link color only on hover
Useful when you want only part of a link to turn blue on hover */
.Link--onHover:hover {
color: var(--fgColor-accent) !important;
-webkit-text-decoration: underline;
text-decoration: underline;
cursor: pointer;
}
/* When using a color utility class inside of a link class
color should change with link on hover. */
:is(.Link--secondary,.Link--primary,.Link--muted):hover [class*='color-fg'] {
color: inherit !important;
}
.Link-content {
display: inline-flex;
align-items: center;
/* stylelint-disable-next-line primer/typography */
line-height: normal;
gap: var(--base-size-4);
text-decoration: inherit;
}