Input

A text input component UI is a widely used element in web and mobile applications for capturing short, single-line text input from users. It is typically used for things like collecting names, emails, search queries, or any other type of single-line text data.

TypeResource
DesignFigma
WebWeb Storybook
CodeGitlab
Input preview

Usage

import id.co.biofarma.binduiandroid.components.textinput.Textinput
fun TextInput(
    id: String = "",
    variant: String = "outline",
    type: String = "text",
    label: String= "textinput",
    value: TextFieldValue = TextFieldValue(""),
    placeholder: String = "",
    helperText: String = "",
    errorText: String = "",
    maxText: Int = 0,
    showCount: Boolean = false,
    disabled: Boolean = false,
    isError: Boolean = false,
    isRequired: Boolean = false,
    prefixAddsOn: String = "",
    suffixAddsOn: String = "",
    startIcon: @Composable (() -> Unit)? = null,
    endIcon: @Composable (() -> Unit)? = null,
    labelIcon: @Composable (() -> Unit)? = null,
    size: String = ComponentSize.MD.value,
    radius: String = ComponentRadius.MD.value,
    mode: String = ThemeMode.LIGHT.value,
    style: Modifier = Modifier,
    onChange: (TextFieldValue) -> Unit = {},
)

Examples

Variant

Use variant to change variant of input component: outline, background, underline

Input preview 2

AddOns (Optional)

input addons can be used to extend a simple input field by adding extra components like buttons, icons, or tooltips inside or next to the input field.

Input preview 3

Mode (Optional)

Use mode for change color mode on input component: light and dark

Input preview 4

Props

PropsRequiredDefaultTypeDescription
idtrue-stringThe unique identifier for the input component, useful for accessibility and targeting specific elements.
variantfalseoutlineoutline, background, underlineDetermines the visual style of the input field, such as outlined, with background color, or underlined.
typefalsetexttext, password, numberSpecifies the type of input field, such as text (default), password (for sensitive data), or number (for numeric input).
labeltruetextinputstringThe label text that describes the input field, displayed above or beside the input box.
valuetrue-TextFieldValueThe current value of the input field, typically bound to a state or model for data handling.
placeholdertrueenter textstringPlaceholder text displayed in the input field when it is empty, guiding the user on what to enter.
maxTexttrue50integerThe maximum length of text allowed in the input field. It helps control the amount of user input.
helperTexttruehelper textstringProvides additional information or instruction below the input field, such as usage tips or requirements.
errorTexttrueerror textstringText displayed below the input when there is an error, indicating invalid input or a validation issue.
showCounttruefalsebooleanIndicates whether to display a character count below the input, showing how many characters have been entered.
isErrorfalsefalsebooleanA flag indicating whether the input field should display an error state, such as a red border.
isRequiredfalsefalsebooleanIndicates whether the input field is required, often reflected by an asterisk next to the label.
disabledfalsefalsebooleanDisables the input field, preventing the user from interacting with it or entering data.
sizefalsesmsm, md, lgDefines the size of the input field, which could be small (sm), medium (md), or large (lg).
prefixAddsOnfalse-stringAllows the addition of a prefix (like a currency symbol or an icon) at the beginning of the input field.
suffixAddsOnfalse-stringAllows the addition of a suffix (like a unit or a button) at the end of the input field.
showStartIconfalsefalsebooleanIndicates whether an icon should be displayed at the start (left side) of the input field.
showEndIconfalsefalsebooleanIndicates whether an icon should be displayed at the end (right side) of the input field.
showLabelIconfalsefalsebooleanIndicates whether an icon should be displayed next to the label, often used for a visual cue or a specific action (e.g., a search icon next to the label).
BIND © Biofarma Innovate Next-level Design .