You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: articles/components/button/index.adoc
+31-11Lines changed: 31 additions & 11 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
tab-title: Usage
3
3
layout: tabbed-page
4
4
title: Button
5
-
page-title: Button component | Vaadin components
6
-
description: The Button component allows users to perform actions. It comes in several different style variants and supports icons as well as text labels.
7
-
meta-description: The Vaadin component Button allows users to perform actions. It comes in several different style variants and supports icons as well as text labels.
5
+
page-title: Button Component | Vaadin Components
6
+
description: The Button component allows users to perform actions. It comes in several different style variants and supports icons, as well as text labels.
7
+
meta-description: The Vaadin component Button allows users to perform actions. It comes in several different style variants and supports icons, as well as text labels.
Primary danger buttons should only be used when a dangerous action is the most likely action. An example of this would be the affirmative *Delete* action in a deletion confirmation dialog. Secondary and Tertiary variants can be used for actions related to current errors, such as resolving them or viewing their details.
The following size variants are available for Button instances whose size needs to be different from the default:
@@ -291,7 +293,6 @@ The *Tertiary + Contrast* combination should be avoided because of similarity to
291
293
The standard Button colors can be adjusted using <<{articles}/styling/lumo/lumo-style-properties/color#,the Lumo color properties>>. Therefore, these variants shouldn't be used to replace standard buttons only to achieve a different color.
292
294
293
295
294
-
295
296
== Buttons with Icons
296
297
297
298
Buttons can have icons instead of text, or they can have icons along with text.
@@ -332,7 +333,6 @@ Additionally, [since:com.vaadin:vaadin@V23.3]##<<../tooltip#,tooltips>>## can be
332
333
Use the `icon` / `LUMO_ICON` theme variant on icon-only buttons to reduce the white space on either side of the icon. The Flow `Button` component automatically applies the `icon` variant if the icon is the only child of the component.
333
334
334
335
335
-
336
336
== Buttons with Images
337
337
338
338
Images on buttons can be used like icons. See the icon usage recommendations for more information.
@@ -365,7 +365,7 @@ endif::[]
365
365
366
366
== Disabled
367
367
368
-
Buttons representing actions that aren't currently available to the user should be either hidden or disabled. A disabled button is rendered as "dimmed", and is excluded from the focus order. This may be useful when you don't want interactive UI elements to receive the focus using the tab key.
368
+
Buttons representing actions that aren't currently available to the user should be either hidden or disabled. A disabled button is rendered as "dimmed".
369
369
370
370
[.example]
371
371
--
@@ -393,14 +393,33 @@ endif::[]
393
393
--
394
394
395
395
396
-
=== Hidden vs. Disabled
396
+
=== Focus & Hover
397
397
398
-
Hiding entirely an unavailable action is often preferable to a disabled button, as this reduces UI clutter. However, in certain situations, this can be problematic. If the user expects a button to be present -- such as at the end of a form -- hiding the button can cause confusion, even if the form clearly shows the presence of one or more invalid fields. Also, since a hidden button doesn't occupy any space in the UI, toggling its visibility can cause unwanted changes in the layout of other elements.
398
+
By default, disabled buttons are not focusable and cannot react to hover events. This can cause accessibility issues by making them entirely invisible to assistive technologies, and prevents the use of Tooltips to explain why the action is not available. This can be addressed by enabling the feature flag `accessibleDisabledButtons`, which allows you to focus and hover on disabled buttons, while preventing them from being triggered:
399
399
400
+
[.example]
401
+
--
402
+
.`Flow`
403
+
[source,properties]
404
+
----
405
+
# Add this line to src/main/resources/vaadin-featureflags.properties
As an alternative to hiding or disabling buttons, configure instead unavailable actions to show an error message when the button is clicked by using a <<../notification/index#,Notification>> or an adjacent inline text element. This approach is the most accessible option, but may be frustrating to users who expect unavailable actions to be distinguished somehow from available actions.
420
+
The most obvious alternative to disabling a button is to hide it. This reduces UI clutter, but can cause confusion since the user won't know where to watch for the button once the action it represents becomes available. There's also a risk of undesired layout shifts in the UI when the button appears.
421
+
422
+
Another option is to keep the button visible and enabled, but show an error, e.g. using a Notification, when it's clicked. This option is best combined with some custom styling of the button to give the user a hint that the action is unavailable.
404
423
405
424
406
425
=== Prevent Multiple Clicks
@@ -433,7 +452,6 @@ endif::[]
433
452
--
434
453
435
454
436
-
437
455
== Focus
438
456
439
457
As with other components, the focus ring is only rendered when the button is focused by keyboard or programmatically.
Buttons in forms should be placed below the form with which they're associated. They should be aligned left, with the primary action first, followed by other actions, in order of importance.
Copy file name to clipboardExpand all lines: articles/components/menu-bar/index.adoc
+22-3Lines changed: 22 additions & 3 deletions
Original file line number
Diff line number
Diff line change
@@ -2,9 +2,9 @@
2
2
tab-title: Usage
3
3
layout: tabbed-page
4
4
title: Menu Bar
5
-
page-title: Menu Bar component | Vaadin components
5
+
page-title: Menu Bar Component | Vaadin Components
6
6
description: Menu Bar is a horizontal button bar with hierarchical drop-down menus.
7
-
meta-description: Learn how to implement the Vaadin Menu Bar component in your Vaadin applications and how you can customize it for a better user experience.
7
+
meta-description: Learn how to implement the Vaadin Menu Bar component in Vaadin applications and how you can customize it for a better user experience.
In versions prior to 24.3, theme names must be used instead of class names (`theme` property / `addThemeNames` Java method). The CSS syntax for targeting a theme name is `[theme~="custom-theme"]`
By default, disabled buttons (i.e., root-level items) are not focusable and cannot react to hover events. This can cause accessibility issues by making them entirely invisible to assistive technologies, and prevents the use of Tooltips to explain why the action is not available. This can be addressed by enabling the feature flag `accessibleDisabledButtons`, which allows focusing and hovering on disabled buttons, while preventing them from being triggered:
335
+
336
+
[.example]
337
+
--
338
+
.`Flow`
339
+
[source,properties]
340
+
----
341
+
# Add this line to src/main/resources/vaadin-featureflags.properties
0 commit comments