InputFieldComponent

This class deals with the configuration and rendering of an input element.

The inputField can be configured for the following aspects:

  • the size of the element

  • some predefined styling variants

  • the element options of the HTML input element can be set. Attributes

You can optionally pass in a store in order to set the value and react to updates automatically.

Example usages:

inputField(value = dataStore /* inject a store so all user inputs are automatically reflected! */) {
placeholder("Placeholder") // render a placeholder text for empty field
}

// all state management can also be done manually if needed:
val someStore = storeOf("")
inputField {
placeholder("Enter text")
value(someStore.data) // connect a flow to the component for setting its value
events {
changes.values() handledBy someStore.update // connect an handler for emitting the user input made
}
element {
// exposes the underlying HTML input element for direct access. Use with caution!
}
}

// apply predefined size and variant
inputField(value = dataStore) {
size { small } // render a smaller input
variant { filled } // fill the background with ``light`` color
placeholder("Placeholder") // render a placeholder text for empty field
}

// Of course you can apply custom styling as well
inputField({ // just use the ``styling`` parameter!
background {
color { dark }
}
radius { "1rem" }
},
value = dataStore) {
size { small } // render a smaller input
placeholder("Placeholder") // render a placeholder text for empty field
}

Constructors

InputFieldComponent
Link copied to clipboard
js
fun InputFieldComponent(valueStore: Store<String>?)

Types

Companion
Link copied to clipboard
js
object Companion

Functions

enabled
Link copied to clipboard
js
open override fun enabled(value: Boolean)
open override fun enabled(value: Flow<Boolean>)
render
Link copied to clipboard
js
open override fun render(context: RenderContext, styling: BoxParams.() -> Unit, baseClass: StyleClass, id: String?, prefix: String): Input
Central method that should do the actual rendering of a component.
severity
Link copied to clipboard
js
open override fun severity(value: SeverityProperties.SeverityContext.() -> Severity)
Property to manage the severity value of the component.
severityClassOf
Link copied to clipboard
js
open override fun severityClassOf(severityStyle: SeverityStyles): Flow<StyleClass>
This function manages the task to map a value of the Severity enumeration to a corresponding style defined within the SeverityStyles interface.
tooltip
Link copied to clipboard
js
open override fun tooltip(vararg text: String, build: TooltipComponent.() -> Unit)
open override fun tooltip(styling: BasicParams.() -> Unit, text: String?, baseClass: StyleClass, id: String, prefix: String, build: TooltipComponent.() -> Unit)

Properties

disabled
Link copied to clipboard
js
open override val disabled: DynamicComponentProperty<Boolean>
element
Link copied to clipboard
js
open override val element: ComponentProperty<Input.() -> Unit>
This property enables the client to access the deeper features of an element even though the component itself does not offer an appropriate functionality.
events
Link copied to clipboard
js
open override val events: ComponentProperty<EventContext<HTMLInputElement>.() -> Unit>
This property enables the client to access all events offered by the underlying HTML element.
placeholder
Link copied to clipboard
js
open override val placeholder: DynamicComponentProperty<String>
readonly
Link copied to clipboard
js
open override val readonly: DynamicComponentProperty<Boolean>
renderTooltip
Link copied to clipboard
js
open override val renderTooltip: ComponentProperty<Tag<HTMLElement>.() -> Unit>
severity
Link copied to clipboard
js
open override val severity: NullableDynamicComponentProperty<Severity?>
size
Link copied to clipboard
js
open override val size: ComponentProperty<FormSizesStyles.() -> Style<BasicParams>>
step
Link copied to clipboard
js
val step: DynamicComponentProperty<String>
type
Link copied to clipboard
js
val type: DynamicComponentProperty<String>
value
Link copied to clipboard
js
val value: DynamicComponentProperty<String>
variant
Link copied to clipboard
js
open override val variant: ComponentProperty<InputFieldVariants.() -> Style<BasicParams>>