Skip to content

Input Group ​

Add icons, text or buttons to an input. The group draws the border and shows the focus ring while its input is focused; tapping an addon focuses the input.

Usage ​

Approximate web preview — the HarmonyOS rendering is the reference.

Text ​

Prefixes and suffixes with SInputGroupText.

Approximate web preview — the HarmonyOS rendering is the reference.

Button ​

Compact buttons inside the field (xs, sm, icon-xs, icon-sm).

Approximate web preview — the HarmonyOS rendering is the reference.

Block addons & invalid ​

block-start / block-end span the full width.

Approximate web preview — the HarmonyOS rendering is the reference.

API ​

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

SInputGroup ​

shadcn-vue InputGroup (v4): one bordered field holding an input plus addons (icons, text, buttons). The group draws the border and the focus ring (has-[:focus]:border-ring ring-ring/50 ring-[3px]) while its inner SInputGroupInput is focused.

Write the parts in visual order: ArkUI cannot reorder slot children (order-first / order-last). Block addons (block-start / block-end) span the full width and sit on their own line above / below the input. Tapping an addon focuses the input.

PropTypeDefaultDescription
invalidbooleanfalse
disabledbooleanfalse
modifierAttributeModifier<FlexAttribute>new SparkNoopModifier<FlexAttribute>()

Slots: children (trailing closure)

SInputGroupAddon ​

Addon area: text-muted-foreground flex items-center gap-2 py-1.5 text-sm font-medium, with pl-3 (inline-start), pr-3 (inline-end), or full width px-3 pt-3 / px-3 pb-3 (block-start / block-end). Tapping it focuses the group's input.

PropTypeDefaultDescription
alignmentInputGroupAddonAlignment
InputGroupAddonAlignment = 'inline-start' | 'inline-end' | 'block-start' | 'block-end'
'inline-start'

Slots: children (trailing closure)

SInputGroupText ​

Muted text / icon inside an addon: text-muted-foreground flex items-center gap-2 text-sm.

PropTypeDefaultDescription
textResourceStr | undefinedundefined
iconstring | undefinedundefinedLeading lucide icon (16vp).

Slots: children (trailing closure)

SInputGroupButton ​

Compact button for addons: shadcn InputGroupButton (shadow-none, sizes xs h-6 px-2, sm h-8 px-2.5, icon-xs size-6, icon-sm size-8; default variant ghost). Clicks: native .onClick() on the component.

PropTypeDefaultDescription
textResourceStr | undefinedundefined
iconstring | undefinedundefinedLeading lucide icon name.
variantButtonVariant
ButtonVariant = 'default' | 'destructive' | 'outline' | 'secondary' | 'ghost' | 'link'
'ghost'
sizingInputGroupButtonSize
InputGroupButtonSize = 'xs' | 'sm' | 'icon-xs' | 'icon-sm'
'xs'
disabledbooleanfalse
labelstring | undefinedundefinedAccessible name; required for icon-only buttons.

SInputGroupInput ​

The group's text control: an SInput-styled TextInput without its own border / ring (flex-1 rounded-none border-0 bg-transparent shadow-none). Same value API as SInput.

PropTypeDefaultDescription
value!!string | undefinedundefinedControlled value (use with !!). Leave undefined for uncontrolled.
defaultValuestring''
placeholderResourceStr''
inputTypeInputKind
InputKind = 'text' | 'password' | 'email' | 'number'
'text'
maxLengthnumber | undefinedundefined
labelstring | undefinedundefinedAccessible name when there is no visible label.
modifierAttributeModifier<TextInputAttribute>new SparkNoopModifier<TextInputAttribute>()
EventTypeDefaultDescription
onValueChange(v: string) => void() => { }
onSubmit(v: string) => void() => { }

MIT Licensed