net.kernelpanicsoft.archie.gui.composables.input.textfield¶
Types¶
TextFieldState¶
@Stable
class TextFieldState
Internal mutable state for a text field, tracking focus, scroll position, cursor blink, and layout dimensions.
TextFieldValue¶
@Immutable
data class TextFieldValue(
val text: String = "",
val selection: TextRange = TextRange(text.length),
val composition: TextRange? = null
)
Immutable value holder for a net.kernelpanicsoft.archie.gui.composables.input.textfield.TextField or BasicTextField.
TextRange¶
Represents a half-open character range [start, end) within a text field's content string.
Functions¶
BasicTextField¶
@Composable
fun BasicTextField(
value: String,
onValueChange: (String) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
readOnly: Boolean = false,
textColor: KColor = KColor.ofRgb(0xE0E0E0),
cursorColor: KColor = KColor.ofRgb(0xFFD0D0D0.toInt()),
selectionColor: KColor = KColor.ofRgb(-16776961),
font: Font = Minecraft.getInstance().font,
singleLine: Boolean = true,
maxLength: Int = Int.MAX_VALUE,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE
)
A simple, controlled text field that uses a plain String as its state.
rememberTextFieldState¶
@Composable
fun rememberTextFieldState(): TextFieldState
Creates and remembers a TextFieldState instance.
TextField¶
@Composable
fun TextField(
value: TextFieldValue,
onValueChange: (TextFieldValue) -> Unit,
modifier: Modifier = Modifier,
enabled: Boolean = true,
readOnly: Boolean = false,
textColor: KColor = KColor.ofRgb(0xE0E0E0),
cursorColor: KColor = KColor.ofRgb(0xFFD0D0D0.toInt()),
selectionColor: KColor = KColor.ofRgb(-16776961),
font: Font = Minecraft.getInstance().font,
singleLine: Boolean = true,
maxLength: Int = Int.MAX_VALUE,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE
)
A fully controlled text field composable with the default Minecraft widget appearance.
TextFieldCore¶
@Composable
fun TextFieldCore(
value: TextFieldValue,
onValueChange: (TextFieldValue) -> Unit,
font: Font,
modifier: Modifier = Modifier,
enabled: Boolean = true,
readOnly: Boolean = false,
singleLine: Boolean = true,
maxLength: Int = Int.MAX_VALUE,
maxLines: Int = if (singleLine) 1 else Int.MAX_VALUE,
content: @Composable
(state: TextFieldState) -> Unit
)
Core composable that handles all state, focus, and input logic for a text field while delegating visual rendering entirely to content.