1919 v-model =" localValue"
2020 class =" textarea-field__input"
2121 :class =" inputClasses"
22+ :disabled =" disabled"
2223 :placeholder =" placeholder"
2324 :readonly =" props.readonly"
2425 :rows =" rows"
2526 name =" textarea"
2627 @focus =" setFocus"
2728 @input.stop
28- ></ textarea >
29+ / >
2930 <div
3031 v-if =" hint || !isValid"
3132 class =" textarea-field__hint"
@@ -92,6 +93,10 @@ const props = defineProps({
9293 type: Array ,
9394 default : () => [],
9495 },
96+ disabled: {
97+ type: Boolean ,
98+ default: false ,
99+ },
95100});
96101
97102const localValue = ref (' ' );
@@ -117,6 +122,8 @@ const removeFocus = () => {
117122};
118123
119124const setFocus = () => {
125+ if (props .disabled ) return ;
126+
120127 txtarea .value .focus ();
121128 isFocused .value = true ;
122129};
@@ -125,12 +132,14 @@ const computedClasses = computed(() => ({
125132 ' textarea-field_focused' : isFocused .value ,
126133 ' textarea-field_invalid' : ! isValid .value ,
127134 ' textarea-field_optional' : ! props .required ,
135+ ' textarea-field_disabled' : props .disabled ,
128136}));
129137
130138const inputClasses = computed (() => ({
131139 ' textarea-field__input_no-resize' : props .autoGrow ,
132140 ' textarea-field__input_no-border' : props .noBorder ,
133141 ' textarea-field__input_monospace' : props .monospace ,
142+ ' textarea-field__input_disabled' : props .disabled ,
134143}));
135144
136145onMounted (() => {
@@ -188,6 +197,13 @@ watch(localValue, async (newValue) => {
188197 & _monospace {
189198 font-family : monospace ;
190199 }
200+
201+ & [disabled ],
202+ :disabled ,
203+ & _disabled {
204+ border-style : dashed ;
205+ cursor : default ;
206+ }
191207 }
192208
193209 & __label {
0 commit comments