@@ -17,6 +17,7 @@ const scss = `// @import ...
17
17
18
18
const jsx = `import { Checkbox } from 'pretty-checkbox-react';
19
19
20
+ // pass a custom className to Checkbox, Radio, or Switch
20
21
<Checkbox className="my-icon"
21
22
icon={<i className="fas fas-question-circle" />}>
22
23
Label
@@ -41,16 +42,14 @@ function FAQ() {
41
42
< Title > FAQ</ Title >
42
43
< div className = "content" >
43
44
< ol >
44
- < QA title = { < > Formik overrides < code > p-icon</ code > styles</ > } >
45
- If you are using Formik and adding a pretty-checkbox or pretty-checkbox-react component, then you might be seeing visual discrepancies.
46
- We can get around this by using the render prop or child render function exposed by < strong > pretty-react-checkbox</ strong > .
45
+ < QA title = { < > Something is overriding < code > pretty-checkbox</ code > styles!</ > } >
46
+ Sometimes things aren't perfect and styles get messed up. Thankfully, we can fix this easily!
47
47
The easiest way to get around this is to custom build pretty-checkbox < code > .scss</ code > source files.
48
48
Once you have that in place we need to make a few tweaks.
49
49
< SyntaxHighlighter language = "scss" style = { darcula } > { scss } </ SyntaxHighlighter >
50
50
With the magic of using Sass < code > @extends</ code > we can essentially "copy" the pretty-checkbox base styles to our own selector.
51
51
After this, our usage becomes a bit different as well.
52
52
< SyntaxHighlighter language = "jsx" style = { darcula } > { jsx } </ SyntaxHighlighter >
53
- Formik will still apply styles to < code > p-icon</ code > , but the styles shouldn't clash anymore.
54
53
</ QA >
55
54
< QA title = "How can I customize pretty-checkbox state div?" >
56
55
Good question! All components offer < code > render</ code > prop and < code > children</ code > render function support. It's as easy as this:
0 commit comments