Skip to content

Commit 82a8e7d

Browse files
committed
implement readonly mode
1 parent a6f3c6c commit 82a8e7d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/packages/property-editors/number/property-editor-ui-number.element.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,15 @@ export class UmbPropertyEditorUINumberElement extends UmbLitElement implements U
99
@property({ type: Number })
1010
value?: number;
1111

12+
/**
13+
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
14+
* @type {boolean}
15+
* @attr
16+
* @default false
17+
*/
18+
@property({ type: Boolean, reflect: true })
19+
readonly = false;
20+
1221
@state()
1322
private _max?: number;
1423

@@ -48,7 +57,8 @@ export class UmbPropertyEditorUINumberElement extends UmbLitElement implements U
4857
step=${ifDefined(this._step)}
4958
placeholder=${ifDefined(this._placeholder)}
5059
.value=${this.value ?? (this._placeholder ? undefined : 0)}
51-
@input=${this.#onInput}>
60+
@input=${this.#onInput}
61+
?readonly=${this.readonly}>
5262
</uui-input>
5363
`;
5464
}

0 commit comments

Comments
 (0)