Creates an input.
Name | Type | Description |
---|---|---|
options |
number |
Options object to use. |
options.bg |
Sprite | Graphics | Texture | string |
Background of the Input.
|
options.textStyle |
PixiTextStyle |
Text style of the Input. |
options.placeholder |
string |
Placeholder of the Input. |
options.value |
string |
Value of the Input. |
options.maxLength |
number |
Max length of the Input. |
options.align |
'left' | 'center' | 'right' |
Align of the Input. |
options.padding |
Padding |
Padding of the Input. |
options.padding.top |
number |
Top padding of the Input. |
options.padding.right |
number |
Right padding of the Input. |
options.padding.bottom |
number |
Bottom padding of the Input. |
options.padding.left |
number |
Left padding of the Input. |
options.cleanOnFocus |
boolean |
Clean Input on focus. |
options.addMask |
boolean |
Add mask to the Input text, so it is cut off when it does not fit. |
options.nineSliceSprite |
Array |
NineSliceSprite values for bg and fill ([number, number, number, number]).
|
Example
new Input({
bg: Sprite.from('input.png'),
placeholder: 'Enter text',
padding: {
top: 11,
right: 11,
bottom: 11,
left: 11
} // alternatively you can use [11, 11, 11, 11] or [11, 11] or just 11
});
Extends
- Container
Members
Sets height of a Input. If nineSliceSprite is set, then height will be set to nineSliceSprite. If nineSliceSprite is not set, then height will control components height as Container.
Gets height of Input.
Fires every time input string is changed.
Fires when input loses focus.
Set paddings
Bottom side padding
- Default Value:
- 0
Left side padding
- Default Value:
- 0
Right side padding
- Default Value:
- 0
Top side padding
- Default Value:
- 0
Sets the input text.
Return text of the input.
Sets width of a Input. If nineSliceSprite is set, then width will be set to nineSliceSprite. If nineSliceSprite is not set, then width will control components width as Container.
Gets width of Input.