Skip to main content

Input

<sc-input></sc-input>

Inputs collect data from the user.

Placeholder

Clearable

Disabled

Sizes



Prefix and Suffix

👍🏻👍🏻
👍🏻👍🏻
👍🏻👍🏻

Labels

Help Text

Component Codex

Properties

PropertyDescriptionTypeDefault
autocompleteThe input's autocomplete attribute.string
autocorrectThe input's autocorrect attribute.string
autofocusThe input's autofocus attribute.boolean
clearableAdds a clear button when the input is populated.booleanfalse
disabledDisables the input.booleanfalse
hasFocusInputs focusboolean
helpThe input's help text.string''
hiddenHiddenbooleanfalse
inputmodeThe input's inputmode attribute."decimal" | "email" | "none" | "numeric" | "search" | "tel" | "text" | "url"
invalidThis will be true when the control is in an invalid state. Validity is determined by props such as `type`, `required`, `minlength`, `maxlength`, and `pattern` using the browser's constraint validation API.booleanfalse
labelThe input's label.string
maxThe input's maximum value.number | string
maxlengthThe maximum length of input that will be considered valid.number
minThe input's minimum value.number | string
minlengthThe minimum length of input that will be considered valid.number
nameThe input's name attribute.string
patternA pattern to validate input against.string
pillDraws a pill-style input with rounded edges.booleanfalse
placeholderThe input's placeholder text.string
readonlyMakes the input readonly.booleanfalse
requiredMakes the input a required field.booleanfalse
showLabelShould we show the labelbooleantrue
sizeThe input's size."large" | "medium" | "small"'medium'
spellcheckEnables spell checking on the input.boolean
squaredboolean
squaredBottomboolean
squaredLeftboolean
squaredRightboolean
squaredTopboolean
stepThe input's step attribute.number
togglePasswordAdds a password toggle button to password inputs.booleanfalse
typeThe input's type."email" | "hidden" | "number" | "password" | "search" | "tel" | "text" | "url"'text'
valueThe input's value attribute.string''

Events

EventDescriptionType
scBlurEmitted when the control loses focus.CustomEvent<void>
scChangeEmitted when the control's value changes.CustomEvent<void>
scClearEmitted when the clear button is activated.CustomEvent<void>
scFocusEmitted when the control gains focus.CustomEvent<void>
scInputEmitted when the control receives input.CustomEvent<void>

Methods

reportValidity() => Promise<boolean>

setCustomValidity(message: string) => Promise<void>

Sets a custom validation message. If `message` is not empty, the field will be considered invalid.

triggerBlur() => Promise<void>

Removes focus from the input.

triggerFocus(options?: FocusOptions) => Promise<void>

Sets focus on the input.

Shadow Parts

PartDescription
baseThe elements base wrapper.
clear-button
form-controlThe form control wrapper.
help-textHelp text that describes how to use the input.
inputThe html input element.
labelThe input label.
prefixUsed to prepend an icon or element to the input.
suffixUsed to prepend an icon or element to the input.