Text in the toolbox flyout

86 views
Skip to first unread message

Jani Ndini

unread,
May 12, 2021, 2:46:32 PM5/12/21
to Blockly
Hi All
How can you add a text or a label in the toolbox-flyout. Is there a way to do that?

Thank you in advance.

feni...@google.com

unread,
May 12, 2021, 4:37:33 PM5/12/21
to Blockly
You can add a label in the flyout by defining it in XML or JSON (documentation).

Modifying the list of categories in the toolbox to add a non-clickable label is more involved but doable--check out the codelab.

Hope that helps,
Rachel

Max Stephen Russell

unread,
Mar 14, 2025, 10:40:01 AM3/14/25
to Blockly
I completed that codelab and borrowed the custom label in my app. Can a custom label also appear on a category's flyout,? If so, would I use something like this?:

Blockly.registry.register(
  Blockly.registry.Type.FLYOUTS_VERTICAL_TOOLBOX,
  'toolboxFlyoutlabel',
  ToolboxFlyoutLabel,
);

Thank you.

-Steve

Aaron Dodson

unread,
Mar 17, 2025, 11:25:33 AM3/17/25
to Blockly
Hi,

Yes, you can add labels to a category's flyout. It works exactly like adding them to a standalone flyout, you'd just add the label entry under the category's contents in the toolbox definition:

{
  "kind": "categoryToolbox",
  "contents": [
    {
      "kind": "category",
      "name": "Some Category",
      "contents": [
        {
          "kind": "block",
          "type": "controls_if"
        },
        {
          "kind": "label",
          "type": "Whatever you want"
        },
      ]
    },
  ]
}


Reply all
Reply to author
Forward
0 new messages