Top-level connections
Stay organized with collections
Save and categorize content based on your preferences.
Blocks have three connections whose use is optional.
Statement Connections
Users can create sequences of blocks using the nextStatement
and
previousStatement
connectors. In Blockly's standard layout, these connections
are on the top and the bottom, with the blocks stacked vertically.
A block with a previous connector cannot have an output
connector. The term statement block refers
to a block with no output connector. A statement block will usually have both
a previous connection and a next connection.
nextStatement
and previousStatement
connections can be
typed,
but this feature is not utilized by standard blocks.
Next Connection
Creates a point at the bottom of the block, so that other statements can be
stacked below it. A block with a next connection but no previous connection
usually represents an event, and can be configured to render with
a hat.

JSON
Untyped:
{
...,
"nextStatement": null,
}
Typed (rare):
{
"nextStatement": "Action",
...
}
JavaScript
Untyped:
this.setNextStatement(true); // false implies no next connector, the default
Typed (rare):
this.setNextStatement(true, 'Action');
Previous Connection
Creates a notch at the top of the block, so that it can be connected as a stack
of statements.
Blocks with a previous connection cannot have an output connection.

JSON
Untyped:
{
...,
"previousStatement": null,
}
Typed (rare):
{
"previousStatement": "Action",
...
}
JavaScript
Untyped:
this.setPreviousStatement(true); // false implies no previous connector, the default
Typed (rare):
this.setPreviousStatement(true, 'Action');
Output connection
A block may have a single output connection, represented as a male jigsaw
connector on the leading edge. Outputs connect to value inputs. Blocks with an
output are usually called value blocks.

JSON
Untyped:
{
// ...,
"output": null,
}
Typed:
{
// ...,
"output": "Number",
}
JavaScript
Untyped:
init: function() {
// ...
this.setOutput(true);
}
Typed:
init: function() {
// ...
this.setOutput(true, 'Number');
}
Blocks with an output connector cannot also have a previous statement notch.
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 2025-06-24 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 2025-06-24 UTC."],[],[],null,["# Top-level connections\n\nBlocks have three connections whose use is optional.\n\nStatement Connections\n---------------------\n\nUsers can create sequences of blocks using the `nextStatement` and\n`previousStatement` connectors. In Blockly's standard layout, these connections\nare on the top and the bottom, with the blocks stacked vertically.\n\nA block with a previous connector cannot have an [output\nconnector](#output_connection). The term *statement block* refers\nto a block with no output connector. A statement block will usually have both\na previous connection and a next connection.\n\n`nextStatement` and `previousStatement` connections can be\n[typed](/blockly/guides/create-custom-blocks/type-checks),\nbut this feature is not utilized by standard blocks.\n\n### Next Connection\n\nCreates a point at the bottom of the block, so that other statements can be\nstacked below it. A block with a next connection but no previous connection\nusually represents an event, and can be configured to render with\n[a hat](/blockly/guides/design/applications#event_driven_program).\n\n### JSON\n\nUntyped: \n\n {\n ...,\n \"nextStatement\": null,\n }\n\nTyped (*rare*): \n\n {\n \"nextStatement\": \"Action\",\n ...\n }\n\n### JavaScript\n\nUntyped: \n\n this.setNextStatement(true); // false implies no next connector, the default\n\nTyped (rare): \n\n this.setNextStatement(true, 'Action');\n\n### Previous Connection\n\nCreates a notch at the top of the block, so that it can be connected as a stack\nof statements.\n\nBlocks with a previous connection cannot have an output connection.\n\n### JSON\n\nUntyped: \n\n {\n ...,\n \"previousStatement\": null,\n }\n\nTyped (*rare*): \n\n {\n \"previousStatement\": \"Action\",\n ...\n }\n\n### JavaScript\n\nUntyped: \n\n this.setPreviousStatement(true); // false implies no previous connector, the default\n\nTyped (rare): \n\n this.setPreviousStatement(true, 'Action');\n\nOutput connection\n-----------------\n\nA block may have a single output connection, represented as a male jigsaw\nconnector on the leading edge. Outputs connect to value inputs. Blocks with an\noutput are usually called *value blocks*.\n\n### JSON\n\nUntyped: \n\n {\n // ...,\n \"output\": null,\n }\n\nTyped: \n\n {\n // ...,\n \"output\": \"Number\",\n }\n\n### JavaScript\n\nUntyped: \n\n init: function() {\n // ...\n this.setOutput(true);\n }\n\nTyped: \n\n init: function() {\n // ...\n this.setOutput(true, 'Number');\n }\n\nBlocks with an output connector cannot also have a previous statement notch."]]