Components

Text Input(iOS)

A control that allows single line text input.

Summary

The single line text input control TextInput is build upon the built-in UIKit component UITextField.

Default TextInput

let textInput = TextInput()

Properties

placeholder

The placeholder text that’s shown when no text has been entered. Placeholder text is shown in gray.

Placeholder TextInput

textInput.placeholder = "Type something..."

hasError

If true, the control will be red. Use this property if something’s wrong and the text input control needs a user’s attention.

Error TextInput

textInput.hasError = true

isEnabled

If false, the control will not react to user interaction and will have a light gray color.

Disabled TextInput

textInput.isEnabled = false

isHighlighted

If true, the control has a blue border.

Highlighted TextInput

textInput.isHighlighted = true

leftView and rightView

These properties are inherited from UITextField and typically make it possible to show image based buttons on both sides of the text. More info can be found in the official UITextField documentation.

Leftview TextInput

let leftView = UIButton(type: .system)
leftView.setTitle("left", for: .normal)
textInput.leftView = leftView
textInput.leftViewMode = .always

clearButtonMode

This property is inherited from UITextField and determines when the standard clear button appears. More info can be found in the official UITextField documentation.

textInput.clearButtonMode = .whileEditing

hidesCaret

Suppresses the cursor display while the control is active.

textInput.hidesCaret = true
Was this page helpful?

We use this feedback to improve the quality of our documentation.