Skip to content

Commit

Permalink
feat: readonly state for uui-radio
Browse files Browse the repository at this point in the history
  • Loading branch information
madsrasmussen authored and iOvergaard committed Jul 8, 2024
1 parent dbad401 commit 201917e
Showing 1 changed file with 10 additions and 1 deletion.
11 changes: 10 additions & 1 deletion packages/uui-radio/lib/uui-radio.element.ts
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,15 @@ export class UUIRadioElement extends LitElement {
}
private _disabled = false;

/**
* 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;

constructor() {
super();
this.addEventListener('mousedown', this.#hideFocusOutline);
Expand Down Expand Up @@ -162,7 +171,7 @@ export class UUIRadioElement extends LitElement {
name=${this.name}
value=${this.value}
.checked=${this.checked}
.disabled=${this.disabled}
.disabled=${this.disabled || this.readonly}
@change=${this._onChange} />
<div id="button"></div>
<div id="label">
Expand Down

0 comments on commit 201917e

Please sign in to comment.