Skip to content

net.kernelpanicsoft.archie.gui.composables.input

Types

data class DropdownOption<T>(
    val value: T, 
    val label: Component, 
    val enabled: Boolean = true
)

One selectable entry of a Dropdown.

RadioOption

data class RadioOption<T>(
    val value: T, 
    val label: Component, 
    val enabled: Boolean = true
)

A single labeled choice within a RadioGroup.

Functions

Button

@Composable



fun Button(
    onClick: (UINode) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    texture: String = "button", 
    variant: String = ThemeVariants.DEFAULT, 
    ignoreMinSize: Boolean = false, 
    content: @Composable



 () -> Unit = {}
)

A standard themed, clickable button.

ButtonCore

@Composable



fun ButtonCore(
    onClick: (UINode) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    content: @Composable



 (isHovered: Boolean, isPressed: Boolean, isFocused: Boolean) -> Unit
)

A stateless clickable container composable.

Checkbox

@Composable



fun Checkbox(
    checked: Boolean = false, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    texture: String = "checkbox", 
    variant: String = ThemeVariants.DEFAULT, 
    onCheckedChange: (Boolean) -> Unit
)

A standard themed checkbox.

CheckboxCore

@Composable



fun CheckboxCore(
    checked: Boolean = false, 
    enabled: Boolean = true, 
    onCheckedChange: (Boolean) -> Unit, 
    content: @Composable



 (modifier: Modifier, isHovered: Boolean, isFocused: Boolean) -> Unit
)

A stateless, unstyled toggle composable, built on Modifier.toggleable.

Clickable

@Composable



fun Clickable(
    onClick: (UINode) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    showHandCursor: Boolean = true, 
    interactionSource: MutableInteractionSource = remember { MutableInteractionSource() }, 
    onAuxClick: (UINode, Int) -> Unit? = null, 
    content: @Composable



 (isHovered: Boolean, isPressed: Boolean, isFocused: Boolean) -> Unit
)

Low-level unstyled clickable container used by higher-level inputs like ButtonCore.

ColorPicker

@Composable



fun ColorPicker(
    color: HsvColor, 
    showAlphaBar: Boolean = true, 
    alphaBarHeight: Int = 12, 
    hueBarWidth: Int = 16, 
    barPadding: Int = 8, 
    modifier: Modifier = Modifier, 
    onColorChanged: (HsvColor) -> Unit
)

A fully controlled HSV + alpha colour picker composable.

@Composable



fun <T> Dropdown(
    options: List<DropdownOption<T>>, 
    selected: T?, 
    onSelected: (T) -> Unit, 
    modifier: Modifier = Modifier, 
    placeholder: Component = Component.literal("Select..."), 
    enabled: Boolean = true, 
    width: Int = 120, 
    maxVisibleOptions: Int = 5
)

A single-choice select: a trigger showing the current selection, which opens into a list.

RadioButton

@Composable



fun RadioButton(
    selected: Boolean, 
    onSelect: () -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    texture: String = "radio", 
    variant: String = ThemeVariants.DEFAULT
)

A standard themed radio button with a filled center dot when selected.

RadioButtonCore

@Composable



fun RadioButtonCore(
    selected: Boolean, 
    onSelect: () -> Unit, 
    enabled: Boolean = true, 
    content: @Composable



 (modifier: Modifier, isHovered: Boolean, isFocused: Boolean, selected: Boolean) -> Unit
)

Low-level unstyled radio-button behavior, built on Modifier.selectable.

RadioGroup

@Composable



fun <T> RadioGroup(
    options: List<RadioOption<T>>, 
    selected: T?, 
    onSelected: (T) -> Unit, 
    modifier: Modifier = Modifier, 
    optionSpacing: Int = 3
)

A vertical list of labeled, mutually exclusive RadioButtons.

Slider

@Composable



fun Slider(
    value: Float, 
    onValueChange: (Float) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    variant: String = ThemeVariants.DEFAULT, 
    steps: Int = 0, 
    onValueChangeFinished: () -> Unit = {}
)

A standard themed horizontal slider, drawing a "slider" track, "slider_handle" thumb, and "slider_fill" progress fill up to the thumb, all from the current theme.

SliderCore

@Composable



fun SliderCore(
    value: Float, 
    onValueChange: (Float) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    steps: Int = 0, 
    onValueChangeFinished: () -> Unit = {}, 
    content: @Composable



 (isHovered: Boolean, isDragging: Boolean, isFocused: Boolean, normalizedValue: Float) -> Unit
)

Low-level unstyled slider behavior: drag/click-to-position, hover/drag/focus state tracking, with no visuals of its own.

Switch

@Composable



fun Switch(
    checked: Boolean, 
    onCheckedChange: (Boolean) -> Unit, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    trackTexture: String = "switch_track", 
    thumbTexture: String = "switch_thumb", 
    variant: String = ThemeVariants.DEFAULT
)

Simple styled switch control suitable for toggling boolean settings.

SwitchCore

@Composable



fun SwitchCore(
    checked: Boolean, 
    onCheckedChange: (Boolean) -> Unit, 
    enabled: Boolean = true, 
    content: @Composable



 (modifier: Modifier, isHovered: Boolean, isFocused: Boolean, checked: Boolean) -> Unit
)

Low-level switch primitive exposing hover/focus state and checked state to custom visuals. Built on Modifier.toggleable, so it's a vanilla keyboard/controller focus-navigation stop that toggles on Enter/Space while focused, the same as a mouse click.

TextButton

@Composable



fun TextButton(
    text: Component, 
    color: KColor = LocalTheme.current.lightTextColor, 
    modifier: Modifier = Modifier, 
    enabled: Boolean = true, 
    texture: String = "button", 
    variant: String = ThemeVariants.DEFAULT, 
    onClick: (UINode) -> Unit
)