Skip to content
This repository was archived by the owner on Nov 6, 2025. It is now read-only.

Commit bc55443

Browse files
authored
Merge pull request #2155 from umbraco/v14/feature/example-custom-view
Feature: example custom view
2 parents dfca67f + 5814fba commit bc55443

File tree

3 files changed

+61
-0
lines changed

3 files changed

+61
-0
lines changed
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
# Property Dataset Dashboard Example
2+
3+
This example is a work in progress example of how to write a property editor.
4+
5+
This example covers a few points:
6+
7+
- Using an existing Property Editor Schema
Lines changed: 42 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,42 @@
1+
import { UmbTextStyles } from '@umbraco-cms/backoffice/style';
2+
import { html, customElement, LitElement, property, css } from '@umbraco-cms/backoffice/external/lit';
3+
import { UmbElementMixin } from '@umbraco-cms/backoffice/element-api';
4+
import type { UmbBlockDataType, UmbBlockEditorCustomViewElement } from '@umbraco-cms/backoffice/extension-registry';
5+
6+
@customElement('example-block-custom-view')
7+
export class ExampleBlockCustomView extends UmbElementMixin(LitElement) implements UmbBlockEditorCustomViewElement {
8+
//
9+
@property({ attribute: false })
10+
content?: UmbBlockDataType;
11+
12+
override render() {
13+
return html`
14+
<div class="uui-text">
15+
<h5 class="uui-text">My Custom View</h5>
16+
<p>Headline: ${this.content.headline}</p>
17+
</div>
18+
`;
19+
}
20+
21+
static override styles = [
22+
UmbTextStyles,
23+
css`
24+
:host {
25+
display: block;
26+
height: 100%;
27+
box-sizing: border-box;
28+
background-color: #dddddd;
29+
border-radius: 9px;
30+
padding: 12px;
31+
}
32+
`,
33+
];
34+
}
35+
36+
export default ExampleBlockCustomView;
37+
38+
declare global {
39+
interface HTMLElementTagNameMap {
40+
'example-block-custom-view': ExampleBlockCustomView;
41+
}
42+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
import type { ManifestBlockEditorCustomView } from '@umbraco-cms/backoffice/extension-registry';
2+
3+
export const manifests: Array<ManifestBlockEditorCustomView> = [
4+
{
5+
type: 'blockEditorCustomView',
6+
alias: 'Umb.blockEditorCustomView.TestView',
7+
name: 'Block Editor Custom View Test',
8+
element: () => import('./block-custom-view.js'),
9+
forContentTypeAlias: 'headlineUmbracoDemoBlock',
10+
forBlockEditor: 'block-grid',
11+
},
12+
];

0 commit comments

Comments
 (0)