Closed whitespacecode closed 1 year ago
Hi @JoeriTheGreat, you must replace string
with Placement
to pass the type check, the Placement
type defined the 12 placement string (see: https://floating-ui.com/docs/computePosition#placement), it's better than string
for this.
@floating-ui/dom
for your project, run npm i @floating-ui/dom
or yarn add @floating-ui/dom
<script setup lang="ts">
import { Popover, PopoverButton, PopoverPanel } from '@headlessui/vue'
import { Float, FloatArrow } from '@headlessui-float/vue'
import { defineProps } from "vue"
+import type { Placement } from '@floating-ui/dom'
export interface Props {
- placement?: string
+ placement?: Placement
labels?: string[]
useArrow?: boolean
}
const props = withDefaults(defineProps<Props>(), {
placement: 'bottom-start',
labels: () => ['one', 'two'],
useArrow: false,
})
</script>
<template>
...
</template>
Use Version Use version when bugs appear:
Describe the bug I'm converting the provided example code to be used as a component with properties. Using props to define placement gives a type error.
To Reproduce
Screenshots
Expected behavior Define the property placement as String in the package so the type error would be gone.