Stay organized with collections
Save and categorize content based on your preferences.
blockly > inputs > Input
Class for an input with optional fields.
Signature:
export declare class Input
Constructors
Properties
Methods
Except as otherwise noted, the content of this page is licensed under the Creative Commons Attribution 4.0 License, and code samples are licensed under the Apache 2.0 License. For details, see the Google Developers Site Policies. Java is a registered trademark of Oracle and/or its affiliates.
Last updated 2024-09-18 UTC.
[[["Easy to understand","easyToUnderstand","thumb-up"],["Solved my problem","solvedMyProblem","thumb-up"],["Other","otherUp","thumb-up"]],[["Missing the information I need","missingTheInformationINeed","thumb-down"],["Too complicated / too many steps","tooComplicatedTooManySteps","thumb-down"],["Out of date","outOfDate","thumb-down"],["Samples / code issue","samplesCodeIssue","thumb-down"],["Other","otherDown","thumb-down"]],["Last updated 2024-09-18 UTC."],[[["\u003cp\u003eThe \u003ccode\u003einputs.Input\u003c/code\u003e class in Blockly manages inputs with optional fields for blocks, handling their properties and connections.\u003c/p\u003e\n"],["\u003cp\u003eIt provides methods to add, remove, and modify fields within the input, as well as control its alignment and visibility.\u003c/p\u003e\n"],["\u003cp\u003eDevelopers can use this class to customize block inputs by specifying field types, connections, and other attributes.\u003c/p\u003e\n"],["\u003cp\u003eThe class also offers methods to manage connections to other blocks, including setting compatibility and shadow blocks.\u003c/p\u003e\n"]]],[],null,["[blockly](./blockly.md) \\\u003e [inputs](./blockly.inputs_namespace.md) \\\u003e [Input](./blockly.inputs_namespace.input_class.md)\n\ninputs.Input class\n\nClass for an input with optional fields.\n\n**Signature:** \n\n export declare class Input \n\nConstructors\n\n| Constructor | Modifiers | Description |\n|-----------------------------------------------------------------------------------------------------------|-----------|------------------------------------------------|\n| [(constructor)(name, sourceBlock)](./blockly.inputs_namespace.input_class._constructor__1_constructor.md) | | Constructs a new instance of the `Input` class |\n\nProperties\n\n| Property | Modifiers | Type | Description |\n|-----------------------------------------------------------------------------|------------|-------------------------------------------------------------|------------------------------------------------------|\n| [align](./blockly.inputs_namespace.input_class.align_property.md) | | [Align](./blockly.inputs_namespace.align_enum.md) | Alignment of input's fields (left, right or centre). |\n| [connection](./blockly.inputs_namespace.input_class.connection_property.md) | | [Connection](./blockly.connection_class.md) \\| null | |\n| [fieldRow](./blockly.inputs_namespace.input_class.fieldrow_property.md) | | [Field](./blockly.field_class.md)\\[\\] | |\n| [name](./blockly.inputs_namespace.input_class.name_property.md) | | string | |\n| [type](./blockly.inputs_namespace.input_class.type_property.md) | `readonly` | [inputTypes](./blockly.inputs_namespace.inputtypes_enum.md) | |\n\nMethods\n\n| Method | Modifiers | Description |\n|-----------------------------------------------------------------------------------------------------------|-------------|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|\n| [appendField(field, opt_name)](./blockly.inputs_namespace.input_class.appendfield_1_method.md) | | Add a field (or label from string), and all prefix and suffix fields, to the end of the input's field row. |\n| [dispose()](./blockly.inputs_namespace.input_class.dispose_1_method.md) | | Sever all links to this input. |\n| [getShadowDom()](./blockly.inputs_namespace.input_class.getshadowdom_1_method.md) | | Returns the XML representation of the connection's shadow block. |\n| [getSourceBlock()](./blockly.inputs_namespace.input_class.getsourceblock_1_method.md) | | Get the source block for this input. |\n| [init()](./blockly.inputs_namespace.input_class.init_1_method.md) | | Initialize the fields on this input. |\n| [insertFieldAt(index, field, opt_name)](./blockly.inputs_namespace.input_class.insertfieldat_1_method.md) | | Inserts a field (or label from string), and all prefix and suffix fields, at the location of the input's field row. |\n| [isVisible()](./blockly.inputs_namespace.input_class.isvisible_1_method.md) | | Gets whether this input is visible or not. |\n| [makeConnection(type)](./blockly.inputs_namespace.input_class.makeconnection_1_method.md) | `protected` | Constructs a connection based on the type of this input's source block. Properly handles constructing headless connections for headless blocks and rendered connections for rendered blocks. |\n| [removeField(name, opt_quiet)](./blockly.inputs_namespace.input_class.removefield_1_method.md) | | Remove a field from this input. |\n| [setAlign(align)](./blockly.inputs_namespace.input_class.setalign_1_method.md) | | Change the alignment of the connection's field(s). |\n| [setCheck(check)](./blockly.inputs_namespace.input_class.setcheck_1_method.md) | | Change a connection's compatibility. |\n| [setShadowDom(shadow)](./blockly.inputs_namespace.input_class.setshadowdom_1_method.md) | | Changes the connection's shadow block. |"]]