Skip to content

Commit 201917e

Browse files
madsrasmusseniOvergaard
authored andcommitted
feat: readonly state for uui-radio
1 parent dbad401 commit 201917e

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

packages/uui-radio/lib/uui-radio.element.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -81,6 +81,15 @@ export class UUIRadioElement extends LitElement {
8181
}
8282
private _disabled = false;
8383

84+
/**
85+
* Sets the input to readonly mode, meaning value cannot be changed but still able to read and select its content.
86+
* @type {boolean}
87+
* @attr
88+
* @default false
89+
*/
90+
@property({ type: Boolean, reflect: true })
91+
readonly = false;
92+
8493
constructor() {
8594
super();
8695
this.addEventListener('mousedown', this.#hideFocusOutline);
@@ -162,7 +171,7 @@ export class UUIRadioElement extends LitElement {
162171
name=${this.name}
163172
value=${this.value}
164173
.checked=${this.checked}
165-
.disabled=${this.disabled}
174+
.disabled=${this.disabled || this.readonly}
166175
@change=${this._onChange} />
167176
<div id="button"></div>
168177
<div id="label">

0 commit comments

Comments
 (0)