Skip to main content

Input

Rocket 2.0

The Input component is a single-line text field with a label, for entering names, emails, numbers, passwords or search terms. Email and URL types check the format of what the user types.

Properties​

Property
Description
Expected Value
LabelLabel shown above the field.Text. Default: Label
Help textHelp text shown under the field.Text
PlaceholderHint text shown while the field is empty.Text. Default: Enter text
Default valueText the field starts with. Changing it replaces the current value.Text
TypeKind of value the field takes. Email and URL show an error for a badly formed value, Number gives a number, Password hides the text, and Search adds a clear button and clears on Escape.Text, Email, URL, Number, Password, Search, Phone. Default: Text
Show clear buttonShows a button that empties the field while it has text.On or off. Default: Off

Additional Actions​

Each of these can be switched on or off, or set with a logical expression by clicking fx.

Property
Description
Expected Value
VisibilityShows or hides the component. Hidden components keep their space unless Collapse when hidden is on.On or off. Default: On
Collapse when hiddenRemoves the hidden component's space, so the components below it move up.On or off. Default: Off
Loading stateShows the component's loading look and blocks interaction, for example while a query runs.On or off. Default: Off
DisableStops the user from interacting with the component.On or off. Default: Off
Dynamic heightLets the component grow with its content in the running app instead of keeping a fixed height.On or off. Default: Off

Devices​

Property
Description
Expected Value
Show on desktopShows the component in the desktop layout.On or off. Default: On
Show on mobileShows the component in the mobile layout.On or off. Default: Off

Events​

Add a handler from the Events section of the properties panel. See Event Triggers for the steps.

Event
Description
On focusTriggers when the field gains focus.
On blurTriggers when the field loses focus.
On changeTriggers when the field's value changes.
On enter pressedTriggers when the user presses Enter in the field.

Component Specific Actions (CSA)​

Run these from an event handler with Control Component, or from a RunJS query. See Component Specific Actions.

Action
Description
How To Access
Set textSets the field's value to Text.components.input1.setText("")
ClearEmpties the field.components.input1.clear()
Set focusMoves keyboard focus to the field.components.input1.setFocus()
Set blurRemoves keyboard focus from the field.components.input1.setBlur()
Set visibilityShows the component when true, hides it when false.components.input1.setVisibility(false)
Set disableDisables the component when true, enables it when false.components.input1.setDisable(false)
Set loadingTurns the loading state on with true, off with false.components.input1.setLoading(false)

Exposed Variables​

Variable
Description
How To Access
labelLabel shown above the field.{{components.input1.label}}
descriptionHelp text shown under the field.{{components.input1.description}}
placeholderHint text shown while the field is empty.{{components.input1.placeholder}}
defaultValueText the field starts with. Changing it replaces the current value.{{components.input1.defaultValue}}
inputTypeKind of value the field takes. Email and URL show an error for a badly formed value, Number gives a number, Password hides the text, and Search adds a clear button and clears on Escape.{{components.input1.inputType}}
showClearBtnShows a button that empties the field while it has text.{{components.input1.showClearBtn}}
valueCurrent value of the field. With Type set to Number, it is a number, or null when empty.{{components.input1.value}}
isVisibleWhether the component is visible.{{components.input1.isVisible}}
isLoadingWhether the component is in its loading state.{{components.input1.isLoading}}
isDisabledWhether the component is disabled.{{components.input1.isDisabled}}

Styles​

Style
Default
Label colorTheme: Primary text
Help text colorTheme: Placeholder text
Field backgroundTheme: Surface 1
Field text colorTheme: Primary text
Placeholder colorTheme: Placeholder text
Field border colorTheme: Default border
Accent (focus ring, selection)Theme: Brand primary
Error color (message and border)Theme: Error
Field radius—
Box shadow0px 0px 0px 0px #00000040

A default that starts with Theme: follows the app's theme until the style is set to another value. See App Themes.