Skip to content

Commit 33656e2

Browse files
docs: document LONGSWIPE variant in README and Javadoc
1 parent 6af7352 commit 33656e2

2 files changed

Lines changed: 22 additions & 1 deletion

File tree

README.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,8 @@ A toggle button component for Vaadin Flow that supports customizable labels and
1414
* Customizable left and right labels
1515
* Support for icons on both sides via slots
1616
* Optional label highlighting: active-side label uses the primary color, inactive side is dimmed
17-
* Theme variants: `SMALL`, `MEDIUM`, `LARGE`, `PRIMARY`, `SUCCESS`, `WARNING`, `ERROR`, `CONTRAST`
17+
* Theme variants: `SMALL`, `MEDIUM`, `LARGE`, `LONGSWIPE`, `PRIMARY`, `SUCCESS`, `WARNING`, `ERROR`, `CONTRAST`
18+
* `LONGSWIPE` variant produces a wider switch track, optimized for touch interaction; can be combined with size variants
1819
* Fluent API for easy configuration
1920
* Full integration with Vaadin's `HasValue`, `HasSize`, `HasLabel`, `HasAriaLabel`, and `HasTooltip`
2021

@@ -131,6 +132,10 @@ FCToggleButton toggle = new FCToggleButton()
131132
// Apply theme variants
132133
toggle.addThemeVariants(FCToggleButtonVariant.PRIMARY);
133134
toggle.addThemeVariants(FCToggleButtonVariant.CONTRAST);
135+
136+
// Long swipe: wider track, optimized for touch (can be combined with size variants)
137+
toggle.addThemeVariants(FCToggleButtonVariant.LONGSWIPE);
138+
toggle.addThemeVariants(FCToggleButtonVariant.LONGSWIPE, FCToggleButtonVariant.LARGE);
134139
```
135140

136141
## Special configuration when using Spring

src/main/java/com/flowingcode/vaadin/addons/fctogglebutton/FCToggleButtonVariant.java

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,17 +24,33 @@
2424
/**
2525
* Theme variants for the {@link FCToggleButton} component.
2626
*
27+
* <p>Size variants ({@link #SMALL}, {@link #MEDIUM}, {@link #LARGE}) and {@link #LONGSWIPE} can be
28+
* combined (e.g. {@code LONGSWIPE} + {@code LARGE}).
29+
*
2730
* @since 1.0.0
2831
*/
2932
public enum FCToggleButtonVariant implements ThemeVariant {
33+
/** Renders the toggle at a smaller size (32×18 px track). */
3034
SMALL("small"),
35+
/** Renders the toggle at the default medium size (44×24 px track). */
3136
MEDIUM("medium"),
37+
/** Renders the toggle at a larger size (56×32 px track). */
3238
LARGE("large"),
39+
/**
40+
* Renders a wider switch track optimized for touch interaction. Can be combined with size
41+
* variants: the track width is increased by 28 px while preserving the height of the chosen
42+
* size.
43+
*/
3344
LONGSWIPE("longswipe"),
45+
/** Applies the primary color to the checked state. */
3446
PRIMARY("primary"),
47+
/** Applies the success color to the checked state. */
3548
SUCCESS("success"),
49+
/** Applies the warning color to the checked state. */
3650
WARNING("warning"),
51+
/** Applies the error color to the checked state. */
3752
ERROR("error"),
53+
/** Applies the contrast color to the checked state. */
3854
CONTRAST("contrast");
3955

4056
private final String variant;

0 commit comments

Comments
 (0)