Skip to main content

BwInput | bw-input

Overview

Input is a form control that allows the user to enter text. It can be used as a single line input or a multiline input. It has a dropdown slot to transform the component into a combobox.

Usage

States

search
<div style="display: flex; gap: 4px; flex-direction: column;">
<bw-input></bw-input>
<bw-input placeholder="Type something..."></bw-input>
<bw-input label="Name" placeholder="Enter your name"></bw-input>
<bw-input type="search">
<bw-icon slot="start">search</bw-icon>
</bw-input>
</div>

Properties

PropertyAttributeDescriptionTypeDefault
autoCapitalizeauto-capitalizePassed to native inputstring'off'
autoCompleteauto-completePassed to native inputstring'off'
autoCorrectauto-correctPassed to native input"off" | "on"'off'
autoFocusauto-focusPassed to native inputbooleanundefined
debouncedebounceOptional debounce of the didInput eventnumber0
disableddisabledRenders input as disabled and prevents changesbooleanfalse
errorerrorShows an error icon in the end slot when true. If a string is passed in, it will render the icon as a tooltip. Has no effect on form validationanyundefined
formatformatFormatters functions that are applied as the user types(newValue: string, oldValue?: string, ev?: InputEvent) => string | Promise<string>undefined
hidePasswordIconhide-password-iconWhether to hide the password iconbooleanfalse
hidePickerhide-pickerWhether to hide the calendar iconbooleanfalse
inputModeinput-modePassed to native inputstringundefined
labellabelText above the controlstring''
listlistPassed to native inputstringundefined
maxmaxPassed to native inputanyundefined
maxlengthmaxlengthPassed to native inputnumberundefined
minminPassed to native inputanyundefined
minlengthminlengthPassed to native inputnumberundefined
multilinemultilineWhether the control is a multiline textareabooleanfalse
notenoteInformational message directly below the controlstringundefined
offsetXoffset-xX offset of the dropdownnumber0
offsetYoffset-yY offset of the dropdownnumber10
originalValueoriginal-valueThe default value the control will reset to in a form. If not set, will default to the inital value of the "value" property.stringundefined
patternpatternPassed to native inputstringundefined
pendingpendingShows a loading indicator in the end slot when truebooleanfalse
placeholderplaceholderInput placeholder textstring''
readonlyreadonlyRenders input as read only and prevents changesbooleanfalse
requiredrequiredMarks as required in form and adds asterisk to the end of the labelbooleanfalse
sizesizeContainer size"large" | "medium" | "small"'small'
spellcheckspellcheckPassed to native inputbooleanfalse
stepstepPassed to native inputstringundefined
successsuccessShows a success icon in the end slot when true. Has no effect on form validationbooleanfalse
timeZonetime-zoneTime zone for the built in date and datetime transformers. Defaults to the browser's time zone if not set. You can set this value globally by setting window.blueWater?.defaultTimeZone to the desired time zone.stringundefined
transformtransformTransforms the value before it is passed to the input (from) and after the input emits a new value (to). There are built-in transformers for 'number', 'date', and 'datetime'."date" | "datetime" | "number" | ({ to?: (value: string) => any; from?: (value: any) => string; })undefined
typetypePassed to native inputstring'text'
validatorsvalidatorsValidator functions for form participationValidationFn[]undefined
valuevalueCurrent value of the inputany''
wrapwrapPassed to native textareastringundefined

Events

EventDescriptionType
dropdownDismissEmits when the dropdown is closedCustomEvent<any>
dropdownPresentEmits when the dropdown is openedCustomEvent<any>
valueChangeEmits as the user typesCustomEvent<any>
valueSubmitEmits whenever the user hits enter or the control loses focusCustomEvent<any>

Methods

dismissDropdown() => Promise<void>

Dismisses the dropdown

Returns

Type: Promise<void>

getErrors() => Promise<{ requiredError: boolean; minLengthError: boolean; maxLengthError: boolean; patternError: boolean; customErrors: string[]; badInputError: boolean; hasError: boolean; }>

Returns the errors of the input

Returns

Type: Promise<{ requiredError: boolean; minLengthError: boolean; maxLengthError: boolean; patternError: boolean; customErrors: string[]; badInputError: boolean; hasError: boolean; }>

getInputElement() => Promise<HTMLInputElement>

Returns the input element

Returns

Type: Promise<HTMLInputElement>

getIsTouched() => Promise<boolean>

Returns whether the input is touched

Returns

Type: Promise<boolean>

isDropdownOpen() => Promise<boolean>

Returns whether the dropdown is open

Returns

Type: Promise<boolean>

markAsTouched() => Promise<void>

Marks the input as touched

Returns

Type: Promise<void>

presentDropdown() => Promise<void>

Presents the dropdown

Returns

Type: Promise<void>

togglePassword() => Promise<void>

Toggles the password visibility

Returns

Type: Promise<void>

Slots

SlotDescription
"after"Elements placed here will be to the right of the input, outside the container
"before"Elements placed here will be to the left of the input, outside the container
"dropdown"Place a BwMenu here to use the input as a combobox
"end"Elements placed here will be to the left of the input, inside the container
"label"Goes above the input, intended for a BwLabel
"note"Goes below the input, intended for a BwNote
"start"Elements placed here will be to the right of the input, inside the container

Shadow Parts

PartDescription
"container"The container of the input
"dropdown"The dropdown container
"label"The label of the input
"native-input"The native input element
"native-textarea"The native textarea element
"note"The note of the input
"outer-container"The container where the before/after slots are.

CSS Custom Properties

NameDescription
--backgroundThe background of the input
--borderThe border of the input
--heightThe height of the input
--input-colorThe color of the input
--label-colorThe color of the label
--multiline-heightThe height of the multiline input
--padding-inlineThe padding of the input
--placeholder-colorThe color of the placeholder

Dependencies

Used by

Depends on

Graph


© 2025 United Systems & Software - All Rights Reserved.