Files
axp-ui/src/components/Btn.vue
T

30 lines
619 B
Vue
Raw Normal View History

2023-07-11 10:38:21 +03:00
<script setup lang="ts">
2023-07-27 15:36:52 +03:00
import type { TColor } from '../colors'
import type { TUiIcon } from '../icons'
2023-07-11 10:38:21 +03:00
import UiIcon from './Icon.vue'
// Props.
const props = defineProps<{
label?: string
type?: 'button' | 'submit'
2023-07-27 15:36:52 +03:00
color?: TColor
icon?: TUiIcon
to?: string
2023-07-11 10:38:21 +03:00
}>()
</script>
<template>
2023-07-27 15:36:52 +03:00
<component
class="ui-btn"
:is="props.to ? 'router-link' : 'button'"
:to="props.to"
:class="props.color"
:type="props.type"
>
2023-07-11 10:38:21 +03:00
<ui-icon v-if="props.icon" :name="props.icon" />
<div v-if="props.label" class="label">{{ props.label }}</div>
2023-07-26 14:07:17 +03:00
<slot v-if="$slots.default" name="default" />
2023-07-27 15:36:52 +03:00
</component>
2023-07-11 10:38:21 +03:00
</template>