Skip to content

Commit 35a0eac

Browse files
feat: add readonly state for textarea (#2987)
Co-authored-by: Akshat Patel <[email protected]>
1 parent 53864d9 commit 35a0eac

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/input/textarea-label.component.ts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,10 @@ export class TextareaLabelComponent implements AfterViewInit {
144144

145145
@HostBinding("class.cds--form-item") labelClass = true;
146146

147+
@HostBinding("class.cds--text-area__wrapper--readonly") get isReadonly() {
148+
return this.wrapper?.nativeElement.querySelector("textarea")?.readOnly ?? false;
149+
}
150+
147151
/**
148152
* Creates an instance of Label.
149153
*/

src/input/textarea.stories.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const Template = (args) => ({
3232
[theme]="theme"
3333
[rows]="rows"
3434
[cols]="cols"
35+
[readonly]="readonly"
3536
aria-label="textarea"></textarea>
3637
</cds-textarea-label>
3738
`
@@ -49,7 +50,8 @@ Basic.args = {
4950
cols: 50,
5051
rows: 4,
5152
autocomplete: "on",
52-
theme: "dark"
53+
theme: "dark",
54+
readonly: false
5355
};
5456
Basic.argTypes = {
5557
autocomplete: {

0 commit comments

Comments
 (0)