Floating Label from Chakra-Ui and React-Select

Floating Label from Chakra-Ui and React-Select

As a noobie, I have ReactSelect as a defalut component and I'm having troble implemnting a floating label with chakra-ui as it is demonstrated here.

Tryed to add a className="identifier" so themecan find my component. It kind of worked using extendTheme over component/index.

'input:not(:placeholder-shown) + label, .identifier:not(:placeholder-shown) + label...

Happens that label its always active, floating top left and not transitioning back center when there is no option is selected.

If you remove imput from identifier "input:not(:placeholder-shown) + label, .identifier:not(:placeholder-shown) + label...

Oposit behavior. Same doen't happen with date or text imput.

Anys sugestions?

1 Answer

I had your same problem. I found that exist this package: created to make it easier to use the full power of react-select in a chackra-ui react environment.

Here the steps to solve the issue using this package:

In the git issue they use CreatableSelect, but I tested that works with normal Select too (from chakra-react-select package)

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Robert Thorne
Author

Robert Thorne

Robert Thorne covers electric vehicle innovations, autonomous driving systems, global mobility trends, and automotive engineering developments.