ycs77 / headlessui-float

Easily use Headless UI with Floating UI to position floating elements.
https://headlessui-float.vercel.app
MIT License
349 stars 13 forks source link

'Float' cannot be used as a JSX component. #2

Closed tb-b closed 2 years ago

tb-b commented 2 years ago

I'm getting the following error on the Float element: 'Float' cannot be used as a JSX component. Its return type 'Element | undefined' is not a valid JSX element.

return (
<Popover>
    <Float //
        placement="top"
        offset={15}
        shift={6}
        flip
        arrow
        portal
        enter="transition duration-200 ease-out"
        enterFrom="opacity-0 -translate-y-1"
        enterTo="opacity-100 translate-y-0"
        leave="transition duration-150 ease-in"
        leaveFrom="opacity-100 translate-y-0"
        leaveTo="opacity-0 -translate-y-1"
    >
        <Popover.Button>{props.children}</Popover.Button>

        <Popover.Panel //
            className={classNames(
                //
                props.overlayClasses,
                'absolute z-50 bg-coolGray-600 rounded-md py-1 px-2  '
            )}
        >
            {props.content}
        </Popover.Panel>
    </Float>
</Popover>
)
ycs77 commented 2 years ago

Can you provide a repository with a minimal reproducible error?

ycs77 commented 2 years ago

This issue has not been updated for a long time, I will close it first. If there are any problems, you can open a new issue.

ycs77 commented 2 years ago

@iconictb @MichaelCereda Thanks report the bug!

Now is fixed in cca08a7, available in the next release.

ycs77 commented 2 years ago

Released v0.5.0, if has any problem can open new issue.