Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
<!-- Default -->
<a href="#" data-view-component="true" class="Link"><span data-view-component="true" class="Link-content">This is a default link color.</span></a>
<!-- Primary -->
<a href="#" data-view-component="true" class="Link--primary Link"><span data-view-component="true" class="Link-content">This is a primary link color.</span></a>
<!-- Primary, Muted -->
<a href="#" data-view-component="true" class="Link--primary Link Link--muted"><span data-view-component="true" class="Link-content">This is a muted primary link color.</span></a>
<!-- Secondary -->
<a href="#" data-view-component="true" class="Link--secondary Link"><span data-view-component="true" class="Link-content">This is a secondary link color.</span></a>
<!-- Secondary, Muted -->
<a href="#" data-view-component="true" class="Link--secondary Link Link--muted"><span data-view-component="true" class="Link-content">This is a muted secondary link color.</span></a>
1
2
3
4
5
6
7
8
9
10
11
12
13
14
# Default
render(Primer::Beta::Link.new(href: "#")) { "This is a default link color." }
# Primary
render(Primer::Beta::Link.new(href: "#", scheme: :primary)) { "This is a primary link color." }
# Primary, Muted
render(Primer::Beta::Link.new(href: "#", scheme: :primary, muted: true)) { "This is a muted primary link color." }
# Secondary
render(Primer::Beta::Link.new(href: "#", scheme: :secondary)) { "This is a secondary link color." }
# Secondary, Muted
render(Primer::Beta::Link.new(href: "#", scheme: :secondary, muted: true)) { "This is a muted secondary link color." }

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;
}