Skip to content

Commit 3e3cc6c

Browse files
committed
fix(checkbox): document and add custom CSS properties
references #14850 references #14808
1 parent 5ed2201 commit 3e3cc6c

File tree

1 file changed

+38
-19
lines changed

1 file changed

+38
-19
lines changed

core/src/components/checkbox/checkbox.scss

Lines changed: 38 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -4,32 +4,32 @@
44
// --------------------------------------------------
55

66
:host {
7-
--ion-color-base: #{ion-color(primary, base)};
8-
--ion-color-contrast: #{ion-color(primary, contrast)};
9-
10-
// Checked colors
11-
--background-checked: #{current-color(base)};
12-
--border-color-checked: #{current-color(base)};
13-
--checkmark-color: #{current-color(contrast)};
7+
/**
8+
* @prop --background: Background of the checkbox icon
9+
* @prop --border-color: Border color of the checkbox icon
10+
* @prop --border-radius: Border radius of the checkbox icon
11+
* @prop --border-width: Border width of the checkbox icon
12+
* @prop --border-style: Border style of the checkbox icon
13+
* @prop --size: Size of the checkbox icon
14+
* @prop --transition: Transition of the checkbox icon
15+
* @prop --background-checked: Background of the checkbox icon when checked
16+
* @prop --border-color-checked: Border color of the checkbox icon when checked
17+
* @prop --checkmark-color: Color of the checkbox checkmark when checked
18+
*/
19+
--background-checked: #{ion-color(primary, base)};
20+
--border-color-checked: #{ion-color(primary, base)};
21+
--checkmark-color: #{ion-color(primary, contrast)};
1422

1523
display: inline-block;
1624
position: relative;
1725

1826
user-select: none;
1927
}
2028

21-
:host(.checkbox-disabled) {
22-
pointer-events: none;
23-
}
24-
25-
:host(.checkbox-checked) .checkbox-icon {
26-
border-color: var(--border-color-checked);
27-
28-
background: var(--background-checked);
29-
}
30-
31-
:host(.checkbox-checked) .checkbox-inner {
32-
opacity: 1;
29+
:host(.ion-color) {
30+
--background-checked: #{current-color(base)};
31+
--border-color-checked: #{current-color(base)};
32+
--checkmark-color: #{current-color(contrast)};
3333
}
3434

3535
input {
@@ -61,3 +61,22 @@ input {
6161
opacity: 0;
6262
}
6363

64+
// Checked Checkbox
65+
// ---------------------------------------------
66+
67+
:host(.checkbox-checked) .checkbox-icon {
68+
border-color: var(--border-color-checked);
69+
70+
background: var(--background-checked);
71+
}
72+
73+
:host(.checkbox-checked) .checkbox-inner {
74+
opacity: 1;
75+
}
76+
77+
// Disabled Checkbox
78+
// ---------------------------------------------
79+
80+
:host(.checkbox-disabled) {
81+
pointer-events: none;
82+
}

0 commit comments

Comments
 (0)