---
title: "WindowWidthSizeClass"
description: "Width-based window size class.

A window size class represents a breakpoint that can be used to build responsive layouts. Each
window size class breakpoint represents a majority case for typical device scenarios so your
layouts will work well on most devices and configurations.

For more details see Window size classes documentation."
type: "class"
---

<div class='type'>Class</div>


<a id='references'></a>

<div class='sourceset sourceset-common'>Common</div>


```kotlin
value class WindowWidthSizeClass private constructor(private val value: Int) :
    Comparable<WindowWidthSizeClass>
```


Width-based window size class.

A window size class represents a breakpoint that can be used to build responsive layouts. Each
window size class breakpoint represents a majority case for typical device scenarios so your
layouts will work well on most devices and configurations.

For more details see <a
href="https://developer.android.com/guide/topics/large-screens/support-different-screen-sizes#window_size_classes"
class="external" target="_blank">Window size classes documentation</a>.


## Companion Object

#### Properties

<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Compact = WindowWidthSizeClass(0)
```


Represents the majority of phones in portrait.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Medium = WindowWidthSizeClass(1)
```


Represents the majority of tablets in portrait and large unfolded inner displays in
portrait.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val Expanded = WindowWidthSizeClass(2)
```


Represents the majority of tablets in landscape and large unfolded inner displays in
landscape.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val DefaultSizeClasses = setOf(Compact, Medium, Expanded)
```


The default set of size classes that includes `Compact`, `Medium`, and `Expanded` size
classes. Should never expand to ensure behavioral consistency.



<div class='sourceset sourceset-common'>Common</div>


```kotlin
val AllSizeClasses = AllSizeClassList.toSet()
```


The set of all size classes. It's supposed to be expanded whenever a new size class is
defined. By default `WindowSizeClass.calculateFromSize` will only return size classes in
`DefaultSizeClasses` in order to avoid behavioral changes when new size classes are
added. You can opt in to support all available size classes by doing:
```
WindowSizeClass.calculateFromSize(   size = size,   density = density,   supportedWidthSizeClasses = WindowWidthSizeClass.AllSizeClasses,   supportedHeightSizeClasses = WindowHeightSizeClass.AllSizeClasses
)
```





