store/resources/js/components/button/CreateButton.vue

29 lines
651 B
Vue

<script setup lang="ts">
import { Link } from '@inertiajs/vue3';
import { Plus } from '@lucide/vue';
import { Button } from '@/components/ui/button';
withDefaults(
defineProps<{
href?: string;
label?: string;
}>(),
{
label: 'Tambah',
}
);
</script>
<template>
<Button :as-child="!!href" class="shrink-0 self-start sm:self-center">
<Link v-if="href" :href="href">
<Plus class="size-4" />
<slot>{{ label }}</slot>
</Link>
<template v-else>
<Plus class="size-4" />
<slot>{{ label }}</slot>
</template>
</Button>
</template>