To achieve your desired outcome using the available libraries and components, there are a few steps involved which I will explain in detail.
When working with React-Nice-Input-Password, you can provide a custom class name for different states such as success by utilizing
<NiceInputPassword successClassName="custom-success"
. By adding this prop, you can style the bullet points accordingly using CSS selectors like
.input-password__description li.custom-success:before
. Consider experimenting with less specific selectors for customization possibilities.
The interesting part comes when styling the bullet points. You can set the background-color: transparent
, then add a background image using a Data URL referencing an SVG code like the CheckCircle from MUI Icons with customized properties such as width, height, and fill color.
.input-password__description li.custom-success:before {
background-color: transparent;
background-image: url('data:image/svg+xml;utf-8,<svg xmlns="http://www.w3.org/2000/svg" width="10" height="10" viewBox="0 0 24 24"><path fill="%232196F3" d="M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 15-5-5 1.41-1.41L10 14.17l7.59-7.59L19 8l-9 9z"></path></svg>');
}
If you wish to customize the color further, you have options like adjusting the fill
property or using the filter
CSS property to modify specific elements.
Remember to import the CSS file appropriately into your project for the styles to take effect, like import './custom.css';
.
For reference, here is a sandbox showcasing the described changes in action with varying colors for the success bullet points:
https://codesandbox.io/s/reactniceinputpassword-forked-od5r1y?fontsize=14&hidenavigation=1&theme=dark
Additional resources for further reading:
- Guide on changing SVG fill color in base-64 background image data
- Using Material Design Icon as CSS background-image value