Package-level declarations

Types

Link copied to clipboard
@Immutable
class BorderStyle(val topLeft: Char, val topRight: Char, val bottomLeft: Char, val bottomRight: Char, val horizontal: Char, val vertical: Char)

The characters of a border.

Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
interface DrawScope
Link copied to clipboard
sealed interface DrawStyle

Represents how the shapes should be drawn within a DrawScope

Link copied to clipboard
Link copied to clipboard
interface FocusManager

Moves the focus between focusable nodes.

Link copied to clipboard
@Stable
class FocusRequester

Moves the focus to the nodes it is attached to with Modifier.focusRequester.

Link copied to clipboard
class FocusState(val isFocused: Boolean, val hasFocus: Boolean)

Whether a node is focused, or contains the focused node.

Link copied to clipboard

A part of the composition that can be measured. This represents a layout. The instance should never be stored.

Link copied to clipboard

Intrinsic size used in width or height which can refer to width or height.

Link copied to clipboard
@Immutable
class KeyEvent(val key: String, val alt: Boolean = false, val ctrl: Boolean = false, val shift: Boolean = false)
Link copied to clipboard
Link copied to clipboard

A Modifier.Element that changes how its wrapped content is measured and laid out. It has the same measurement and layout functionality as the org.unitedsoftware.mosaic.ui.Layout component, while wrapping exactly one layout due to it being a modifier. In contrast, the org.unitedsoftware.mosaic.ui.Layout component is used to define the layout behavior of multiple children.

Link copied to clipboard
Link copied to clipboard
fun interface MeasurePolicy
Link copied to clipboard
interface MeasureResult
Link copied to clipboard
interface MeasureScope
Link copied to clipboard

A Modifier that provides data to the parent Layout. This can be read from within the the Layout during measurement and positioning, via IntrinsicMeasurable.parentData. The parent data is commonly used to inform the parent how the child Layout should be measured and positioned.

Link copied to clipboard
@Immutable
class PasteEvent(val text: String)

Text pasted into the terminal.

Link copied to clipboard
Link copied to clipboard
abstract class Placeable
Link copied to clipboard
Link copied to clipboard
class PointerEvent(val type: PointerEventType, val x: Int, val y: Int, val button: PointerButton = PointerButton.None, val scrollDelta: Int = 0, val shift: Boolean = false, val alt: Boolean = false, val ctrl: Boolean = false, val isWithinBounds: Boolean = true)

An event of the mouse pointer at x and y, relative to the top left of the node which receives it. Coordinates can be outside of the node for drags and releases, which go to the nodes the press went to.

Link copied to clipboard

What happened to the mouse pointer, see onPointerEvent.

Link copied to clipboard
@Stable
class ScrollState(initial: Int = 0)

The scroll position of verticalScroll or horizontalScroll.

Properties

Link copied to clipboard

Retrieves the tag associated to a composable with the Modifier.layoutId modifier. For a parent data value to be returned by this property when not using the Modifier.layoutId modifier, the parent data value should implement the LayoutIdParentData interface.

Link copied to clipboard
val LocalFocusManager: ProvidableCompositionLocal<FocusManager>

Functions

Link copied to clipboard
@Stable
fun Modifier.aspectRatio(ratio: Float, matchHeightConstraintsFirst: Boolean = false): Modifier

Attempts to size the content to match a specified aspect ratio by trying to match one of the incoming constraints in the following order: Constraints.maxWidth, Constraints.maxHeight, Constraints.minWidth, Constraints.minHeight if matchHeightConstraintsFirst is false (which is the default), or Constraints.maxHeight, Constraints.maxWidth, Constraints.minHeight, Constraints.minWidth if matchHeightConstraintsFirst is true. The size in the other dimension is determined by the aspect ratio. The combinations will be tried in this order until one non-empty is found to satisfy the constraints. If no valid size is obtained this way, it means that there is no non-empty size satisfying both the constraints and the aspect ratio, so the constraints will not be respected and the content will be sized such that the Constraints.maxWidth or Constraints.maxHeight is matched (depending on matchHeightConstraintsFirst).

Link copied to clipboard
@Stable
fun Modifier.background(color: Color): Modifier
Link copied to clipboard
fun Modifier.border(style: BorderStyle = BorderStyle.Rounded, color: Color = Color.Unspecified, title: String? = null, titleColor: Color = color, titleStyle: TextStyle = TextStyle.Bold): Modifier

Draws a box of style around the content, which is inset by one cell on each side to make room for it. A title is drawn into the top edge, cut off to fit.

Link copied to clipboard

Clips the content of this node, including its children and anything drawn by later modifiers, to its bounds. Without it, content which does not fit, such as a child placed partly outside, is drawn over its surroundings.

Link copied to clipboard
@Stable
fun Modifier.defaultMinSize(minWidth: Int = Unspecified, minHeight: Int = Unspecified): Modifier

Constrain the size of the wrapped layout only when it would be otherwise unconstrained: the minWidth and minHeight constraints are only applied when the incoming corresponding constraint is 0. The modifier can be used, for example, to define a default min size of a component, while still allowing it to be overidden with smaller min sizes across usages.

Link copied to clipboard
Link copied to clipboard
@Stable
fun Modifier.fillMaxHeight(fraction: Float = 1.0f): Modifier

Have the content fill (possibly only partially) the Constraints.maxHeight of the incoming measurement constraints, by setting the minimum height and the maximum height to be equal to the maximum height multiplied by fraction. Note that, by default, the fraction is 1, so the modifier will make the content fill the whole available height. If the incoming maximum height is Constraints.Infinity this modifier will have no effect.

Link copied to clipboard
@Stable
fun Modifier.fillMaxSize(fraction: Float = 1.0f): Modifier

Have the content fill (possibly only partially) the Constraints.maxWidth and Constraints.maxHeight of the incoming measurement constraints, by setting the minimum width and the maximum width to be equal to the maximum width multiplied by fraction, as well as the minimum height and the maximum height to be equal to the maximum height multiplied by fraction. Note that, by default, the fraction is 1, so the modifier will make the content fill the whole available space. If the incoming maximum width or height is Constraints.Infinity this modifier will have no effect in that dimension.

Link copied to clipboard
@Stable
fun Modifier.fillMaxWidth(fraction: Float = 1.0f): Modifier

Have the content fill (possibly only partially) the Constraints.maxWidth of the incoming measurement constraints, by setting the minimum width and the maximum width to be equal to the maximum width multiplied by fraction. Note that, by default, the fraction is 1, so the modifier will make the content fill the whole available width. If the incoming maximum width is Constraints.Infinity this modifier will have no effect.

Link copied to clipboard
fun Modifier.focusable(enabled: Boolean = true): Modifier

Lets this node receive focus.

Link copied to clipboard

Lets focusRequester move the focus to this node, or the first focusable node inside it.

Link copied to clipboard
@Stable
fun Modifier.height(height: Int): Modifier

Declare the preferred height of the content to be exactly height. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

@Stable
fun Modifier.height(intrinsicSize: IntrinsicSize): Modifier

Declare the preferred height of the content to be the same as the min or max intrinsic height of the content. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

Link copied to clipboard
@Stable
fun Modifier.heightIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the height of the content to be between min and max as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.

Link copied to clipboard

Lets the content be wider than this node, showing the part state is scrolled to and clipping the rest. Scroll by changing state, for example in response to key events. The mouse wheel scrolls it with Shift held, when mouse events are enabled.

Link copied to clipboard

Creates a LayoutModifier that allows changing how the wrapped element is measured and laid out.

Link copied to clipboard
@Stable
fun Modifier.layoutId(layoutId: Any): Modifier

Tag the element with layoutId to identify the element within its parent.

Link copied to clipboard
fun Modifier.offset(offset: () -> IntOffset): Modifier

Offset the content by offset. The offsets can be positive as well as non-positive. Applying an offset only changes the position of the content, without interfering with its size measurement.

@Stable
fun Modifier.offset(x: Int = 0, y: Int = 0): Modifier

Offset the content by (x, y). The offsets can be positive as well as non-positive. Applying an offset only changes the position of the content, without interfering with its size measurement.

Link copied to clipboard
fun Modifier.onClick(onClick: () -> Unit): Modifier

Calls onClick when the left button is pressed and released over this node.

Link copied to clipboard
fun Modifier.onFocusChanged(onFocusChanged: (FocusState) -> Unit): Modifier

Calls onFocusChanged with the focus state of this node when it is first laid out, and whenever it changes after that.

Link copied to clipboard
fun Modifier.onHover(onHoverChange: (hovered: Boolean) -> Unit): Modifier

Calls onHoverChange when the pointer moves onto this node, and when it moves off it.

Link copied to clipboard
fun Modifier.onKeyEvent(onKeyEvent: (event: KeyEvent) -> Boolean): Modifier

Adding this modifier to the modifier parameter of a component will allow it to intercept key events.

Link copied to clipboard
fun Modifier.onPasteEvent(onPasteEvent: (event: PasteEvent) -> Boolean): Modifier

Adding this modifier to the modifier parameter of a component will allow it to receive pasted text.

Link copied to clipboard
fun Modifier.onPointerEvent(onPointerEvent: (event: PointerEvent) -> Boolean): Modifier

Receives events of the mouse pointer over this node. Events go to the innermost node under the pointer first, and to its ancestors until one returns true. Drags and releases go to the nodes which the press went to.

Link copied to clipboard
fun Modifier.onPreviewKeyEvent(onPreviewKeyEvent: (event: KeyEvent) -> Boolean): Modifier

Adding this modifier to the modifier parameter of a component will allow it to intercept key events.

Link copied to clipboard
fun Modifier.onPreviewPasteEvent(onPreviewPasteEvent: (event: PasteEvent) -> Boolean): Modifier

Adding this modifier to the modifier parameter of a component will allow it to intercept pasted text before its children, like a text field, receive it. For example, to insert a placeholder in place of a large paste.

Link copied to clipboard
@Stable
fun Modifier.padding(all: Int): Modifier
@Stable
fun Modifier.padding(horizontal: Int = 0, vertical: Int = 0): Modifier
@Stable
fun Modifier.padding(left: Int = 0, top: Int = 0, right: Int = 0, bottom: Int = 0): Modifier
Link copied to clipboard
@Composable
fun rememberScrollState(initial: Int = 0): ScrollState
Link copied to clipboard
@Stable
fun Modifier.requiredHeight(height: Int): Modifier

Declare the height of the content to be exactly height. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

@Stable
fun Modifier.requiredHeight(intrinsicSize: IntrinsicSize): Modifier

Declare the height of the content to be exactly the same as the min or max intrinsic height of the content. The incoming measurement Constraints will not override this value. If the content intrinsic height does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredHeightIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the height of the content to be between min and max. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredSize(size: Int): Modifier

Declare the size of the content to be exactly size width and height. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Declare the size of the content to be exactly size. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

@Stable
fun Modifier.requiredSize(width: Int, height: Int): Modifier

Declare the size of the content to be exactly width and height. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredSizeIn(minWidth: Int = Unspecified, minHeight: Int = Unspecified, maxWidth: Int = Unspecified, maxHeight: Int = Unspecified): Modifier

Constrain the width of the content to be between minWidth and maxWidth, and the height of the content to be between minHeight and maxHeight. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredWidth(width: Int): Modifier

Declare the width of the content to be exactly width. The incoming measurement Constraints will not override this value. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

@Stable
fun Modifier.requiredWidth(intrinsicSize: IntrinsicSize): Modifier

Declare the width of the content to be exactly the same as the min or max intrinsic width of the content. The incoming measurement Constraints will not override this value. If the content intrinsic width does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.requiredWidthIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the width of the content to be between min and max. If the content chooses a size that does not satisfy the incoming Constraints, the parent layout will be reported a size coerced in the Constraints, and the position of the content will be automatically offset to be centered on the space assigned to the child by the parent layout under the assumption that Constraints were respected.

Link copied to clipboard
@Stable
fun Modifier.size(size: Int): Modifier

Declare the preferred size of the content to be exactly size square. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

@Stable
fun Modifier.size(size: IntSize): Modifier

Declare the preferred size of the content to be exactly size. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

@Stable
fun Modifier.size(width: Int, height: Int): Modifier

Declare the preferred size of the content to be exactly width by height. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

Link copied to clipboard
@Stable
fun Modifier.sizeIn(minWidth: Int = Unspecified, minHeight: Int = Unspecified, maxWidth: Int = Unspecified, maxHeight: Int = Unspecified): Modifier

Constrain the width of the content to be between minWidth and maxWidth and the height of the content to be between minHeight and maxHeight as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.

Link copied to clipboard

Lets the content be taller than this node, showing the part state is scrolled to and clipping the rest. Scroll by changing state, for example in response to key events. The mouse wheel scrolls it too, when mouse events are enabled.

Link copied to clipboard
@Stable
fun Modifier.width(width: Int): Modifier

Declare the preferred width of the content to be exactly width. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

@Stable
fun Modifier.width(intrinsicSize: IntrinsicSize): Modifier

Declare the preferred width of the content to be the same as the min or max intrinsic width of the content. The incoming measurement Constraints may override this value, forcing the content to be either smaller or larger.

Link copied to clipboard
@Stable
fun Modifier.widthIn(min: Int = Unspecified, max: Int = Unspecified): Modifier

Constrain the width of the content to be between min and max as permitted by the incoming measurement Constraints. If the incoming constraints are more restrictive the requested size will obey the incoming constraints and attempt to be as close as possible to the preferred size.

Link copied to clipboard
@Stable
fun Modifier.wrapContentHeight(align: Alignment.Vertical = Alignment.CenterVertically, unbounded: Boolean = false): Modifier

Allow the content to measure at its desired height without regard for the incoming measurement minimum height constraint, and, if unbounded is true, also without regard for the incoming measurement maximum height constraint. If the content's measured size is smaller than the minimum height constraint, align it within that minimum height space. If the content's measured size is larger than the maximum height constraint (only possible when unbounded is true), align over the maximum height space.

Link copied to clipboard
@Stable
fun Modifier.wrapContentSize(align: Alignment = Alignment.Center, unbounded: Boolean = false): Modifier

Allow the content to measure at its desired size without regard for the incoming measurement minimum width or minimum height constraints, and, if unbounded is true, also without regard for the incoming maximum constraints. If the content's measured size is smaller than the minimum size constraint, align it within that minimum sized space. If the content's measured size is larger than the maximum size constraint (only possible when unbounded is true), align within the maximum space.

Link copied to clipboard
@Stable
fun Modifier.wrapContentWidth(align: Alignment.Horizontal = Alignment.CenterHorizontally, unbounded: Boolean = false): Modifier

Allow the content to measure at its desired width without regard for the incoming measurement minimum width constraint, and, if unbounded is true, also without regard for the incoming measurement maximum width constraint. If the content's measured size is smaller than the minimum width constraint, align it within that minimum width space. If the content's measured size is larger than the maximum width constraint (only possible when unbounded is true), align over the maximum width space.