ByteEditor Website Builder
Create ready block
Following this instruction's steps, you can create a new banner with the video on the background. You can recreate this block using the code snippets provided in the guide, or modify the steps to tailor it to your specific needs.
Expected result
Your Headline
Your subtitle
In order to create a new banner, for example, Banner With Video, we need a back office preview (a Lit custom view registered in an “umbraco-package.json” file), an element type, and a front-end view.
Step 1. Back office preview
- Open the project folder
- Open the “App_Plugins” folder
- Create a folder for custom blocks, for example, name “CustomBlockView”. If you already have this folder, open it.
- Create a file named “banner-with-video.custom-view.js”
- Copy the following code and paste it into the file
6. Create a file named “umbraco-package.json” in the “CustomBlockView” folder. If you already have this file, add the new extension to its “extensions” list instead.
7. Add the following JSON to the file:
💡 There is no build step: Umbraco 17 loads these files directly. “forContentTypeAlias” must match the element type alias you create in Step 2. To learn more, see the Umbraco documentation on custom views for blocks.
Step 2. How to create a ready block in Umbraco
- Run your project locally where the ByteEditor 17.X package is installed.
- Open the “Settings” section.
- Expand “Document Types” → “Blocks”.
- Hover over the “Ready Layout Blocks” folder, click '...' and choose “Create”.
- Select “Element Type”.
- Name it “Banner With Video”.
- Click the icon next to the name and pick an icon for the block.
- Next to the name, change the alias from “bannerWithVideo” to “bannerWithVideoBlock”.
- Click “Add group” and name the group “Content”.
- Add a property “Headline” with the “Textstring” property editor and turn on “Mandatory”.
- Add a property “Video” with the “Video - Image - Media Picker” property editor.
- Click “Compositions”, and under “Blocks/Compositions” select “Section Settings” and “Section Custom CSS for elements”.
- Click “Submit”, then “Save”.
Step 3. How to create a front end view of the Ready Block
- In “Settings”, expand “Partial Views” → “blockgrid”.
- Hover over the “Components” folder, click '...' and choose “Create” → “Empty partial view”.
- Name it “bannerWithVideoBlock.cshtml”.
- Copy the following code and paste it into the file
5. Click “Save”
6. Restart the project so ModelsBuilder generates the “BannerWithVideoBlock” model
Step 4. How to add Ready Block to the Block Grid
- Open “Settings” → “Data Types” → “Home - Main Grid - Block Grid”.
- Click “Add block” and choose “Banner With Video”.
- Put it in the “Ready Layout Blocks” group.
- Turn on “Allow at root” and turn off “Allow in areas”.
- Open “Areas” and set “Grid Columns for Areas” to 6.
- Add an area with the alias “hero”, 6 columns wide (the full width).
- Click “Submit”, then “Save”.
💡 Unlike Umbraco 13, there is no “Custom view” field on the block: the preview is picked up automatically from “umbraco-package.json” by the element type alias.
Congratulations!
You have created your first Ready Block. Now you can add it to your page.