Enum Class Breakpoint

java.lang.Object
java.lang.Enum<Breakpoint>
org.patternfly.style.Breakpoint
All Implemented Interfaces:
Serializable, Comparable<Breakpoint>, Constable

public enum Breakpoint extends Enum<Breakpoint>
The Breakpoint class represents different breakpoints for responsive design.

Breakpoints are used to define the varying screen widths and heights at which a website or application layout should change.

The class is implemented as an enum with a fixed set of predefined breakpoints:

  • default_ - The default breakpoint, used when no other breakpoint matches the given width or height.
  • sm - The small breakpoint.
  • md - The medium breakpoint.
  • lg - The large breakpoint.
  • xl - The extra large breakpoint.
  • _2xl - The 2x extra large breakpoint.

The class provides utility methods to retrieve the appropriate breakpoint based on a given width or height, using the methods breakpoint(int width) and verticalBreakpoint(int height).

Each instance of the Breakpoint class has the following information:

  • value - The name or identifier of the breakpoint.
  • widthValue - The width value of the breakpoint in pixels.
  • widthCss - The width value of the breakpoint in CSS units.
  • heightValue - The height value of the breakpoint in pixels.
  • heightCss - The height value of the breakpoint in CSS units.
  • Enum Constant Details

  • Field Details

    • value

      public final String value
    • widthValue

      public final int widthValue
    • widthCss

      public final String widthCss
    • heightValue

      public final int heightValue
    • heightCss

      public final String heightCss
  • Method Details

    • values

      public static Breakpoint[] values()
      Returns an array containing the constants of this enum class, in the order they are declared.
      Returns:
      an array containing the constants of this enum class, in the order they are declared
    • valueOf

      public static Breakpoint valueOf(String name)
      Returns the enum constant of this class with the specified name. The string must match exactly an identifier used to declare an enum constant in this class. (Extraneous whitespace characters are not permitted.)
      Parameters:
      name - the name of the enum constant to be returned.
      Returns:
      the enum constant with the specified name
      Throws:
      IllegalArgumentException - if this enum class has no constant with the specified name
      NullPointerException - if the argument is null
    • breakpoint

      public static Breakpoint breakpoint(int width)
      Determines the breakpoint for a given width value.
      Parameters:
      width - the width value
      Returns:
      the breakpoint corresponding to the given width value or default_ if no width matches.
    • verticalBreakpoint

      public static Breakpoint verticalBreakpoint(int height)
      Determines the breakpoint based on the given height value.
      Parameters:
      height - the height value to determine the breakpoint for
      Returns:
      the Breakpoint corresponding to the given height value or default_ if no height matches.