maxLengthTrim
public fun InputTransformation.maxLengthTrim(maxLength: Int): InputTransformation
Limits the total length of the text field to maxLength characters by truncating inserted characters.
When text is inserted (e.g. by typing or pasting) that would cause the total length to exceed maxLength, only enough inserted characters are kept to fill the text field up to maxLength, and excess characters are trimmed and discarded. For example, pasting "12345" into a text field that already has 8 characters and a maxLength of 10 will insert only "12", resulting in 10 characters.
This transformation sets the maximum text length for accessibility services. OutputTransformation does not affect this limit. When using an OutputTransformation that adds decorating characters, set SemanticsPropertyReceiver.maxTextLength manually in a custom InputTransformation to include those characters in the announced limit.