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

Commit d4fe85d

Browse files
madsrasmussenleekelleher
authored andcommitted
pass readonly prop
1 parent b77b284 commit d4fe85d

File tree

1 file changed

+11
-1
lines changed

1 file changed

+11
-1
lines changed

src/packages/core/components/input-toggle/input-toggle.element.ts

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,15 @@ export class UmbInputToggleElement extends UUIFormControlMixin(UmbLitElement, ''
2626
@property({ type: String })
2727
labelOff?: string;
2828

29+
/**
30+
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
31+
* @type {boolean}
32+
* @attr
33+
* @default false
34+
*/
35+
@property({ type: Boolean, reflect: true })
36+
readonly = false;
37+
2938
@state()
3039
_currentLabel?: string;
3140

@@ -52,7 +61,8 @@ export class UmbInputToggleElement extends UUIFormControlMixin(UmbLitElement, ''
5261
return html`<uui-toggle
5362
.checked=${this.#checked}
5463
.label=${this._currentLabel}
55-
@change=${this.#onChange}></uui-toggle>`;
64+
@change=${this.#onChange}
65+
?readonly=${this.readonly}></uui-toggle>`;
5666
}
5767

5868
static override styles = [

0 commit comments

Comments
 (0)