react-hook-form / devtools

📋 DevTools to help debug forms.
https://react-hook-form.com/dev-tools
MIT License
646 stars 47 forks source link

Allow style overwrite #181

Closed cvolant closed 1 year ago

cvolant commented 1 year ago

This PR aims at allowing overwriting UI styles (button and panel) from the DevTool component.

Use case and motivation

I have a lot of forms on my website, and I add a DevTool component on each of them in debug mode, but if every form display the "open devtool panel" button at the very same place, it is unusable. To fix this problem, I need to customize the button style, which is impossible for now.

I needed to customize the button style, and assumed that someone could need to customize the panel style, that is why I allowed it too.

Content

This PR adds a style prop to the DevToolUI and DevTool components (the last merely transfer it to the former). This style prop has 2 optional properties, button and panel that can receive some styles, spreaded in the button style prop and the the div style prop respectively.