Skip to content

Commit d1c661b

Browse files
committed
feat(textarea): add prefix and suffix slots
1 parent bbae4d2 commit d1c661b

File tree

2 files changed

+37
-27
lines changed

2 files changed

+37
-27
lines changed

.changeset/little-rings-thank.md

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
---
2+
"@indielayer/ui": minor
3+
---
4+
5+
feat(textarea): add prefix and suffix slots

packages/ui/src/components/textarea/Textarea.vue

Lines changed: 32 additions & 27 deletions
Original file line numberDiff line numberDiff line change
@@ -126,33 +126,38 @@ defineExpose({ focus, blur, reset, validate, setError })
126126
]"
127127
:tooltip="tooltip"
128128
>
129-
<textarea
130-
:id="id"
131-
ref="elRef"
132-
class=""
133-
:style="style"
134-
:class="[
135-
classes.input,
136-
errorInternal
137-
? 'border-error-500 dark:border-error-400 focus:outline-error-500'
138-
: 'focus:outline-[color:var(--x-textarea-border)]',
139-
]"
140-
:disabled="disabled"
141-
:max="max"
142-
:maxlength="maxlength"
143-
:min="min"
144-
:dir="dir"
145-
:rows="rows"
146-
:minlength="minlength"
147-
:name="name"
148-
:placeholder="placeholder"
149-
:readonly="readonly"
150-
:value="typeof modelValue !== 'undefined' ? String(modelValue) : ''"
151-
v-bind="dataAttrs"
152-
v-on="inputListeners"
153-
@keydown.enter="onEnter"
154-
@input="onInput"
155-
></textarea>
129+
<div class="relative">
130+
<slot name="prefix"></slot>
131+
<textarea
132+
:id="id"
133+
ref="elRef"
134+
class=""
135+
:style="style"
136+
:class="[
137+
classes.input,
138+
errorInternal
139+
? 'border-error-500 dark:border-error-400 focus:outline-error-500'
140+
: 'focus:outline-[color:var(--x-textarea-border)]',
141+
]"
142+
:disabled="disabled"
143+
:max="max"
144+
:maxlength="maxlength"
145+
:min="min"
146+
:dir="dir"
147+
:rows="rows"
148+
:minlength="minlength"
149+
:name="name"
150+
:placeholder="placeholder"
151+
:readonly="readonly"
152+
:value="typeof modelValue !== 'undefined' ? String(modelValue) : ''"
153+
v-bind="dataAttrs"
154+
v-on="inputListeners"
155+
@keydown.enter="onEnter"
156+
@input="onInput"
157+
></textarea>
158+
159+
<slot name="suffix"></slot>
160+
</div>
156161

157162
<x-input-footer v-if="!hideFooterInternal" :error="errorInternal" :helper="helper"/>
158163
</x-label>

0 commit comments

Comments
 (0)