Overview
InputText is a versatile text input component that supports labels, error messages, validation states, and various sizing options. It includes debounced input handling and can be stacked with other components.Props
Unique identifier for the input element. If not provided, a random ID is generated.
Label text displayed above the input field.
Placeholder text shown when the input is empty.
Error message displayed below the input. When present, the input displays an error state.
When true, the input is read-only and styled as disabled.
The input value. This prop is bindable using
bind:value.When true, the input automatically receives focus when mounted.
When true, styles the input for stacking with a component on its left side.
When true, styles the input for stacking with a component on its right side.
Custom width class for the input. If not provided, defaults to full width.
Size variant of the input:
xs: Height 26pxsm: Height 28pxmd: Height 32px
Callback fired when the input value changes. Debounced by 750ms.
Callback fired when the input receives focus.
Callback fired when the input loses focus.
Callback fired when a key is pressed while the input is focused.
Usage
Basic Input
With Error State
Different Sizes
Stacked with Other Components
Auto-focus on Load
With Event Handlers
Features
- Debounced Input: The
oninputcallback is automatically debounced by 750ms to reduce excessive function calls - Error Validation: Built-in error state styling with error message display
- Accessibility: Properly linked labels using the
forattribute - Flexible Sizing: Three size variants to fit different UI contexts
- Stackable Design: Can be combined with other components using
stackLeftandstackRightprops