Skip to content

Input & Label ​

Displays a form input field. Pair it with SLabel, or use SField for label, description and error.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

With label ​

SLabel: text-sm font-medium leading-none.

Approximate web preview — the HarmonyOS rendering is the reference.

Types & states ​

Approximate web preview — the HarmonyOS rendering is the reference.

Sizes ​

sizing: 'sm' (32) | 'default' (36) | 'lg' (40).

Approximate web preview — the HarmonyOS rendering is the reference.

Icons, clear button, counter ​

icon / iconRight, clearable (× while there is text) and showCount (length/maxLength).

Approximate web preview — the HarmonyOS rendering is the reference.

Controlled ​

Bind the value with !! like v-model.

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

Extracted from the @Param / @Event / @BuilderParam declarations in the library sources.

SInput ​

shadcn-vue Input: h-9 w-full rounded-md border px-3 py-1 text-sm, styled on the native TextInput.

Variants: sizing sm | default | lg, leading icon / trailing iconRight (lucide names), clearable (an × that empties the field while it has text), showCount (12/80 counter, uses maxLength) and the invalid error state.

inputType instead of type (native enum clash). Inside an invalid SField the invalid look is applied automatically; inside a horizontal SField it takes the remaining row width. modifier styles the inner TextInput.

PropTypeDefaultDescription
value!!string | undefinedundefinedControlled value (use with !!). Leave undefined for uncontrolled.
defaultValuestring''
placeholderResourceStr''
inputTypeInputKind
InputKind = 'text' | 'password' | 'email' | 'number'
'text'
invalidbooleanfalse
disabledbooleanfalse
maxLengthnumber | undefinedundefined
sizingInputSize
InputSize = 'sm' | 'default' | 'lg'
'default'
iconstring | undefinedundefinedLeading lucide icon (muted).
iconRightstring | undefinedundefinedTrailing lucide icon (muted).
clearablebooleanfalseTrailing × that clears the text (shown while there is text).
showCountbooleanfalseTrailing character counter (length/maxLength).
labelstring | undefinedundefinedAccessible name when there is no visible label.
modifierAttributeModifier<TextInputAttribute>new SparkNoopModifier<TextInputAttribute>()Extra styles applied after the recipe (wins on conflicts).
tokensInputTokens{}Per-instance token overrides (instance → theme --input-* → recipe), see {@link InputTokens}.
EventTypeDefaultDescription
onValueChange(v: string) => void() => { }
onSubmit(v: string) => void() => { }Enter / IME action pressed; receives the current value.

SLabel ​

shadcn-vue Label: flex items-center gap-2 text-sm leading-none font-medium select-none, opacity-50 when the associated control is disabled (disabled param here, since ArkUI has no peer-disabled).

PropTypeDefaultDescription
textResourceStr | undefinedundefined
requiredbooleanfalseAppends a destructive *.
disabledbooleanfalseDisabled look (opacity 50%).

Slots: children (trailing closure)

MIT Licensed