Last active
April 6, 2025 13:13
-
-
Save crashmax-dev/c6f73bda344e9be51451fb27e7d57da7 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<template> | |
<div class="collapsible" :class="{ open }"> | |
<div class="collapsible-content"> | |
<slot /> | |
</div> | |
</div> | |
</template> | |
<script setup lang="ts"> | |
defineProps<{ | |
open: boolean | |
}>() | |
</script> | |
<style scoped lang="scss"> | |
.collapsible { | |
display: grid; | |
grid-template-rows: 0fr; | |
overflow: hidden; | |
transition: grid-template-rows 0.5s; | |
&-content { | |
min-height: 0; | |
opacity: 0; | |
transition: opacity 0.5s ease-in-out; | |
} | |
&.open { | |
grid-template-rows: 1fr; | |
.collapsible-content { | |
opacity: 1; | |
visibility: visible; | |
} | |
} | |
} | |
</style> |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment