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
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
<div style="display: flex; gap: 1rem;"> <button type="button" data-view-component="true" class="Button--invisible Button--medium Button Button--invisible-noVisuals"> <span class="Button-content"> <span class="Button-label">Button</span> </span> </button> <button type="button" data-view-component="true" class="Button--invisible Button--medium Button"> <span class="Button-content"> <span class="Button-visual Button-leadingVisual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-search"> <path d="M10.68 11.74a6 6 0 0 1-7.922-8.982 6 6 0 0 1 8.982 7.922l3.04 3.04a.749.749 0 0 1-.326 1.275.749.749 0 0 1-.734-.215ZM11.5 7a4.499 4.499 0 1 0-8.997 0A4.499 4.499 0 0 0 11.5 7Z"></path> </svg> </span> <span class="Button-label">Button</span> </span> </button> <button type="button" data-view-component="true" class="Button--invisible Button--medium Button"> <span class="Button-content"> <span class="Button-label">Button</span> </span> <span class="Button-visual Button-trailingAction"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path> </svg> </span> </button> <button type="button" data-view-component="true" class="Button--invisible Button--medium Button"> <span class="Button-content"> <span class="Button-label">Button</span> <span class="Button-visual Button-trailingVisual"> <span class="sr-only">(<span aria-hidden="true" title="15" data-view-component="true" class="Counter">15</span>)</span> <span aria-hidden="true" title="15" data-view-component="true" class="Counter">15</span> </span> </span> </button> <button type="button" data-view-component="true" class="Button--invisible Button--medium Button"> <span class="Button-content"> <span class="Button-visual Button-leadingVisual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-eye"> <path d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"></path> </svg> </span> <span class="Button-label">Button</span> <span class="Button-visual Button-trailingVisual"> <span class="sr-only">(<span aria-hidden="true" title="15" data-view-component="true" class="Counter">15</span>)</span> <span aria-hidden="true" title="15" data-view-component="true" class="Counter">15</span> </span> </span> </button> <button type="button" data-view-component="true" class="Button--invisible Button--medium Button"> <span class="Button-content"> <span class="Button-visual Button-leadingVisual"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-eye"> <path d="M8 2c1.981 0 3.671.992 4.933 2.078 1.27 1.091 2.187 2.345 2.637 3.023a1.62 1.62 0 0 1 0 1.798c-.45.678-1.367 1.932-2.637 3.023C11.67 13.008 9.981 14 8 14c-1.981 0-3.671-.992-4.933-2.078C1.797 10.83.88 9.576.43 8.898a1.62 1.62 0 0 1 0-1.798c.45-.677 1.367-1.931 2.637-3.022C4.33 2.992 6.019 2 8 2ZM1.679 7.932a.12.12 0 0 0 0 .136c.411.622 1.241 1.75 2.366 2.717C5.176 11.758 6.527 12.5 8 12.5c1.473 0 2.825-.742 3.955-1.715 1.124-.967 1.954-2.096 2.366-2.717a.12.12 0 0 0 0-.136c-.412-.621-1.242-1.75-2.366-2.717C10.824 4.242 9.473 3.5 8 3.5c-1.473 0-2.825.742-3.955 1.715-1.124.967-1.954 2.096-2.366 2.717ZM8 10a2 2 0 1 1-.001-3.999A2 2 0 0 1 8 10Z"></path> </svg> </span> <span class="Button-label">Button</span> <span class="Button-visual Button-trailingVisual"> <span class="sr-only">(<span aria-hidden="true" title="15" data-view-component="true" class="Counter">15</span>)</span> <span aria-hidden="true" title="15" data-view-component="true" class="Counter">15</span> </span> </span> <span class="Button-visual Button-trailingAction"> <svg aria-hidden="true" height="16" viewBox="0 0 16 16" version="1.1" width="16" data-view-component="true" class="octicon octicon-triangle-down"> <path d="m4.427 7.427 3.396 3.396a.25.25 0 0 0 .354 0l3.396-3.396A.25.25 0 0 0 11.396 7H4.604a.25.25 0 0 0-.177.427Z"></path> </svg> </span> </button> <button id="my-id" type="button" data-view-component="true" class="Button--invisible Button--medium Button Button--invisible-noVisuals"> <span class="Button-content"> <span class="Button-label">Button with tooltip</span> </span> </button><tool-tip id="tooltip-da71acff-520e-4852-9e65-ab440bae8544" for="my-id" popover="manual" data-direction="s" data-type="description" data-view-component="true" class="sr-only position-absolute">Tooltip text</tool-tip></div>
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
<div style="display: flex; gap: 1rem;"> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, )) do %> Button <% end %> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, )) do |component| %> <% component.with_leading_visual_icon(icon: :search) %> Button <% end %> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, )) do |component| %> <% component.with_trailing_action_icon(icon: "triangle-down") %> Button <% end %> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, )) do |component| %> <% component.with_trailing_visual_counter(count: "15") %> Button <% end %> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, )) do |component| %> <% component.with_leading_visual_icon(icon: :eye) %> <% component.with_trailing_visual_counter(count: "15") %> Button <% end %> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, )) do |component| %> <% component.with_leading_visual_icon(icon: :eye) %> <% component.with_trailing_visual_counter(count: "15") %> <% component.with_trailing_action_icon(icon: "triangle-down") %> Button <% end %> <%= render(Primer::Beta::Button.new( scheme: :invisible, size: :medium, id: "my-id" )) do |component| %> <% component.with_tooltip(text: "Tooltip text") %> Button with tooltip <% end %></div>
No notes provided.
No params configured.
app/components/primer/beta/button.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
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
/* stylelint-disable selector-no-qualifying-type *//* stylelint-disable selector-max-type *//* stylelint-disable primer/spacing *//* CSS for Button *//* temporary, pre primitives release */:root { --duration-fast: 80ms; --easing-easeInOut: cubic-bezier(0.65, 0, 0.35, 1);}/* base button */.Button { position: relative; display: inline-flex; min-width: max-content; height: var(--control-medium-size); padding: 0 var(--control-medium-paddingInline-normal); font-size: var(--text-body-size-medium); font-weight: var(--base-text-weight-medium); color: var(--button-default-fgColor-rest); text-align: center; cursor: pointer; flex-direction: row; -webkit-user-select: none; user-select: none; background-color: transparent; border: var(--borderWidth-thin) solid; border-color: transparent; border-radius: var(--borderRadius-medium); transition: var(--duration-fast) var(--easing-easeInOut); transition-property: color, fill, background-color, border-color; justify-content: space-between; align-items: center; gap: var(--base-size-4); /* mobile friendly sizing */}@media (pointer: coarse) { :is(.Button::before) { position: absolute; top: 50%; left: 50%; width: 100%; height: 100%; min-height: 48px; content: ""; transform: translateX(-50%) translateY(-50%); min-width: 48px; } }/* base states */.Button:hover { transition-duration: var(--duration-fast); }.Button:active { transition: none; }.Button:disabled,.Button[aria-disabled='true'] { cursor: not-allowed; box-shadow: none; }.Button.Button--iconOnly { color: var(--fgColor-muted); }:is(a.Button,summary.Button):hover { -webkit-text-decoration: none; text-decoration: none; }/* wrap grid content to allow trailingAction to lock-right */.Button-content { flex: 1 0 auto; display: grid; grid-template-areas: 'leadingVisual text trailingVisual'; grid-template-columns: min-content minmax(0, auto) min-content; align-items: center; place-content: center; /* padding-bottom: 1px; optical alignment for firefox */}.Button-content > :not(:last-child) { margin-right: var(--control-medium-gap); }/* center child elements for fullWidth */.Button-content--alignStart { justify-content: start;}/* button child elements *//* align svg */.Button-visual { display: flex; pointer-events: none; /* allow click handler to work, avoiding visuals */}.Button-visual .Counter { color: inherit; background-color: var(--buttonCounter-default-bgColor-rest); }.Button-label { line-height: var(--text-body-lineHeight-medium); white-space: nowrap; grid-area: text;}.Button-leadingVisual { grid-area: leadingVisual;}.Button-leadingVisual svg { fill: currentcolor;}.Button-trailingVisual { grid-area: trailingVisual;}.Button-trailingAction { margin-right: calc(var(--base-size-4) * -1);}/* sizes */.Button--small { min-width: var(--control-small-size); height: var(--control-small-size); padding: 0 var(--control-small-paddingInline-condensed); font-size: var(--text-body-size-small); gap: var(--control-small-gap);}.Button--small .Button-label { line-height: var(--text-body-lineHeight-small); }:is(.Button--small .Button-content) > :not(:last-child) { margin-right: var(--control-small-gap); }.Button--large { height: var(--control-large-size); padding: 0 var(--control-large-paddingInline-spacious); gap: var(--control-large-gap);}.Button--large .Button-label { line-height: var(--text-body-lineHeight-large); }:is(.Button--large .Button-content) > :not(:last-child) { margin-right: var(--control-large-gap); }.Button--fullWidth { width: 100%;}/* allow button label text to wrap */.Button--labelWrap { min-width: -moz-fit-content; min-width: fit-content; height: unset; min-height: var(--control-medium-size);}.Button--labelWrap .Button-content { flex: 1 1 auto; align-self: stretch; padding-block: calc(var(--control-medium-paddingBlock) - var(--base-size-2)); }.Button--labelWrap .Button-label { white-space: unset; }.Button--labelWrap.Button--small { height: unset; min-height: var(--control-small-size); }.Button--labelWrap.Button--small .Button-content { padding-block: calc(var(--control-small-paddingBlock) - var(--base-size-2)); }.Button--labelWrap.Button--large { height: unset; min-height: var(--control-large-size); padding-inline: var(--control-large-paddingInline-spacious); }.Button--labelWrap.Button--large .Button-content { padding-block: calc(var(--control-large-paddingBlock) - var(--base-size-2)); }/* variants *//* primary */.Button--primary { color: var(--button-primary-fgColor-rest); fill: var(--button-primary-iconColor-rest); background-color: var(--button-primary-bgColor-rest); border-color: var(--button-primary-borderColor-rest); box-shadow: var(--shadow-resting-small, var(--color-btn-primary-shadow));}.Button--primary.Button--iconOnly { color: var(--button-primary-iconColor-rest); }.Button--primary:hover:not(:disabled,.Button--inactive) { background-color: var(--button-primary-bgColor-hover); border-color: var(--button-primary-borderColor-hover); }/* fallback :focus state */.Button--primary:focus { outline: 2px solid var(--focus-outlineColor); outline-offset: -2px; box-shadow: inset 0 0 0 3px var(--fgColor-onEmphasis); /* remove fallback :focus if :focus-visible is supported */ }.Button--primary:focus:not(:focus-visible) { outline: solid 1px transparent; box-shadow: none; }/* default focus state */.Button--primary:focus-visible { outline: 2px solid var(--focus-outlineColor); outline-offset: -2px; box-shadow: inset 0 0 0 3px var(--fgColor-onEmphasis); }.Button--primary:active:not(:disabled),.Button--primary[aria-pressed='true'] { background-color: var(--button-primary-bgColor-active); box-shadow: var(--button-primary-shadow-selected); }.Button--primary:disabled,.Button--primary[aria-disabled='true'] { color: var(--button-primary-fgColor-disabled); fill: var(--button-primary-fgColor-disabled); background-color: var(--button-primary-bgColor-disabled); border-color: var(--button-primary-borderColor-disabled); }.Button--primary .Counter { color: inherit; background-color: var(--buttonCounter-primary-bgColor-rest); }/* default (secondary) */.Button--secondary { color: var(--button-default-fgColor-rest); fill: var(--fgColor-muted); /* help this */ background-color: var(--button-default-bgColor-rest); border-color: var(--button-default-borderColor-rest); box-shadow: var(--button-default-shadow-resting), var(--button-default-shadow-inset);}.Button--secondary:hover:not(:disabled,.Button--inactive) { background-color: var(--button-default-bgColor-hover); border-color: var(--button-default-borderColor-hover); }.Button--secondary:active:not(:disabled) { background-color: var(--button-default-bgColor-active); border-color: var(--button-default-borderColor-active); }.Button--secondary[aria-pressed='true'] { background-color: var(--button-default-bgColor-selected); box-shadow: var(--shadow-inset); }.Button--secondary:disabled,.Button--secondary[aria-disabled='true'] { color: var(--control-fgColor-disabled); fill: var(--control-fgColor-disabled); background-color: var(--button-default-bgColor-disabled); border-color: var(--button-default-borderColor-disabled); }.Button--invisible { color: var(--button-invisible-fgColor-rest);}.Button--invisible.Button--iconOnly { color: var(--button-invisible-iconColor-rest, var(--color-fg-muted)); }.Button--invisible:hover:not(:disabled,.Button--inactive) { background-color: var(--control-transparent-bgColor-hover, var(--color-action-list-item-default-hover-bg)); }.Button--invisible[aria-pressed='true'],.Button--invisible:active:not(:disabled) { background-color: var(--button-invisible-bgColor-active); }.Button--invisible:disabled,.Button--invisible[aria-disabled='true'] { color: var(--button-invisible-fgColor-disabled); fill: var(--button-invisible-fgColor-disabled); background-color: var(--button-invisible-bgColor-disabled); border-color: var(--button-invisible-borderColor-disabled); }/* if button has no visuals, use link blue for text */.Button--invisible.Button--invisible-noVisuals .Button-label { color: var(--button-invisible-fgColor-rest); }.Button--invisible .Button-visual { color: var(--button-invisible-iconColor-rest, var(--color-fg-muted)); }:is(.Button--invisible .Button-visual) .Counter { color: var(--fgColor-default); }.Button--link { display: inline-block; min-width: -moz-fit-content; min-width: fit-content; height: unset; padding: 0; font-size: inherit; color: var(--fgColor-link); fill: var(--fgColor-link); border: none;}.Button--link:hover:not(:disabled,.Button--inactive) { -webkit-text-decoration: underline; text-decoration: underline; }.Button--link:focus-visible,.Button--link:focus { outline-offset: 2px; }.Button--link:disabled,.Button--link[aria-disabled='true'] { color: var(--control-fgColor-disabled); fill: var(--control-fgColor-disabled); background-color: transparent; border-color: transparent; }.Button--link .Button-label { white-space: unset; }/* danger */.Button--danger { color: var(--button-danger-fgColor-rest); fill: var(--button-danger-iconColor-rest); background-color: var(--button-danger-bgColor-rest); border-color: var(--button-danger-borderColor-rest); box-shadow: var(--button-default-shadow-resting), var(--button-default-shadow-inset);}.Button--danger.Button--iconOnly { color: var(--button-danger-iconColor-rest); }.Button--danger:hover:not(:disabled,.Button--inactive) { color: var(--button-danger-fgColor-hover); fill: var(--button-danger-fgColor-hover); background-color: var(--button-danger-bgColor-hover); border-color: var(--button-danger-borderColor-hover); box-shadow: var(--shadow-resting-small); }.Button--danger:hover:not(:disabled,.Button--inactive) .Counter { color: var(--buttonCounter-danger-fgColor-hover); background-color: var(--buttonCounter-danger-bgColor-hover); }.Button--danger:active:not(:disabled),.Button--danger[aria-pressed='true'] { color: var(--button-danger-fgColor-active); fill: var(--button-danger-fgColor-active); background-color: var(--button-danger-bgColor-active); border-color: var(--button-danger-borderColor-active); box-shadow: var(--button-danger-shadow-selected); }.Button--danger:disabled,.Button--danger[aria-disabled='true'] { color: var(--button-danger-fgColor-disabled); fill: var(--button-danger-fgColor-disabled); background-color: var(--button-danger-bgColor-disabled); border-color: var(--button-default-borderColor-disabled); }:is(.Button--danger:disabled,.Button--danger[aria-disabled='true']) .Counter { color: var(--buttonCounter-danger-fgColor-disabled); background-color: var(--buttonCounter-danger-bgColor-disabled); }.Button--danger .Counter { color: var(--buttonCounter-danger-fgColor-rest); background-color: var(--buttonCounter-danger-bgColor-rest); }.Button--iconOnly { display: inline-grid; width: var(--control-medium-size); padding: unset; place-content: center;}.Button--iconOnly.Button--small { width: var(--control-small-size); }.Button--iconOnly.Button--large { width: var(--control-large-size); }/* `disabled` takes precedence over `inactive` */.Button--inactive:not([aria-disabled='true'], :disabled) { color: var(--button-inactive-fgColor); cursor: default; background-color: var(--button-inactive-bgColor); border: 0;}