felicity-lims/webapp/components/Accordion.vue

34 lines
855 B
Vue
Raw Normal View History

<script setup lang="ts">
import { ref } from "vue";
const props = defineProps({
show: Boolean,
});
let show = ref(false);
</script>
2021-04-09 06:37:58 +08:00
<template>
<transition name="accordion">
<div class="rounded-sm my-1">
2023-04-09 04:28:39 +08:00
<div class="border border-b-0 bg-gray-100 px-4 p-2">
<button @click="show = !show"
class="w-full flex justify-between text-gray-800 font-bold hover:underline focus:outline-none" type="button">
2022-12-22 22:42:05 +08:00
<span class="w-full text-left">
<slot name="title">Accordion Title</slot>
</span>
<span class="ml-2">
<i class="fa fa-chevron-down"></i>
2021-04-09 06:37:58 +08:00
</span>
</button>
</div>
2023-04-09 04:28:39 +08:00
<div v-show="show" class="border px-4 py-2">
2021-04-09 06:37:58 +08:00
<slot name="body">Accordion Body</slot>
</div>
</div>
</transition>
</template>
2022-12-22 22:42:05 +08:00
<style lang="postcss"></style>
2021-04-09 06:37:58 +08:00