mirror of
https://github.com/InsanusMokrassar/JSUIKitKBindings.git
synced 2024-11-16 13:23:58 +00:00
31 lines
724 B
Kotlin
31 lines
724 B
Kotlin
package dev.inmo.jsuikit.elements
|
|
|
|
import androidx.compose.runtime.*
|
|
import dev.inmo.jsuikit.modifers.UIKitModifier
|
|
import dev.inmo.jsuikit.modifers.include
|
|
import org.jetbrains.compose.web.attributes.*
|
|
import org.jetbrains.compose.web.dom.Input
|
|
|
|
@Composable
|
|
fun <T> TextField(
|
|
type: InputType<T>,
|
|
state: MutableState<T>,
|
|
disabledState: State<Boolean>? = null,
|
|
placeholder: String? = null,
|
|
vararg modifiers: UIKitModifier
|
|
) {
|
|
Input(type) {
|
|
classes("uk-input")
|
|
include(*modifiers)
|
|
|
|
placeholder ?.let(::placeholder)
|
|
|
|
onChange { state.value = it.value }
|
|
disabledState ?.let {
|
|
if (it.value) {
|
|
disabled()
|
|
}
|
|
}
|
|
}
|
|
}
|