@prefecthq/prefect-ui-library
Version:
This library is the Vue and Typescript component library for [Prefect 2](https://github.com/PrefectHQ/prefect) and [Prefect Cloud 2](https://www.prefect.io/cloud/). _The components and utilities in this project are not meant to be used independently_.
29 lines (22 loc) • 553 B
text/typescript
import { computed, ref, Ref } from 'vue'
type UseShowModal = {
showModal: Ref<boolean>,
isOpen: Ref<boolean>,
open: () => void,
close: () => void,
toggle: () => void,
}
export function useShowModal(): UseShowModal {
const showModal = ref(false)
const isOpen = computed(() => showModal.value)
function open(): void {
showModal.value = true
}
function close(): void {
showModal.value = false
}
function toggle(): void {
showModal.value = !showModal.value
}
return { isOpen, showModal, open, close, toggle }
}