diff --git a/Checkbox.svelte b/Checkbox.svelte index 253ceb3..1136ded 100644 --- a/Checkbox.svelte +++ b/Checkbox.svelte @@ -3,6 +3,9 @@ import { sineInOut } from "svelte/easing"; import { createStyle } from "./utils"; + + export let disabled = false; + let self, canChange = true, changeBg = false, @@ -136,6 +139,11 @@ --checkbox-border-width: var(--checkbox-border-width-active); stroke: var(--checkbox-color-primary); } + + .checkbox__disabled { + pointer-events: none; + opacity: 0.6; + }
diff --git a/README.md b/README.md index e61b2a4..5949109 100644 --- a/README.md +++ b/README.md @@ -39,6 +39,7 @@ yarn add svelte-checkbox | primaryColor | String | #242432 | Primary color | | secondaryColor | String | #d8d8ea | Secondary color | | checked | Boolean | false | Checked input | +| disabled | Boolean | false | disabled input |
@@ -64,6 +65,16 @@ yarn add svelte-checkbox
+## Disabled checkbox example +```html + + + +``` +
+ ## Full Usage ```html