58 lines
1.1 KiB
Vue
58 lines
1.1 KiB
Vue
<template>
|
|
<div class="space-y-1">
|
|
<label
|
|
v-if="label"
|
|
:for="name"
|
|
class="flex justify-between mb-0.5 text-sm font-medium leading-6 text-ash-900"
|
|
>
|
|
<slot name="label">
|
|
{{ label }}
|
|
</slot>
|
|
<slot name="rightOfLabel" />
|
|
</label>
|
|
<div class="flex flex-col w-full gap-1">
|
|
<div class="relative flex items-center w-full">
|
|
<fluent-icon
|
|
v-if="icon"
|
|
size="16"
|
|
:icon="icon"
|
|
class="absolute w-5 h-5 transform left-2 text-ash-400"
|
|
/>
|
|
<slot />
|
|
</div>
|
|
<span
|
|
v-if="errorMessage && hasError"
|
|
class="mt-0.5 text-xs text-ruby-800 leading-2"
|
|
>
|
|
{{ errorMessage }}
|
|
</span>
|
|
</div>
|
|
</div>
|
|
</template>
|
|
<script>
|
|
export default {
|
|
props: {
|
|
label: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
name: {
|
|
type: String,
|
|
required: true,
|
|
},
|
|
icon: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
hasError: {
|
|
type: Boolean,
|
|
default: false,
|
|
},
|
|
errorMessage: {
|
|
type: String,
|
|
default: '',
|
|
},
|
|
},
|
|
};
|
|
</script>
|