# Input
<flow-input>
The Input component accepts text input from the user.
The Input control provides a styled equivalent of the native <input>
element and can be used to accept input in forms or standalone UI elements such as search bars.
# Examples
# Styles
The following styles are supported:
filled
- The standard style for forms.outlined
- For standalone inputs such as search boxes.plain
- Minimal styling for compact forms.
TIP
Note that the plain
style does not include a floating label. A field label should be provided to the left or above the input control.
# Colors
Set the color
attribute to select a color for the Input control from the application palette.
# Disabled Input Controls
Add the disabled
attribute to disable an Input control.
# Icons
An Input control can have a leading or trailing icon. Leading icons are display-only and should provide a hint to the purpose of the the input. Trailing icons act as buttons and provide a user action such as 'search'.
WARNING
The plain
input type does not support icons.
# Prefix and Suffix Text
Set the prefix-text
and/or suffix-text
attributes to add prefix and suffix text to the Input control.
# Event Handling
The Input control supports three custom events:
flowInputAction
- emitted when the trailing action icon is clicked.flowChange
- emitted when the Input control's value changes (equivalent to the nativechange
event).flowInput
- emitted when the Input control receives input (equivalent to the nativeinput
event).
Other native input events such as keydown
can also be intercepted.
Note that flowChange
is emitted when either the enter key is pressed or the trailing action icon is clicked. It can therefore be used to trigger an action via the keyboard or a mouse click whenever the input value has changed.
TIP
Open the browser developer console to see event handler output.