Class Breakpoints<V>
- Type Parameters:
V
- the type of values associated with each breakpoint
- All Implemented Interfaces:
Iterable<Tuple<Breakpoint,
V>>
Tuples
class and adds methods to generate CSS modifier classes. The class is used as parameter in various components and
layouts to apply CSS modifiers for responsive layout.
The CSS modifier class for a single breakpoint is generated using the following rules:
- For normal breakpoints (
modifiers()
methods)- default breakpoint:
pf-m-<value>
- all other breakpoints:
pf-m-<value>-on-<breakpoint>
- default breakpoint:
- For vertical breakpoints (
verticalModifiers()
methods)- default breakpoint:
pf-m-<value>
- all other breakpoints:
pf-m-<value>-on-<breakpoint>-height
- default breakpoint:
When generating the CSS modifier classes, String.valueOf(Object)
is used by default to build the <value>
part. If the value type implements TypedModifier
, TypedModifier.value()
is used instead.
Breakpoints can be created using either factory methods or a fluent API:
breakpoints(
default_, 1,
sm, 2,
lg, 3);
breakpoints()
.default_(1)
.sm(2)
.lg(3);
To get the CSS modifiers classes, use the modifiers()
and verticalModifiers()
methods. Depending on the
signature they return a list of CSS modifier classes, a single CSS modifier class or an empty string.
// pf-m-foo pf-m-bar-on-lg
breakpoints(default_, "foo", lg, "bar").modifiers();
// pf-m-start-foo__end-on-sm pf-m-start-bar__end-on-lg
breakpoints(sm, "foo", lg, "bar").modifiers(v -> "start-" + v + "__end");
// pf-m-a pf-m-b-on-sm-height pf-m-c-on-md-height pf-m-d-on-lg-height pf-m-e-on-xl-height pf-m-f-on-2xl-height
breakpoints(
default_, "a",
sm, "b",
md, "c",
lg, "d",
xl, "e",
_2xl, "f")
.verticalModifiers();
breakpoints(md, "foo", lg, "bar").modifiers(md); // pf-m-foo, because md in [md, lg]
breakpoints(md, "foo", lg, "bar").modifiers(_2xl); // pf-m-foo, because [md, lg] < _2xl
breakpoints(md, "foo", lg, "bar").modifiers(sm); // "", because [md, lg] > sm
-
Method Summary
Modifier and TypeMethodDescriptionAdds the given value for the 2xl breakpoint to the list of breakpoints.static <V> Breakpoints
<V> Creates a new instance of Breakpoints with an empty list of breakpoints.static <V> Breakpoints
<V> breakpoints
(Iterable<Tuple<Breakpoint, V>> breakpoints) Creates a new instance of Breakpoints with the given breakpoints and values.static <V> Breakpoints
<V> breakpoints
(Breakpoint breakpoint, V value) Creates a new instance ofBreakpoints
with a single tuple containing the given breakpoint and value.static <V> Breakpoints
<V> breakpoints
(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2) Creates a new instance of Breakpoints with two tuples containing the given breakpoints and values.static <V> Breakpoints
<V> breakpoints
(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3) Creates a new instance of Breakpoints with three tuples containing the given breakpoints and values.static <V> Breakpoints
<V> breakpoints
(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3, Breakpoint breakpoint4, V value4) Creates a new instance of Breakpoints with four tuples containing the given breakpoints and values.static <V> Breakpoints
<V> breakpoints
(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3, Breakpoint breakpoint4, V value4, Breakpoint breakpoint5, V value5) Creates a new instance of Breakpoints with five tuples containing the given breakpoints and values.static <V> Breakpoints
<V> breakpoints
(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3, Breakpoint breakpoint4, V value4, Breakpoint breakpoint5, V value5, Breakpoint breakpoint6, V value6) Creates a new instance of Breakpoints with six tuples containing the given breakpoints and values.Adds the given value for the default breakpoint to the list of breakpoints.Adds the given value for the large breakpoint to the list of breakpoints.Adds the given value for the medium breakpoint to the list of breakpoints.Returns the CSS modifiers classes for the breakpoints of this class as a string separated by " ".Returns the CSS modifiers classes for the breakpoints of this class as a string separated by " ".modifiers
(Breakpoint breakpoint) Returns a single CSS modifier class for the given breakpoint, if this class contains the breakpoint.modifiers
(Breakpoint breakpoint, Function<V, String> stringValue) Returns a single CSS modifier class for the given breakpoint, if this class contains the breakpoint.Adds the given value for the small breakpoint to the list of breakpoints.Returns the vertical CSS modifiers classes for the breakpoints of this class as a string separated by " ".verticalModifiers
(Function<V, String> stringValue) Returns the vertical CSS modifiers classes for the breakpoints of this class as a string separated by " ".Adds the given value for the x-large breakpoint to the list of breakpoints.Methods inherited from class org.patternfly.core.Tuples
hasKey, hasValue, isEmpty, iterator, key, size, stream, toString, tuples, tuples, tuples, tuples, tuples, tuples, tuples, tuples, tuples, tuples, tuples, value
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, wait, wait, wait
Methods inherited from interface java.lang.Iterable
forEach, spliterator
-
Method Details
-
breakpoints
Creates a new instance of Breakpoints with an empty list of breakpoints. -
breakpoints
Creates a new instance ofBreakpoints
with a single tuple containing the given breakpoint and value. -
breakpoints
public static <V> Breakpoints<V> breakpoints(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2) Creates a new instance of Breakpoints with two tuples containing the given breakpoints and values. -
breakpoints
public static <V> Breakpoints<V> breakpoints(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3) Creates a new instance of Breakpoints with three tuples containing the given breakpoints and values. -
breakpoints
public static <V> Breakpoints<V> breakpoints(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3, Breakpoint breakpoint4, V value4) Creates a new instance of Breakpoints with four tuples containing the given breakpoints and values. -
breakpoints
public static <V> Breakpoints<V> breakpoints(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3, Breakpoint breakpoint4, V value4, Breakpoint breakpoint5, V value5) Creates a new instance of Breakpoints with five tuples containing the given breakpoints and values. -
breakpoints
public static <V> Breakpoints<V> breakpoints(Breakpoint breakpoint1, V value1, Breakpoint breakpoint2, V value2, Breakpoint breakpoint3, V value3, Breakpoint breakpoint4, V value4, Breakpoint breakpoint5, V value5, Breakpoint breakpoint6, V value6) Creates a new instance of Breakpoints with six tuples containing the given breakpoints and values. -
breakpoints
Creates a new instance of Breakpoints with the given breakpoints and values. -
default_
Adds the given value for the default breakpoint to the list of breakpoints. -
sm
Adds the given value for the small breakpoint to the list of breakpoints. -
md
Adds the given value for the medium breakpoint to the list of breakpoints. -
lg
Adds the given value for the large breakpoint to the list of breakpoints. -
xl
Adds the given value for the x-large breakpoint to the list of breakpoints. -
_2xl
Adds the given value for the 2xl breakpoint to the list of breakpoints. -
modifiers
Returns the CSS modifiers classes for the breakpoints of this class as a string separated by " ".When generating the CSS modifier classes,
String.valueOf(Object)
is used by default to build the<value>
part. If the value type implementsTypedModifier
,TypedModifier.value()
is used instead. -
modifiers
Returns the CSS modifiers classes for the breakpoints of this class as a string separated by " ".When generating the CSS modifier classes, the specified function is used to build the
<value>
part. -
modifiers
Returns a single CSS modifier class for the given breakpoint, if this class contains the breakpoint. Otherwise, returns a single CSS modifier class for the given breakpoint, if this class contains a breakpoint smaller than the given one. Otherwise, this method returns an empty string.This method does not add the
-on-<breakpoint>
suffix!When generating the CSS modifier classes,
String.valueOf(Object)
is used by default to build the<value>
part. If the value type implementsTypedModifier
,TypedModifier.value()
is used instead. -
modifiers
Returns a single CSS modifier class for the given breakpoint, if this class contains the breakpoint. Otherwise, returns a single CSS modifier class for the given breakpoint, if this class contains a breakpoint smaller than the given one. Otherwise, this method returns an empty string.This method does not add the
-on-<breakpoint>
suffix!When generating the CSS modifier classes, the specified function is used to build the
<value>
part. -
verticalModifiers
Returns the vertical CSS modifiers classes for the breakpoints of this class as a string separated by " ".When generating the CSS modifier classes,
String.valueOf(Object)
is used by default to build the<value>
part. If the value type implementsTypedModifier
,TypedModifier.value()
is used instead. -
verticalModifiers
Returns the vertical CSS modifiers classes for the breakpoints of this class as a string separated by " ".When generating the CSS modifier classes, the specified function is used to build the
<value>
part.
-