readOnly

Whether the node is read-only.


fun Modifier.readOnly(role: Role?, interactionSource: MutableInteractionSource, state: ToggleableState? = null, mergeDescendants: Boolean = false): Modifier

Configures a component to be stated as "read-only".

From Carbon documentation, the read-only states "are applied to components when the user is allowed to review but not modify the component. It removes all interactive functions from the component.", meaning that a component in a read-only state is disabled but stays focusable and readable by screen reader services.

Parameters

role

UI element type.

interactionSource

The MutableInteractionSource associated with the element.

state

Selection state of the element.

mergeDescendants

Whether to merge descendants into a single tree.


fun Modifier.readOnly(role: Role?, interactionSource: MutableInteractionSource, selected: Boolean, mergeDescendants: Boolean = false): Modifier

Configures a component to be stated as "read-only".

From Carbon documentation, the read-only states "are applied to components when the user is allowed to review but not modify the component. It removes all interactive functions from the component.", meaning that a component in a read-only state is disabled but stays focusable and readable by screen reader services.

Parameters

role

UI element type.

interactionSource

The MutableInteractionSource associated with the element.

selected

Selection state of the element.

mergeDescendants

Whether to merge descendants into a single tree.