Skip to content

Commit f9dfd63

Browse files
feat: add readonly state
Signed-off-by: Akshat Patel <[email protected]> Co-authored-by: Akshat Patel <[email protected]> Co-authored-by: Akshat Patel <[email protected]>
1 parent aacb8d4 commit f9dfd63

File tree

2 files changed

+7
-1
lines changed

2 files changed

+7
-1
lines changed

src/input/input.stories.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,7 @@ const Template = (args) => ({
3232
[disabled]="disabled"
3333
[theme]="theme"
3434
[placeholder]="placeholder"
35+
[readonly]="readonly"
3536
[autocomplete]="autocomplete">
3637
</cds-text-label>
3738
`
@@ -48,7 +49,8 @@ Basic.args = {
4849
placeholder: "Placeholder",
4950
autocomplete: "on",
5051
theme: "dark",
51-
size: "md"
52+
size: "md",
53+
readonly: false
5254
};
5355
Basic.argTypes = {
5456
autocomplete: {

src/input/text-input-label.component.ts

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

139139
@HostBinding("class.cds--form-item") labelClass = true;
140140

141+
@HostBinding("class.cds--text-input-wrapper--readonly") get isReadonly() {
142+
return this.wrapper?.nativeElement.querySelector("input")?.readOnly;
143+
}
144+
141145
/**
142146
* Creates an instance of Label.
143147
*/

0 commit comments

Comments
 (0)