EN RU
Forum

Methodology

Technology

Toolbox

Libraries

Tutorials

DocumentationJSDocSource

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
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
Search field (type modifier with search value)

Use to create the search field.

Open in a new window

width modifier

Acceptable value:'available'.

Use cases: BEMJSON.

Use to set the maximum available width to the text field.

Open in a new window

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

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

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

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

m

Open in a new window

l

Open in a new window

xl

Open in a new window

Custom fields of the block

name field

Type: String.

Specifies the block unique name.

Open in a new window

val field

Type: String.

Specifies the content of the text field.

Open in a new window

placeholder field

Type: String.

Specifies the hint in the text field.

Open in a new window

maxLength field

Type: Number.

Specifies the maximum number of characters allowed in the text field.

Open in a new window

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

id field

Type: String.

Specifies the text field unique ID.

Open in a new window

tabIndex field

Type: Number.

Specifies the tab order when pressing Tab to navigate between controls on a page.

Open in a new window
Instance methods:
getVal
setVal

Block input

Augments:control

Instance methods:

getVal():Stringoverride
description
Returns control value
setVal(val, [data]):input
description
Sets control value
parameters
val
String
value
data
Object
additional data