The block contract: content tabs and the shared settings type
On this page
How the Visual Builder reads your blocks: content tabs from your element type, base styles from one shared settings field.
You design a block's content exactly as you would for Umbraco. The Visual Builder adds nothing to your content type. What it needs for styling is one settings field, visualStyles, which every styled block shares. This article explains that contract so you can design blocks that work well in the builder.
Before you start #
- You know how Umbraco Block Grid element types, settings types and data types work.
How the inspector is built #
- Content tabs. The inspector shows the block's content type tabs and groups as you defined them; groups are accordions. Text, rich text, links and images are found on the canvas and edited in place; other fields use their normal Umbraco property editors in the panel.
- Style tab. Shown when the block's settings type has the
visualStylesfield. The values are typed (spacing, size, colours from the design library, per screen size and state). - Advanced tab. Always there. It holds Save as pattern, Make component, the block type and key, and lists any
data-propertyaliases in your markup that the block doesn't have. - Settings on the block bar. Settings such as toggles, dropdowns, radio buttons, colours and numbers are offered on the block's bar on the canvas.
Two ways a block gets base styles #
| Block | What the opt-in does |
|---|---|
| Has its own settings type | Adds a Visual styles field (visualStyles, group Visual design) to it. All existing settings fields stay. |
| Has no settings type | Uses the shared Element appearance settings type (ccvbElementSettings) as its settings. |
The recommended way is the composer in Opt a site into Visual Builder styles in code, which applies this to every block of the grids you list.
What a block without the contract keeps #
A block whose settings have no visualStyles field still works in the builder: editors can edit its content, insert it, move it, duplicate it, delete it and resize its columns. They don't get margin, padding, width or gap handles, and its Style tab is greyed out with this hover text: "This block doesn't use the Visual Builder style settings, so spacing, styles, animations and visibility can't be set here. A developer can add them to the block (Visual Builder setup guide)."
Adopt a single block explicitly #
To adopt one block in one grid instead of whole grids, an administrator action can call VisualCustomBlockInstaller.AdoptAsync. It points the block at the shared settings type, or composes the style settings into the block's own settings type. It requires the shared settings type to exist (run the composer opt-in once first) and a signed-in Umbraco administrator; it returns false when the block already had a settings type.
VisualCustomBlockInstaller is registered by the package; you only inject it. Your own content type is never edited.