Skip to content

Commit 361e666

Browse files
committed
Add block blueprint reference
1 parent 961a0d1 commit 361e666

File tree

1 file changed

+80
-0
lines changed

1 file changed

+80
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,80 @@
1+
Title: Block blueprint
2+
3+
----
4+
5+
Intro: Block blueprints are located in `/site/blueprints/blocks` and control the setup and form fields for a block type.
6+
7+
----
8+
9+
Guide: blueprints/introduction
10+
11+
----
12+
13+
Text:
14+
15+
## Blueprints for built-in block types
16+
17+
You can find all original blueprints for the default blocks in the subfolders of the `/kirby/config/blocks` folder or in the docs (link:docs/reference/panel/blocks text: for each block type).
18+
19+
You can modify each default block type setup by creating a block YAML file with the same name in the `/site/blueprints/blocks` folder.
20+
21+
## Blueprints for custom block types
22+
23+
Blueprints for custom block types can be registered (link: docs/reference/plugins/extensions/blueprints text: via a plugin) or be placed into `/site/blueprints/blocks`.
24+
25+
## Blueprint properties
26+
27+
### `name`
28+
29+
The name of the block as it will appear in the block selector, and in the block preview if no custom preview is created.
30+
31+
### `label`
32+
33+
You can use the `label` property to refer to a field in your block. The label is displayed in addition to the block name in the default (if no custom preview is used). Note that you can only refer to fields that return a simple string or number value (such as text, textarea, number, date, select), not to fields that return an array (tags, multiselect, pages, files...)
34+
35+
### `icon`
36+
37+
The icon for the block as it will appear in the block selector, and in the block preview if no custom preview is created.
38+
39+
### `wysiwyg`
40+
41+
The `wysiwyg` option controls if the drawer is opened by default or not. Enable it to allow enabling inline editing.`
42+
43+
### `preview`
44+
45+
Name of the Panel (link: docs/reference/plugins/extensions/blocks text: preview) for the block. If you do not create a custom preview, you can either use an existing preview that matches the content or set the value to `fields` to display the block fields inline.
46+
47+
### tabs
48+
49+
You can arrange the fields of the blocks in tabs, e.g. to separate content fields from settings fields.
50+
51+
### fields
52+
53+
Any fields you want to use in your block for content or settings. You can use any (link: docs/reference/panel/fields text: built-in fields) or your own or third party custom fields.
54+
55+
## Full example blueprint
56+
57+
```yaml
58+
name: Custom block
59+
icon: info
60+
label: "{{ title }}"
61+
wysiwyg: true
62+
preview: fields
63+
tabs:
64+
content:
65+
fields:
66+
title:
67+
type: text
68+
description:
69+
type: writer
70+
settings:
71+
fields:
72+
background:
73+
type: color
74+
icon:
75+
type: select
76+
options:
77+
- alert
78+
- info
79+
- lab
80+
```

0 commit comments

Comments
 (0)