Skip to content

RadiusMode

RadiusMode selects which dimension a DialLayout measures the dial’s radius against. It’s the radiusMode field of DialLayout — you don’t pass it to Dial directly.

enum class RadiusMode {
WIDTH,
HEIGHT
}

Radius is radiusFraction × width. This is the default and the right choice for square dials and full circles.

layout = DialLayout(radiusMode = RadiusMode.WIDTH)
// or simply: DialLayout.width()

Radius is radiusFraction × height. Use it when the box is wider than it is tall — typically a horizontal semi-circle or gauge — so the arc is sized by the short axis and stays within bounds.

layout = DialLayout(radiusMode = RadiusMode.HEIGHT)
// or simply: DialLayout.height()

Consider Modifier.size(200.dp, 100.dp) with a 180° top arc:

ModeRadiusResult
WIDTH100dpArc is sized by width — the thumb path overflows the short height
HEIGHT50dpArc is sized by height — the half-circle fits the box
  • DialLayout — the full layout type that uses RadiusMode, plus radiusFraction and center
  • DialState — exposes the resolved radius in pixels