KOutlinedButton - farimarwat/KrossUi GitHub Wiki

📘 KOutLinedButton Component Documentation

A cross-platform outlined button for Kotlin Multiplatform apps with customizable styles.


🔹 Overview

Element Type Description
KOutLinedButton Composable Public API for a customizable cross-platform outlined button.
KOutLinedButtonColors Data Class Holds color values for button states and borders.
KOutLinedButtonDefaults Object Supplies default styling options for the outlined button.

🧩 KOutLinedButton

Definition:
A composable that renders an outlined button, styled per platform norms.

Parameters

Parameter Type Default Description
modifier Modifier Modifier Modifier to apply layout behavior.
text String The text displayed inside the button.
onClick () -> Unit Function triggered when the button is clicked.
colors KOutLinedButtonColors KOutLinedButtonDefaults.colors() Styling for background, text, and borders.
fontSize TextUnit KOutLinedButtonDefaults.DefaultFontSize Font size for the button text.
cornerRadius Double KOutLinedButtonDefaults.CornerRadius Radius for rounded corners.
borderWidth Double KOutLinedButtonDefaults.BorderWidth Width of the button border in dp.
isEnabled Boolean true Whether the button is interactive.

🎨 KOutLinedButtonColors

Defines all color states for the outlined button, including border and disabled states.

Properties

Property Type Description
backgroundColor Color Background color when the button is enabled.
textColor Color Text color when the button is enabled.
disabledBackgroundColor Color Background color when the button is disabled.
disabledTextColor Color Text color when the button is disabled.
borderColor Color Border color when the button is enabled.
disabledBorderColor Color Border color when the button is disabled.

⚙️ KOutLinedButtonDefaults

Supplies standard styles and colors for the KOutLinedButton.

🎛️ colors(...)

Creates a KOutLinedButtonColors instance with customizable values.

Parameter Type Default Description
containerColor Color PlatformColors.systemBackground Background when enabled.
contentColor Color PlatformColors.systemBlue Text color when enabled.
disabledBackgroundColor Color containerColor.copy(alpha = 0.3f) Background when disabled.
disabledTextColor Color contentColor.copy(alpha = 0.3f) Text color when disabled.
borderColor Color PlatformColors.systemBlue Border color when enabled.
disabledBorderColor Color borderColor.copy(alpha = 0.3f) Border color when disabled.

🔤 DefaultFontSize

Value Description
14.sp The default font size for button text.

🟦 CornerRadius

Value Description
8.0 Default corner radius of the button.

➖ BorderWidth

Value Description
1.0 Default border width for the button.

✅ Usage Example

KOutLinedButton(
    modifier = Modifier
        .weight(0.5f),
    text = "Help Me",
    borderWidth = 2.0,
    onClick = {
        // Your click logic here
    }
)