Previews

No matching results.

x
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
<nav aria-label="With icons and counters" 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">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star UnderlineNav-octicon">
<path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
</svg>
<span data-view-component="true">Item 1</span>
<span title="5" data-view-component="true" class="Counter">5</span>
</a></li>
<li data-view-component="true" class="d-inline-flex">
<a href="#" data-view-component="true" class="UnderlineNav-item">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star UnderlineNav-octicon">
<path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
</svg>
<span data-view-component="true">Item 2</span>
<span title="10" data-view-component="true" class="Counter">10</span>
</a></li>
<li data-view-component="true" class="d-inline-flex">
<a href="#" data-view-component="true" class="UnderlineNav-item">
<svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-star UnderlineNav-octicon">
<path d="M8 .25a.75.75 0 0 1 .673.418l1.882 3.815 4.21.612a.75.75 0 0 1 .416 1.279l-3.046 2.97.719 4.192a.751.751 0 0 1-1.088.791L8 12.347l-3.766 1.98a.75.75 0 0 1-1.088-.79l.72-4.194L.818 6.374a.75.75 0 0 1 .416-1.28l4.21-.611L7.327.668A.75.75 0 0 1 8 .25Zm0 2.445L6.615 5.5a.75.75 0 0 1-.564.41l-3.097.45 2.24 2.184a.75.75 0 0 1 .216.664l-.528 3.084 2.769-1.456a.75.75 0 0 1 .698 0l2.77 1.456-.53-3.084a.75.75 0 0 1 .216-.664l2.24-2.183-3.096-.45a.75.75 0 0 1-.564-.41L8 2.694Z"></path>
</svg>
<span data-view-component="true">Item 3</span>
<span title="15" data-view-component="true" class="Counter">15</span>
</a></li>
</ul>
</nav>
1
2
3
4
5
6
7
8
9
render(Primer::Alpha::UnderlineNav.new(label: label, tag: tag, align: align)) do |component|
Array.new(number_of_panels.to_i || 3) do |i|
component.with_tab(href: "#", selected: i.zero?) do |tab|
tab.with_icon(icon: :star)
tab.with_text { "Item #{i + 1}" }
tab.with_counter(count: (i + 1) * 5)
end
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
145
146
147
148
/* 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 */
.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 */
}
.UnderlineNav-item.selected::after, .UnderlineNav-item[role='tab'][aria-selected='true']::after, .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;
}