@gits-id/form-group
Version:
GITS Form Group Component
59 lines (46 loc) • 1.28 kB
JavaScript
import { toRefs, openBlock, createElementBlock, normalizeClass, unref, createElementVNode, toDisplayString, renderSlot } from 'vue';
const _hoisted_1 = ["for"];
const _hoisted_2 = { class: "flex-grow" };
const _sfc_main = {
props: {
label: {
type: String,
default: '',
},
labelFor: {
type: String,
default: '',
},
labelClass: {
type: String,
default: 'mb-2 font-medium text-sm',
},
inline: {
type: Boolean,
default: false,
},
inlineClass: {
type: String,
default: 'w-full sm:w-3/12',
},
},
emits: ['update:label'],
setup(__props, { emit }) {
const props = __props;
const {label, labelFor, inline, labelClass, inlineClass} = toRefs(props);
return (_ctx, _cache) => {
return (openBlock(), createElementBlock("div", {
class: normalizeClass(["mb-5 flex w-full", [unref(inline) ? 'flex-col sm:flex-row' : 'flex-col']])
}, [
createElementVNode("label", {
for: unref(labelFor),
class: normalizeClass([unref(labelClass), unref(inline) ? unref(inlineClass) : ''])
}, toDisplayString(unref(label)), 11, _hoisted_1),
createElementVNode("div", _hoisted_2, [
renderSlot(_ctx.$slots, "default")
])
], 2))
}
}
};
export { _sfc_main as VFormGroup, _sfc_main as default };