Skip to content

Input

An enhanced base input built on the native <input> element.

Basic Usage

Basic usage

Accessible Name (label)

label (accessible name)

label serves as the accessible name (aria-label) source for the input, announced by screen readers. When label is not set, it falls back to placeholder → built-in text "输入框"; once set (e.g. "Login email"), it overrides the fallback chain.

Types

type

type is passed through to the native input type, supporting text / password / number / email, etc.

Password Visibility Toggle

show-password

With show-password and type="password", an eye button is rendered on the right side of the input; clicking toggles between plaintext and masked text. The button has an aria-label (locale text), aria-pressed, and a focus ring when focused.

Clearable

clearable

When there is content and clearable is set, a clear button is shown; clicking clears the value, refocuses, and dispatches oas-clear.

Disabled & Readonly

disabled / readonly

Addons

addon-before / addon-after

addon-before / addon-after render external addon text blocks (e.g. units, domains) outside the input, going through dedicated ::part(prepend) / ::part(append) parts; addons are greyed out when disabled.

Icons

prefix-icon / suffix-icon

prefix-icon / suffix-icon accept icon names (from @oas-isui/icons iconRegistry) and inline-render decorative SVG icons.

Inline Affixes & Clear Together

prefix / suffix + clearable

prefix / suffix are inline text inside the input and can coexist with clearable, icons, and addons without conflicts.

Character Count

show-count + maxlength

show-count displays a character counter at the bottom-right of the input: with maxlength it shows current/maxlength, without it just the current length; maxlength is also passed through to the native input to limit input length. When the limit is exceeded, the counter number turns danger-colored.

Enter Submit Event

oas-enter

Pressing Enter while typing (not an IME composition commit) dispatches oas-enter with detail: { value }.

Events

Input and clear events

Listen to oas-input (while typing) and oas-clear (on clear):

API

Attributes

AttributeDescriptionTypeDefault
addon-afterAddon text block after the inputstring
addon-beforeAddon text block before the inputstring
clearableClearableboolean
disabledDisabledboolean
labelAccessible name (aria-label source; falls back to placeholder → built-in "输入框" when unset)
maxlengthMaximum input length (passed through to native maxlength)string
placeholderPlaceholder textstring
prefixInline text before the input valuestring
prefix-iconIcon name for the leading iconstring
readonlyReadonlyboolean
show-countShow character count (bottom-right; danger when over limit)boolean
show-passwordPassword visibility toggle (renders an eye button when type="password")boolean
suffixInline text after the input valuestring
suffix-iconIcon name for the trailing iconstring
typeNative input typestringtext
valueValue (controlled)string

Events

EventDescription
oas-clearCleared by click, detail: { originalEvent }
oas-enterEnter pressed (not IME composition), detail: { value }
oas-inputWhile typing, detail: { value }