aboutsummaryrefslogtreecommitdiff
path: root/src/components/checkbox
diff options
context:
space:
mode:
authortaehoon <th.dev91@gmail.com>2019-04-06 13:45:28 -0400
committertaehoon <th.dev91@gmail.com>2019-04-17 11:32:49 -0400
commitecff6acf2d651931e06eebfa8856d940aedb2bee (patch)
tree080100a22deecc56519ccf4a55180637fce0d965 /src/components/checkbox
parent3f5e798de79b401945d2a0ac992ca5ee6115d79f (diff)
support indeterminate checkbox state
Diffstat (limited to 'src/components/checkbox')
-rw-r--r--src/components/checkbox/checkbox.vue10
1 files changed, 8 insertions, 2 deletions
diff --git a/src/components/checkbox/checkbox.vue b/src/components/checkbox/checkbox.vue
index 8f32e96b..4152b049 100644
--- a/src/components/checkbox/checkbox.vue
+++ b/src/components/checkbox/checkbox.vue
@@ -1,6 +1,6 @@
<template>
<label class="checkbox">
- <input type="checkbox" :checked="checked" @change="$emit('change', $event.target.checked)">
+ <input type="checkbox" :checked="checked" @change="$emit('change', $event.target.checked)" :indeterminate.prop="indeterminate">
<i class="checkbox-indicator" />
<span v-if="!!$slots.default"><slot></slot></span>
</label>
@@ -12,7 +12,7 @@ export default {
prop: 'checked',
event: 'change'
},
- props: ['checked']
+ props: ['checked', 'indeterminate']
}
</script>
@@ -57,6 +57,12 @@ export default {
color: var(--text, $fallback--text);
}
+ &:indeterminate + .checkbox-indicator::before {
+ content: '–';
+ color: $fallback--text;
+ color: var(--text, $fallback--text);
+ }
+
&:disabled + .checkbox-indicator::before {
opacity: .5;
}