Ralfarios / antd-input-otp

An OTP Input Component based on Ant Design Component Library for React.
https://www.npmjs.com/package/antd-input-otp
19 stars 4 forks source link

Changing input style after filling #15

Closed mohammadbrzbrz72 closed 11 months ago

mohammadbrzbrz72 commented 1 year ago

How can I change the style of inputs after they have been filled?

for example change the background or border style.

antd-otp

Ralfarios commented 1 year ago

Hello, @mohammadbrzbrz72

May I know which antd ver. are you currently using in your project?

Cheers, R.

mohammadbrzbrz72 commented 11 months ago

Hello In my project the antd version is "^5.6.1", And the antd-input-otp is "^1.1.0"

mohammadbrzbrz72 commented 11 months ago

Would you please tell me how can I do that?

For example I want to set green background for input after filling

Ralfarios commented 11 months ago

First thing first, you need to add inputClassName to your component, let's say it's

<InputOTP
  // Other props...
  inputClassName="input_otp"
/>

and then on your CSS files, use this className with value as attribute selector..

.input_otp[value]:not([value=""]){
  // Your desire style
}

It should work like a charm image

mohammadbrzbrz72 commented 11 months ago

@Ralfarios

Thank you very much for answering 🙏🙌❤️