Inputs and Fields
InputTypePartMap
Maps an <input>
's type
to a string value that will be used as a part
value for <input>
s of that type
.
Optional second parameter of the assignInputTypeToPart()
function.
The InputTypePartMap
object is a configuration object and each of its properties act like keys. It does not expose any methods.
The configuration does include an additional property which maps <input>
s that have a type of text
and also an inputmode
attribute with a value of numeric
. Those <input>
s can be mapped separately in case "numeric" <input>
s should be styled differently than text
<input>
s.
Properties
Name | Description | Value Type | Default Value |
---|---|---|---|
button
|
Maps to |
string
|
"button"
|
checkbox
|
Maps to |
string
|
"checkbox"
|
color
|
Maps to |
string
|
"color"
|
date
|
Maps to |
string
|
"date"
|
"datetime-local"
|
Maps to |
string
|
"datetime-local"
|
email
|
Maps to |
string
|
"email"
|
file
|
Maps to |
string
|
"file"
|
hidden
|
Maps to |
string
|
"hidden"
|
image
|
Maps to |
string
|
"image"
|
month
|
Maps to |
string
|
"month"
|
number
|
Maps to |
string
|
"number"
|
password
|
Maps to |
string
|
"password"
|
radio
|
Maps to |
string
|
"radio"
|
range
|
Maps to |
string
|
"range"
|
reset
|
Maps to |
string
|
"reset"
|
search
|
Maps to |
string
|
"search"
|
submit
|
Maps to |
string
|
"submit"
|
tel
|
Maps to |
string
|
"tel"
|
text
|
Maps to |
string
|
"text"
|
time
|
Maps to |
string
|
"time"
|
url
|
Maps to |
string
|
"url"
|
week
|
Maps to |
string
|
"week"
|
"text-numeric"
|
Maps to |
string
|
"number"
|
Methods
assignInputTypeToPart
Return Type
undefined
Takes a shadow root and an optional configuration object as parameters and then queries for all of the child <input>
elements.
For each element returned by the query, the function assigns the element's type
attribute value to its part
attribute.
Parameters
Name | Description | Value Type | Default Value |
---|---|---|---|
shadowRoot
|
The shadow root of the target custom element. |
ShadowRoot
|
|
config?
|
Optional An |
InputTypePartMap
|
undefined
|
assignFormFieldPartAttributes
Return Type
undefined
*Note: The <form-field>
element is a custom element. This function only processes that specific custom element.
Takes a shadow root and an optional configuration object as parameters and then queries for all of the child <form-field>
elements.
For each element returned by the query, the function assigns part
values to the field element and its children, prefixed by field-
and corresponding to the element's role in the field.
Parameters
Name | Description | Value Type | Default Value |
---|---|---|---|
shadowRoot
|
The shadow root of the target custom element. |
ShadowRoot
|
undefined
|