Skip to content

Commit f7cc880

Browse files
authored
Merge pull request #2027 from umbraco/v14/feature/umb-property-editor-ui-text-box-readonly
Feature: Readonly mode for Text Box Property Editor UI
2 parents df4f3f6 + 2e0831b commit f7cc880

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

src/packages/property-editors/text-box/property-editor-ui-text-box.element.ts

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ import {
66
state,
77
ifDefined,
88
type PropertyValueMap,
9+
property,
910
} from '@umbraco-cms/backoffice/external/lit';
1011
import type { UmbPropertyEditorUiElement } from '@umbraco-cms/backoffice/extension-registry';
1112
import { UmbLitElement } from '@umbraco-cms/backoffice/lit-element';
@@ -23,6 +24,15 @@ export class UmbPropertyEditorUITextBoxElement
2324
extends UmbFormControlMixin<string>(UmbLitElement, undefined)
2425
implements UmbPropertyEditorUiElement
2526
{
27+
/**
28+
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
29+
* @type {boolean}
30+
* @attr
31+
* @default false
32+
*/
33+
@property({ type: Boolean, reflect: true })
34+
readonly = false;
35+
2636
#defaultType: UuiInputTypeType = 'text';
2737

2838
@state()
@@ -63,7 +73,8 @@ export class UmbPropertyEditorUITextBoxElement
6373
placeholder=${ifDefined(this._placeholder)}
6474
inputMode=${ifDefined(this._inputMode)}
6575
maxlength=${ifDefined(this._maxChars)}
66-
@input=${this.onChange}></uui-input>`;
76+
@input=${this.onChange}
77+
?readonly=${this.readonly}></uui-input>`;
6778
}
6879

6980
static styles = [

0 commit comments

Comments
 (0)