Closed ziracmo closed 6 months ago
@ziracmo The position is off probably due to missing ref. Try forwardRef on your custom button.
Thank you @wingkwong. This is working with the following code:
export const MyCustomButton = forwardRef((props: ButtonProps, ref) => {
const MyButton = useMemo(
() =>
extendVariants(Button, {
variants: {
color: {
danger: "bg-blue-500 text-white",
},
},
}),
[]
);
return <MyButton {...props} ref={ref} />;
});
Could this be something mentioned in the documentation?
NextUI Version
2.2.0
Describe the bug
Using NextJs and NextUI with the follow versions:
I'm trying to extend NextUI's Button to create a custom one. However, this custom button will open the NextUi Dropdown but will be placed bellow the footer's page.
Example
custom-button.tsx
page.tsx
Your Example Website or App
No response
Steps to Reproduce the Bug or Issue
Expected behavior
Open the dropdown below the button, and not bellow the page footer.
Screenshots or Videos
screencast-localhost_3000-2024.04.19-11_48_53.webm
Operating System Version
MacOS 14.4.1
Browser
Chrome