Jetpack Compose Reference
ui-unit
Interfaces
  • Density
  • FontScaling
Functions
  • Constraints
  • Density
  • DpOffset
  • DpSize
  • IntOffset
  • IntRect
  • IntSize
  • TextUnit
  • Velocity
  • coerceAtLeast
  • coerceAtMost
  • coerceIn
  • constrain
  • constrainHeight
  • constrainWidth
  • isSatisfiedBy
  • lerp
  • max
  • min
  • minus
  • offset
  • plus
  • round
  • roundToIntRect
  • roundToIntSize
  • takeOrElse
  • times
  • toIntRect
  • toIntSize
  • toOffset
  • toRect
  • toSize
Objects
  • ComposeUiUnitFlags
Classes
  • Constraints
  • Dp
  • DpOffset
  • DpRect
  • DpSize
  • ExperimentalUnitApi
  • IntOffset
  • IntRect
  • IntSize
  • LayoutDirection
  • LayoutDirection.Ltr
  • LayoutDirection.Rtl
  • TextUnit
  • TextUnitType
  • Velocity
Properties
  • center
  • dp
  • em
  • height
  • isFinite
  • isSpecified
  • isUnspecified
  • size
  • sp
  • width
Jetpack Compose / Compose UI / ui-unit / Functions / Constraints
Function

Constraints

View Markdown Open in ChatGPT Open in Claude

Create a Constraints.

CodeRabbit

CodeRabbit

AI writes the code. CodeRabbit catches the slop.

Ad Try CodeRabbit for Free

Constraints

Source set: Common
public fun Constraints(
    minWidth: Int = 0,
    maxWidth: Int = Infinity,
    minHeight: Int = 0,
    maxHeight: Int = Infinity,
): Constraints

Create a Constraints. minWidth and minHeight must be positive and maxWidth and maxHeight must be greater than or equal to minWidth and minHeight, respectively, or Infinity.

Content updated: 2026-09-24

FontScaling ← Previous Density Next →

On this page

  • Constraints
Reach Android developers Put your product in front of engineers building Android and KMP apps. Sponsor Composables
Composables

Keep up to date

Subscribe for Composables product updates: new components, icons, Compose tools, and library releases.

Free Tools

  • SVG to Compose
  • Android Distribution Chart

Resources

  • Compose Unstyled
  • Compose Gradients
  • Compose Examples
  • Components
  • Icons
  • Reference

Explore

  • Documentation
  • Blog

Company

  • About
  • Partners
  • Contact us

Copyright © 2026 Composables.