input
Use this block for creating different types of text fields.
Overview
Modifiers of the block
Modifier |
Acceptable values |
Use cases |
Description |
type |
'password' , 'search' |
BEMJSON |
The type of the text field. |
width |
'available' |
BEMJSON |
The maximum allowed width of the text field. |
has-clear |
true |
BEMJSON |
The element that clears the input field content. |
disabled |
true |
BEMJSON , JS |
The disabled state. |
focused |
true |
BEMJSON , JS |
The block is in focus. |
theme |
'islands' |
BEMJSON |
A custom design. |
size |
's' , 'm' , 'l' , 'xl' |
BEMJSON |
The size of the text field. Use sizes only for text fields when the theme modifier is set to islands. |
Custom fields of the block
Field |
Type |
Description |
name |
String |
The unique block name. |
val |
String , Number |
Default content of the text field. |
placeholder |
String |
The hint in the text field. |
maxLength |
String |
The maximum number of characters allowed in the text field. |
autocomplete |
Boolean |
Browser predictions of the rest of a word while a user is typing. |
id |
String |
The unique identifier of the text field. |
tabIndex |
Number |
The order when navigating through controls on a page by pressing the Tab key. |
Block description
Use the input
block to control the size, state and appearance of the text fields.
Modifiers of the block
type
modifier
Acceptable values:'password'
, 'search'
.
Use case: BEMJSON
.
This modifier changes types of the text fields.
If the type
modifier is not set, the input
block is a common text field by default.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Enter your name'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
Password field (type
modifier with password
value)
Use to create the specialized text fields for a password entry. For security reasons, the password field does not show the characters that the user types. Instead, the field displays the character different from the one typed such as an asterisk '*' (depends on a browser).
Open in a new window<span class="input input_theme_islands input_size_m input_type_password i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter the password" type="password"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
type: 'password'
},
placeholder: 'Enter the password'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
type: 'password'
}
}
]
deps
Search field (type
modifier with search
value)
Use to create the search field.
Open in a new window<span class="input input_theme_islands input_size_m input_type_search i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your question" type="search"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
type: 'search'
},
placeholder: 'Enter your question'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
type: 'search'
}
}
]
deps
width
modifier
Acceptable value:'available'
.
Use cases: BEMJSON
.
Use to set the maximum available width to the text field.
Open in a new window<span class="input input_theme_islands input_size_m input_width_available i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
width: 'available'
},
placeholder: 'Enter your name'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
width: 'available'
}
}
]
deps
has-clear
modifier
Acceptable value:true
.
Use cases: BEMJSON
.
Use this modifier to add the clear
element into the text field to remove entered content.
Open in a new window<span class="input input_theme_islands input_size_m input_has-clear i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" value="Hello!"><span class="input__clear"></span></span>
</span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
'has-clear': true
},
val: 'Hello!'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
'has-clear': true
}
}
]
deps
disabled
modifier
Acceptable value:true
.
Use cases: BEMJSON
, JS
.
The modifier makes the block inactive. The disabled block is visible but not available for user actions.
Open in a new window<span class="input input_theme_islands input_size_m input_disabled i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your name" disabled="disabled"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
disabled: true
},
placeholder: 'Enter your name'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
disabled: true
}
}
]
deps
focused
modifier
Acceptable value:true
.
Use cases: BEMJSON
, JS
.
The modifier puts the focus on the block.
{
block : 'input',
mods : { theme : 'islands', size : 'm', focused : true },
placeholder : 'Enter your name'
}
theme
modifier
Acceptable value:'islands'
.
Use case: BEMJSON
.
The modifier gives the block a custom design.
The islands
theme requires the size modifier.
Open in a new window<span class="input input_theme_islands input_size_m input_type_search i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your question" type="search"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
type: 'search'
},
placeholder: 'Enter your question'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm',
type: 'search'
}
}
]
deps
size
modifier
Acceptable values for the islands
theme: 's'
, 'm'
, 'l'
, 'xl'
.
Use case: BEMJSON
.
Use the size
modifier only for blocks with the islands
theme.
Sets the size value for all types of text fields.
s
Open in a new window<span class="input input_theme_islands input_size_s i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Size s"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 's'
},
placeholder: 'Size s'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 's'
}
}
]
deps
m
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Size m"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Size m'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
l
Open in a new window<span class="input input_theme_islands input_size_l i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Size l"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'l'
},
placeholder: 'Size l'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'l'
}
}
]
deps
xl
Open in a new window<span class="input input_theme_islands input_size_xl i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Size xl"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'xl'
},
placeholder: 'Size xl'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'xl'
}
}
]
deps
Custom fields of the block
name
field
Type: String
.
Specifies the block unique name.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" name="Statistics"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
name: 'Statistics'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
val
field
Type: String
.
Specifies the content of the text field.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" name="Statistics" value="Hello"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
name: 'Statistics',
val: 'Hello'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
placeholder
field
Type: String
.
Specifies the hint in the text field.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Enter your name'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
maxLength
field
Type: Number
.
Specifies the maximum number of characters allowed in the text field.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" maxlength="20" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Enter your name',
maxLength: 20
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
autocomplete
field
Type: Boolean
.
Specifies the browser predictions of the rest of the word while a user is typing.
If the autocomplete
field is not specified, the autocomplete function is turned on by default.
To turn off the autocomplete function, use the false
value:
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Enter your name',
autocomplete: false
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
id
field
Type: String
.
Specifies the text field unique ID.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" id="Unique_1" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Enter your name',
id: 'Unique_1'
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps
tabIndex
field
Type: Number
.
Specifies the tab order when pressing Tab
to navigate between controls on a page.
Open in a new window<span class="input input_theme_islands input_size_m i-bem" data-bem='{"input":{}}'><span class="input__box"><input class="input__control" autocomplete="off" autocorrect="off" autocapitalize="off" spellcheck="false" tabindex="3" placeholder="Enter your name"></span></span>
HTML{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
},
placeholder: 'Enter your name',
tabIndex: 3
}
BEMJSON[
{
block: 'input',
mods: {
theme: 'islands',
size: 'm'
}
}
]
deps