@@ -15,21 +15,23 @@ Use the standard—yet classy—`.btn` for form actions and primary page actions
1515When using a ` <button> ` element, ** always specify a ` type ` ** . When using a ` <a> ` element, ** always add ` role="button" ` for accessibility** .
1616
1717``` html live
18- <button class =" btn" type =" button" >Button button</button > <a class =" btn" href =" #url" role =" button" >Link button</a >
18+ <button class =" btn mr-2" type =" button" >Button button</button >
19+ <a class =" btn" href =" #url" role =" button" >Link button</a >
1920```
2021
2122You can find them in two sizes: the default ` .btn ` and the smaller ` .btn-sm ` .
2223
2324``` html live
24- <button class =" btn" type =" button" >Button</button > <button class =" btn btn-sm" type =" button" >Small button</button >
25+ <button class =" btn mr-2" type =" button" >Button</button >
26+ <button class =" btn btn-sm" type =" button" >Small button</button >
2527```
2628
2729## Primary button
2830
2931Primary buttons are green and are used to indicate the _ primary_ action on a page. When you need your buttons to stand out, use ` .btn.btn-primary ` . You can use it with both button sizes—just add ` .btn-primary ` .
3032
3133``` html live
32- <button class =" btn btn-primary" type =" button" >Primary button</button >
34+ <button class =" btn btn-primary mr-2 " type =" button" >Primary button</button >
3335<button class =" btn btn-sm btn-primary" type =" button" >Small primary button</button >
3436```
3537
@@ -38,7 +40,7 @@ Primary buttons are green and are used to indicate the _primary_ action on a pag
3840Danger buttons are red. They help reiterate that the intended action is important or potentially dangerous (e.g., deleting a repo or transferring ownership). Similar to the primary buttons, just add ` .btn-danger ` .
3941
4042``` html live
41- <button class =" btn btn-danger" type =" button" >Danger button</button >
43+ <button class =" btn btn-danger mr-2 " type =" button" >Danger button</button >
4244<button class =" btn btn-sm btn-danger" type =" button" >Small danger button</button >
4345```
4446
@@ -47,7 +49,7 @@ Danger buttons are red. They help reiterate that the intended action is importan
4749Outline buttons downplay an action as they appear like boxy links. Just add ` .btn-outline ` and go.
4850
4951``` html live
50- <button class =" btn btn-outline" type =" button" >Outline button</button >
52+ <button class =" btn btn-outline mr-2 " type =" button" >Outline button</button >
5153<button class =" btn btn-sm btn-outline" type =" button" >Outline button</button >
5254```
5355
@@ -58,44 +60,42 @@ Use `.btn-large` to increase the padding and border radius of a button. This is
5860[ Type scale utilities] ( https://styleguide.github.com/primer/utilities/typography/#type-scale-utilities ) can be used to alter the font-size if needed. Padding is applied in em's so that it scales proportionally with the font-size.
5961
6062``` html live
61- <p >
62- <a class =" btn btn-large" href =" #url" role =" button" >Large link button</a >
63- <button class =" btn btn-large" type =" button" >Large button button</button >
64- </p >
63+ <button class =" btn btn-large mr-2" type =" button" >Large button</button >
64+ <a class =" btn btn-large" href =" #url" role =" button" >Large link button</a >
6565```
6666
6767Use ` .btn-large ` with a type scale utility to transform the text to a bigger size.
6868
6969``` html live
70- <p class =" f3" >
70+ <div class =" f3" >
71+ <button class =" btn btn-large btn-outline-blue mr-2" type =" button" >Large button button</button >
7172 <a class =" btn btn-large" href =" #url" role =" button" >Large link button</a >
72- <button class =" btn btn-large btn-outline-blue" type =" button" >Large button button</button >
73- </p >
73+ </div >
7474```
7575
7676## Disabled state
7777
7878Disable ` <button> ` elements with the boolean ` disabled ` attribute and ` <a> ` elements with the ` .disabled ` class.
7979
8080``` html live
81- <button class =" btn" type =" button" disabled >Disabled button</button >
81+ <button class =" btn mr-2 " type =" button" disabled >Disabled button</button >
8282<a class =" btn disabled" href =" #url" role =" button" >Disabled button</a >
8383```
8484
8585Similar styles are applied to primary, danger, and outline buttons:
8686
8787``` html live
88- <button class =" btn btn-primary" type =" button" disabled >Disabled button</button >
88+ <button class =" btn btn-primary mr-2 " type =" button" disabled >Disabled button</button >
8989<a class =" btn btn-primary disabled" href =" #url" role =" button" >Disabled button</a >
9090```
9191
9292``` html live
93- <button class =" btn btn-danger" type =" button" disabled >Disabled button</button >
93+ <button class =" btn btn-danger mr-2 " type =" button" disabled >Disabled button</button >
9494<a class =" btn btn-danger disabled" href =" #url" role =" button" >Disabled button</a >
9595```
9696
9797``` html live
98- <button class =" btn btn-outline" type =" button" disabled >Disabled button</button >
98+ <button class =" btn btn-outline mr-2 " type =" button" disabled >Disabled button</button >
9999<a class =" btn btn-outline disabled" href =" #url" role =" button" >Disabled button</a >
100100```
101101
@@ -104,8 +104,8 @@ Similar styles are applied to primary, danger, and outline buttons:
104104Make any button full-width by adding ` .btn-block ` . It adds ` width: 100%; ` , changes the ` display ` from ` inline-block ` to ` block ` , and centers the button text.
105105
106106``` html live
107- <p >< button class =" btn btn-block" type =" button" >Block button</button ></ p >
108- <p >< button class =" btn btn-sm btn-block" type =" button" >Small block button</button ></ p >
107+ <button class =" btn btn-block mb-2 " type =" button" >Block button</button >
108+ <button class =" btn btn-sm btn-block" type =" button" >Small block button</button >
109109```
110110
111111## Link button
@@ -115,7 +115,55 @@ Create a button that looks like a link with `.btn-link`. Rather than using an `<
115115** The ` .btn-link ` class is not designed to be used with ` .btn ` ; the overlapping styles are not compatible.**
116116
117117``` html live
118- <p ><button class =" btn-link" type =" button" >Link button</button ></p >
118+ <button class =" btn-link" type =" button" >Link button</button >
119+ ```
120+
121+ ## Invisible button
122+
123+ When you want a link, but you want it padded and line heighted like a button best for "cancel" actions on forms.
124+
125+ ``` html live
126+ <button class =" btn btn-invisible" type =" button" >Cancel</button >
127+ <button class =" btn" type =" button" >Submit</button >
128+ ```
129+
130+ ## Octicon button
131+
132+ Icon-only buttons that turn blue on hover. Use ` .btn-octicon-danger ` to turn an icon red on hover.
133+
134+ ``` html live
135+ <button class =" btn-octicon" type =" button" aria-label =" Desktop icon" >
136+ <!-- <%= octicon "device-desktop" %> -->
137+ <svg class =" octicon octicon-device-desktop" viewBox =" 0 0 16 16" version =" 1.1" width =" 16" height =" 16" aria-hidden =" true" ><path fill-rule =" evenodd" d =" M15 2H1c-.55 0-1 .45-1 1v9c0 .55.45 1 1 1h5.34c-.25.61-.86 1.39-2.34 2h8c-1.48-.61-2.09-1.39-2.34-2H15c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm0 9H1V3h14v8z" ></path ></svg >
138+ </button >
139+
140+ <button class =" btn-octicon" type =" button" aria-label =" Pencil icon" >
141+ <!-- <%= octicon "pencil" %> -->
142+ <svg class =" octicon octicon-pencil" viewBox =" 0 0 14 16" version =" 1.1" width =" 14" height =" 16" aria-hidden =" true" ><path fill-rule =" evenodd" d =" M0 12v3h3l8-8-3-3-8 8zm3 2H1v-2h1v1h1v1zm10.3-9.3L12 6 9 3l1.3-1.3a.996.996 0 011.41 0l1.59 1.59c.39.39.39 1.02 0 1.41z" ></path ></svg >
143+ </button >
144+
145+ <button class =" btn-octicon btn-octicon-danger" type =" button" aria-label =" Trashcan icon" >
146+ <!-- <%= octicon "trashcan" %> -->
147+ <svg class =" octicon octicon-trashcan" viewBox =" 0 0 12 16" version =" 1.1" width =" 12" height =" 16" aria-hidden =" true" ><path fill-rule =" evenodd" d =" M11 2H9c0-.55-.45-1-1-1H5c-.55 0-1 .45-1 1H2c-.55 0-1 .45-1 1v1c0 .55.45 1 1 1v9c0 .55.45 1 1 1h7c.55 0 1-.45 1-1V5c.55 0 1-.45 1-1V3c0-.55-.45-1-1-1zm-1 12H3V5h1v8h1V5h1v8h1V5h1v8h1V5h1v9zm1-10H2V3h9v1z" ></path ></svg >
148+ </button >
149+
150+ <button class =" btn-octicon" type =" button" aria-label =" Trashcan icon" >
151+ <!-- <%= octicon "kebab-horizontal" %> -->
152+ <svg class =" octicon octicon-kebab-horizontal" viewBox =" 0 0 13 16" version =" 1.1" width =" 13" height =" 16" aria-hidden =" true" ><path fill-rule =" evenodd" d =" M1.5 9a1.5 1.5 0 100-3 1.5 1.5 0 000 3zm5 0a1.5 1.5 0 100-3 1.5 1.5 0 000 3zM13 7.5a1.5 1.5 0 11-3 0 1.5 1.5 0 013 0z" ></path ></svg >
153+ </button >
154+ ```
155+
156+
157+
158+ ## Close button
159+
160+ When using the ` octicon-x ` icon for a close button, add ` .close-button ` to remove the default button styles.
161+
162+ ``` html live
163+ <button class =" close-button" type =" button" >
164+ <!-- <%= octicon "x" %> -->
165+ <svg width =" 12" height =" 16" viewBox =" 0 0 12 16" class =" octicon octicon-x" aria-hidden =" true" ><path fill-rule =" evenodd" d =" M7.48 8l3.75 3.75-1.48 1.48L6 9.48l-3.75 3.75-1.48-1.48L4.52 8 .77 4.25l1.48-1.48L6 6.52l3.75-3.75 1.48 1.48L7.48 8z" /></svg >
166+ </button >
119167```
120168
121169## Button with counts
@@ -138,24 +186,20 @@ You can easily append a count to a **small button**. Add the `.with-count` class
138186You can also use the [ counter] ( ./labels#counters ) component within buttons:
139187
140188``` html live
141- <button class =" btn" type =" button" >
142- Button
143- <span class =" Counter" >12</span >
189+ <button class =" btn mr-2" type =" button" >
190+ Button <span class =" Counter" >12</span >
144191</button >
145192
146- <button class =" btn btn-primary" type =" button" >
147- Button
148- <span class =" Counter" >12</span >
193+ <button class =" btn btn-primary mr-2" type =" button" >
194+ Button <span class =" Counter" >12</span >
149195</button >
150196
151- <button class =" btn btn-danger" type =" button" >
152- Button
153- <span class =" Counter" >12</span >
197+ <button class =" btn btn-danger mr-2" type =" button" >
198+ Button <span class =" Counter" >12</span >
154199</button >
155200
156201<button class =" btn btn-outline" type =" button" >
157- Button
158- <span class =" Counter" >12</span >
202+ Button <span class =" Counter" >12</span >
159203</button >
160204```
161205
@@ -207,21 +251,3 @@ Use `.hidden-text-expander` to indicate and toggle hidden text.
207251```
208252
209253You can also make the expander appear inline by adding ` .inline ` .
210-
211- ## Using button styles with the details summary element
212-
213- You can add ` .btn ` and ` .btn-* ` classes to any
214- [ ` <summary> ` ] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/summary )
215- element so that it gains the appearance of a button, and
216- selected/active styles when the parent
217- [ ` <details> ` ] ( https://developer.mozilla.org/en-US/docs/Web/HTML/Element/details )
218- element is open.
219-
220- ``` html live
221- <details >
222- <summary class =" btn btn-block btn-primary" >Toggle the content</summary >
223- <p class =" mt-2" >
224- This content will be toggled.
225- </p >
226- </details >
227- ```
0 commit comments