Previews

No matching results.

x
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
<nav aria-label="Default with nav element" data-view-component="true" class="UnderlineNav">
<ul data-view-component="true" class="UnderlineNav-body list-style-none">
<li data-view-component="true" class="d-inline-flex">
<a href="#" aria-current="page" data-view-component="true" class="UnderlineNav-item">
Item 1
</a></li>
<li data-view-component="true" class="d-inline-flex">
<a href="#" data-view-component="true" class="UnderlineNav-item">
Item 2
</a></li>
<li data-view-component="true" class="d-inline-flex">
<a href="#" data-view-component="true" class="UnderlineNav-item">
Item 3
</a></li>
</ul>
<div data-view-component="true" class="UnderlineNav-actions"> <button type="button" data-view-component="true" class="btn"> Button
</button>
</div>
</nav>
1
2
3
4
5
6
7
8
<%= render(Primer::Alpha::UnderlineNav.new(label: label, tag: tag, align: align)) do |component| %>
<% Array.new(number_of_panels || 3) do |i| %>
<% component.with_tab(href: "#", selected: i.zero?) { "Item #{i + 1}" } %>
<% end %>
<% component.with_actions do %>
<%= render(Primer::ButtonComponent.new) { "Button" } %>
<% end %>
<% end %>
Param Description Input

app/components/primer/alpha/underline_nav.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
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
/* UnderlineNav */
.UnderlineNav {
display: flex;
min-height: var(--base-size-48);
overflow-x: auto;
overflow-y: hidden;
box-shadow: inset 0 -1px 0 var(--borderColor-muted);
-webkit-overflow-scrolling: auto;
justify-content: space-between;
}
.UnderlineNav .Counter {
margin-left: var(--control-medium-gap);
color: var(--fgColor-default);
background-color: var(--bgColor-neutral-muted, var(--color-neutral-muted));
}
.UnderlineNav .Counter--primary {
color: var(--fgColor-onEmphasis);
background-color: var(--bgColor-neutral-emphasis);
}
.UnderlineNav-body {
display: flex;
align-items: center;
gap: var(--control-medium-gap);
list-style: none;
}
.UnderlineNav-item {
position: relative;
display: flex;
padding: 0 var(--control-medium-paddingInline-condensed);
font-size: var(--text-body-size-medium);
line-height: 30px;
color: var(--fgColor-default);
text-align: center;
white-space: nowrap;
cursor: pointer;
background-color: transparent;
border: 0;
border-radius: var(--borderRadius-medium);
align-items: center;
}
.UnderlineNav-item:hover,.UnderlineNav-item:focus,.UnderlineNav-item:focus-visible {
color: var(--fgColor-default);
-webkit-text-decoration: none;
text-decoration: none;
border-bottom-color: var(--borderColor-neutral-muted);
outline-offset: -2px;
transition: border-bottom-color 0.12s ease-out;
}
/* renders a visibly hidden "copy" of the label in bold, reserving box space for when label becomes bold on selected */
.UnderlineNav-item [data-content]::before {
display: block;
height: 0;
font-weight: var(--base-text-weight-semibold);
visibility: hidden;
content: attr(data-content);
}
/* increase touch target area */
:is(.UnderlineNav-item::before) {
position: absolute;
top: 50%;
left: 50%;
width: 100%;
height: 100%;
min-height: 48px;
content: "";
transform: translateX(-50%) translateY(-50%);
}
/* hover state was "sticking" on mobile after click */
@media (pointer: fine) {
.UnderlineNav-item:hover {
color: var(--fgColor-default);
-webkit-text-decoration: none;
text-decoration: none;
background: var(--control-transparent-bgColor-hover);
transition: background 0.12s ease-out;
}
}
.UnderlineNav-item.selected,.UnderlineNav-item[role='tab'][aria-selected='true'],.UnderlineNav-item[aria-current]:not([aria-current='false']) {
font-weight: var(--base-text-weight-semibold);
color: var(--fgColor-default);
border-bottom-color: var(--underlineNav-borderColor-active);
/* current/selected underline */
}
:is(.UnderlineNav-item.selected,.UnderlineNav-item[role='tab'][aria-selected='true'],.UnderlineNav-item[aria-current]:not([aria-current='false']))::after {
position: absolute;
z-index: 1; /* raise above full-width flash banner */
right: 50%;
bottom: calc(50% - 25px); /* 48px total height / 2 (24px) + 1px */
width: 100%;
height: 2px;
content: '';
background: var(--underlineNav-borderColor-active);
border-radius: var(--borderRadius-medium);
transform: translate(50%, -50%);
}
.UnderlineNav--right {
justify-content: flex-end;
}
.UnderlineNav--right .UnderlineNav-actions {
flex: 1 1 auto;
}
.UnderlineNav-actions {
align-self: center;
}
.UnderlineNav--full {
display: block;
/* required for underline to align with additional wrapper element */
}
.UnderlineNav--full .UnderlineNav-body {
min-height: var(--base-size-48);
}
.UnderlineNav-octicon {
display: inline !important;
margin-right: var(--control-medium-gap);
color: var(--fgColor-muted);
fill: var(--fgColor-muted);
}
.UnderlineNav-container {
display: flex;
justify-content: space-between;
}