diff --git a/docs/src/sections/FAQ.js b/docs/src/sections/FAQ.js
index 8b10f26..a4dc293 100644
--- a/docs/src/sections/FAQ.js
+++ b/docs/src/sections/FAQ.js
@@ -17,6 +17,7 @@ const scss = `// @import ...
const jsx = `import { Checkbox } from 'pretty-checkbox-react';
+// pass a custom className to Checkbox, Radio, or Switch
p-icon
styles>}>
- If you are using Formik and adding a pretty-checkbox or pretty-checkbox-react component, then you might be seeing visual discrepancies.
- We can get around this by using the render prop or child render function exposed by pretty-react-checkbox.
+ pretty-checkbox
styles!>}>
+ Sometimes things aren't perfect and styles get messed up. Thankfully, we can fix this easily!
The easiest way to get around this is to custom build pretty-checkbox .scss
source files.
Once you have that in place we need to make a few tweaks.
@extends
we can essentially "copy" the pretty-checkbox base styles to our own selector.
After this, our usage becomes a bit different as well.
p-icon
, but the styles shouldn't clash anymore.
render
prop and children
render function support. It's as easy as this:
diff --git a/package.json b/package.json
index f52dd10..6b4b8bf 100644
--- a/package.json
+++ b/package.json
@@ -1,6 +1,6 @@
{
"name": "pretty-checkbox-react",
- "version": "1.0.3",
+ "version": "1.0.4",
"description": "Quickly integrate pretty checkbox Components (checkbox, switch, radio) with React",
"keywords": [
"Pretty",
diff --git a/src/components/Checkbox.js b/src/components/Checkbox.js
index 74d6736..5e64888 100644
--- a/src/components/Checkbox.js
+++ b/src/components/Checkbox.js
@@ -17,7 +17,7 @@ export type CheckboxProps = {
};
function Checkbox(props: CheckboxProps) {
- const { animation } = props;
+ const { animation, className, ...rest } = props;
if (animation
&& animation !== 'smooth'
@@ -28,11 +28,16 @@ function Checkbox(props: CheckboxProps) {
throw new Error(`animation '${animation}' is incompatible with default checkbox styles. You must specify an icon, image, or a svg.`);
}
- return ;
+ return (
+
+ );
}
export default Checkbox;
diff --git a/src/components/Radio.js b/src/components/Radio.js
index 5484e98..aeeb588 100644
--- a/src/components/Radio.js
+++ b/src/components/Radio.js
@@ -22,9 +22,13 @@ function Radio(props: RadioProps) {
return (
diff --git a/src/components/__tests__/Checkbox.test.js b/src/components/__tests__/Checkbox.test.js
index bbc9db6..5d78b2e 100644
--- a/src/components/__tests__/Checkbox.test.js
+++ b/src/components/__tests__/Checkbox.test.js
@@ -11,9 +11,12 @@ describe('Checkbox tests', function () {
describe('Basic Checkbox usage', function () {
it('should behave as a checkbox', function () {
const handleChange = jest.fn();
- const { container } = render(