Policy 1707 commit to LF
[policy/engine.git] / POLICY-SDK-APP / src / main / webapp / app / policyApp / CSS / bootstrap / docs / _includes / css / buttons.html
1 <div class="bs-docs-section">
2   <h1 id="buttons" class="page-header">Buttons</h1>
3
4   <h2 id="buttons-tags">Button tags</h2>
5   <p>Use the button classes on an <code>&lt;a&gt;</code>, <code>&lt;button&gt;</code>, or <code>&lt;input&gt;</code> element.</p>
6   <form class="bs-example" data-example-id="btn-tags">
7     <a class="btn btn-default" href="#" role="button">Link</a>
8     <button class="btn btn-default" type="submit">Button</button>
9     <input class="btn btn-default" type="button" value="Input">
10     <input class="btn btn-default" type="submit" value="Submit">
11   </form>
12 {% highlight html %}
13 <a class="btn btn-default" href="#" role="button">Link</a>
14 <button class="btn btn-default" type="submit">Button</button>
15 <input class="btn btn-default" type="button" value="Input">
16 <input class="btn btn-default" type="submit" value="Submit">
17 {% endhighlight %}
18
19   <div class="bs-callout bs-callout-warning" id="callout-buttons-context-usage">
20     <h4>Context-specific usage</h4>
21     <p>While button classes can be used on <code>&lt;a&gt;</code> and <code>&lt;button&gt;</code> elements, only <code>&lt;button&gt;</code> elements are supported within our nav and navbar components.</p>
22   </div>
23
24   <div class="bs-callout bs-callout-warning" id="callout-buttons-anchor-accessibility">
25     <h4>Links acting as buttons</h4>
26     <p>If the <code>&lt;a&gt;</code> elements are used to act as buttons – triggering in-page functionality, rather than navigating to another document or section within the current page – they should also be given an appropriate <code>role="button"</code>.</p>
27   </div>
28
29   <div class="bs-callout bs-callout-warning" id="callout-buttons-ff-height">
30     <h4>Cross-browser rendering</h4>
31     <p>As a best practice, <strong>we highly recommend using the <code>&lt;button&gt;</code> element whenever possible</strong> to ensure matching cross-browser rendering.</p>
32     <p>Among other things, there's <a href="https://bugzilla.mozilla.org/show_bug.cgi?id=697451">a bug in Firefox &lt;30</a> that prevents us from setting the <code>line-height</code> of <code>&lt;input&gt;</code>-based buttons, causing them to not exactly match the height of other buttons on Firefox.</p>
33   </div>
34
35   <h2 id="buttons-options">Options</h2>
36   <p>Use any of the available button classes to quickly create a styled button.</p>
37   <div class="bs-example" data-example-id="btn-variants">
38     <button type="button" class="btn btn-default">Default</button>
39     <button type="button" class="btn btn-primary">Primary</button>
40     <button type="button" class="btn btn-success">Success</button>
41     <button type="button" class="btn btn-info">Info</button>
42     <button type="button" class="btn btn-warning">Warning</button>
43     <button type="button" class="btn btn-danger">Danger</button>
44     <button type="button" class="btn btn-link">Link</button>
45   </div>
46 {% highlight html %}
47 <!-- Standard button -->
48 <button type="button" class="btn btn-default">Default</button>
49
50 <!-- Provides extra visual weight and identifies the primary action in a set of buttons -->
51 <button type="button" class="btn btn-primary">Primary</button>
52
53 <!-- Indicates a successful or positive action -->
54 <button type="button" class="btn btn-success">Success</button>
55
56 <!-- Contextual button for informational alert messages -->
57 <button type="button" class="btn btn-info">Info</button>
58
59 <!-- Indicates caution should be taken with this action -->
60 <button type="button" class="btn btn-warning">Warning</button>
61
62 <!-- Indicates a dangerous or potentially negative action -->
63 <button type="button" class="btn btn-danger">Danger</button>
64
65 <!-- Deemphasize a button by making it look like a link while maintaining button behavior -->
66 <button type="button" class="btn btn-link">Link</button>
67 {% endhighlight %}
68
69   <div class="bs-callout bs-callout-warning" id="callout-buttons-color-accessibility">
70     <h4>Conveying meaning to assistive technologies</h4>
71     <p>Using color to add meaning to a button only provides a visual indication, which will not be conveyed to users of assistive technologies – such as screen readers. Ensure that information denoted by the color is either obvious from the content itself (the visible text of the button), or is included through alternative means, such as additional text hidden with the <code>.sr-only</code> class.</p>
72   </div>
73
74   <h2 id="buttons-sizes">Sizes</h2>
75   <p>Fancy larger or smaller buttons? Add <code>.btn-lg</code>, <code>.btn-sm</code>, or <code>.btn-xs</code> for additional sizes.</p>
76   <div class="bs-example" data-example-id="btn-sizes">
77     <p>
78       <button type="button" class="btn btn-primary btn-lg">Large button</button>
79       <button type="button" class="btn btn-default btn-lg">Large button</button>
80     </p>
81     <p>
82       <button type="button" class="btn btn-primary">Default button</button>
83       <button type="button" class="btn btn-default">Default button</button>
84     </p>
85     <p>
86       <button type="button" class="btn btn-primary btn-sm">Small button</button>
87       <button type="button" class="btn btn-default btn-sm">Small button</button>
88     </p>
89     <p>
90       <button type="button" class="btn btn-primary btn-xs">Extra small button</button>
91       <button type="button" class="btn btn-default btn-xs">Extra small button</button>
92     </p>
93   </div>
94 {% highlight html %}
95 <p>
96   <button type="button" class="btn btn-primary btn-lg">Large button</button>
97   <button type="button" class="btn btn-default btn-lg">Large button</button>
98 </p>
99 <p>
100   <button type="button" class="btn btn-primary">Default button</button>
101   <button type="button" class="btn btn-default">Default button</button>
102 </p>
103 <p>
104   <button type="button" class="btn btn-primary btn-sm">Small button</button>
105   <button type="button" class="btn btn-default btn-sm">Small button</button>
106 </p>
107 <p>
108   <button type="button" class="btn btn-primary btn-xs">Extra small button</button>
109   <button type="button" class="btn btn-default btn-xs">Extra small button</button>
110 </p>
111 {% endhighlight %}
112
113   <p>Create block level buttons&mdash;those that span the full width of a parent&mdash; by adding <code>.btn-block</code>.</p>
114   <div class="bs-example" data-example-id="block-btns">
115     <div class="well center-block" style="max-width: 400px;">
116       <button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
117       <button type="button" class="btn btn-default btn-lg btn-block">Block level button</button>
118     </div>
119   </div>
120 {% highlight html %}
121 <button type="button" class="btn btn-primary btn-lg btn-block">Block level button</button>
122 <button type="button" class="btn btn-default btn-lg btn-block">Block level button</button>
123 {% endhighlight %}
124
125
126   <h2 id="buttons-active">Active state</h2>
127   <p>Buttons will appear pressed (with a darker background, darker border, and inset shadow) when active. For <code>&lt;button&gt;</code> elements, this is done via <code>:active</code>. For <code>&lt;a&gt;</code> elements, it's done with <code>.active</code>. However, you may use <code>.active</code> on <code>&lt;button&gt;</code>s (and include the <code>aria-pressed="true"</code> attribute) should you need to replicate the active state programmatically.</p>
128
129   <h3>Button element</h3>
130   <p>No need to add <code>:active</code> as it's a pseudo-class, but if you need to force the same appearance, go ahead and add <code>.active</code>.</p>
131   <p class="bs-example" data-example-id="active-button-btns">
132     <button type="button" class="btn btn-primary btn-lg active">Primary button</button>
133     <button type="button" class="btn btn-default btn-lg active">Button</button>
134   </p>
135 {% highlight html %}
136 <button type="button" class="btn btn-primary btn-lg active">Primary button</button>
137 <button type="button" class="btn btn-default btn-lg active">Button</button>
138 {% endhighlight %}
139
140   <h3>Anchor element</h3>
141   <p>Add the <code>.active</code> class to <code>&lt;a&gt;</code> buttons.</p>
142   <p class="bs-example" data-example-id="active-anchor-btns">
143     <a href="#" class="btn btn-primary btn-lg active" role="button">Primary link</a>
144     <a href="#" class="btn btn-default btn-lg active" role="button">Link</a>
145   </p>
146 {% highlight html %}
147 <a href="#" class="btn btn-primary btn-lg active" role="button">Primary link</a>
148 <a href="#" class="btn btn-default btn-lg active" role="button">Link</a>
149 {% endhighlight %}
150
151
152   <h2 id="buttons-disabled">Disabled state</h2>
153   <p>Make buttons look unclickable by fading them back with <code>opacity</code>.</p>
154
155   <h3>Button element</h3>
156   <p>Add the <code>disabled</code> attribute to <code>&lt;button&gt;</code> buttons.</p>
157   <p class="bs-example" data-example-id="disabled-button-btns">
158     <button type="button" class="btn btn-primary btn-lg" disabled="disabled">Primary button</button>
159     <button type="button" class="btn btn-default btn-lg" disabled="disabled">Button</button>
160   </p>
161 {% highlight html %}
162 <button type="button" class="btn btn-lg btn-primary" disabled="disabled">Primary button</button>
163 <button type="button" class="btn btn-default btn-lg" disabled="disabled">Button</button>
164 {% endhighlight %}
165
166   <div class="bs-callout bs-callout-danger" id="callout-buttons-ie-disabled">
167     <h4>Cross-browser compatibility</h4>
168     <p>If you add the <code>disabled</code> attribute to a <code>&lt;button&gt;</code>, Internet Explorer 9 and below will render text gray with a nasty text-shadow that we cannot fix.</p>
169   </div>
170
171   <h3>Anchor element</h3>
172   <p>Add the <code>.disabled</code> class to <code>&lt;a&gt;</code> buttons.</p>
173   <p class="bs-example" data-example-id="disabled-anchor-btns">
174     <a href="#" class="btn btn-primary btn-lg disabled" role="button">Primary link</a>
175     <a href="#" class="btn btn-default btn-lg disabled" role="button">Link</a>
176   </p>
177 {% highlight html %}
178 <a href="#" class="btn btn-primary btn-lg disabled" role="button">Primary link</a>
179 <a href="#" class="btn btn-default btn-lg disabled" role="button">Link</a>
180 {% endhighlight %}
181   <p>
182     We use <code>.disabled</code> as a utility class here, similar to the common <code>.active</code> class, so no prefix is required.
183   </p>
184   <div class="bs-callout bs-callout-warning" id="callout-buttons-disabled-anchor">
185     <h4>Link functionality caveat</h4>
186     <p>This class uses <code>pointer-events: none</code> to try to disable the link functionality of <code>&lt;a&gt;</code>s, but that CSS property is not yet standardized and isn't fully supported in Opera 18 and below, or in Internet Explorer 11. In addition, even in browsers that do support <code>pointer-events: none</code>, keyboard navigation remains unaffected, meaning that sighted keyboard users and users of assistive technologies will still be able to activate these links. So to be safe, use custom JavaScript to disable such links.</p>
187   </div>
188
189 </div>