Skip to content

Commit

Permalink
pass readonly prop
Browse files Browse the repository at this point in the history
  • Loading branch information
madsrasmussen authored and leekelleher committed Jul 29, 2024
1 parent b77b284 commit d4fe85d
Showing 1 changed file with 11 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,15 @@ export class UmbInputToggleElement extends UUIFormControlMixin(UmbLitElement, ''
@property({ type: String })
labelOff?: string;

/**
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
* @type {boolean}
* @attr
* @default false
*/
@property({ type: Boolean, reflect: true })
readonly = false;

@state()
_currentLabel?: string;

Expand All @@ -52,7 +61,8 @@ export class UmbInputToggleElement extends UUIFormControlMixin(UmbLitElement, ''
return html`<uui-toggle
.checked=${this.#checked}
.label=${this._currentLabel}
@change=${this.#onChange}></uui-toggle>`;
@change=${this.#onChange}
?readonly=${this.readonly}></uui-toggle>`;
}

static override styles = [
Expand Down

0 comments on commit d4fe85d

Please sign in to comment.