Skip to content

Commit 2bf8599

Browse files
committed
fix: checxbox style
1 parent 42cb687 commit 2bf8599

File tree

1 file changed

+16
-4
lines changed

1 file changed

+16
-4
lines changed

components/checkbox/style/index.ts

Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -36,6 +36,13 @@ export const genCheckboxStyle: GenerateStyle<CheckboxToken> = token => {
3636
...resetComponent(token),
3737

3838
display: 'inline-flex',
39+
flexWrap: 'wrap',
40+
columnGap: token.marginXS,
41+
42+
// Group > Grid
43+
[`> ${token.antCls}-row`]: {
44+
flex: 1,
45+
},
3946
},
4047

4148
// Wrapper
@@ -56,7 +63,7 @@ export const genCheckboxStyle: GenerateStyle<CheckboxToken> = token => {
5663

5764
// Checkbox near checkbox
5865
[`& + ${wrapperCls}`]: {
59-
marginInlineStart: token.marginXS,
66+
marginInlineStart: 0,
6067
},
6168

6269
[`&${wrapperCls}-in-form-item`]: {
@@ -71,21 +78,26 @@ export const genCheckboxStyle: GenerateStyle<CheckboxToken> = token => {
7178
[checkboxCls]: {
7279
...resetComponent(token),
7380

74-
top: '0.2em',
7581
position: 'relative',
7682
whiteSpace: 'nowrap',
7783
lineHeight: 1,
7884
cursor: 'pointer',
7985

86+
// To make alignment right when `controlHeight` is changed
87+
// Ref: https://github.com/ant-design/ant-design/issues/41564
88+
alignSelf: 'center',
89+
8090
// Wrapper > Checkbox > input
8191
[`${checkboxCls}-input`]: {
8292
position: 'absolute',
93+
// Since baseline align will get additional space offset,
94+
// we need to move input to top to make it align with text.
95+
// Ref: https://github.com/ant-design/ant-design/issues/38926#issuecomment-1486137799
8396
inset: 0,
8497
zIndex: 1,
85-
width: '100%',
86-
height: '100%',
8798
cursor: 'pointer',
8899
opacity: 0,
100+
margin: 0,
89101

90102
[`&:focus-visible + ${checkboxCls}-inner`]: {
91103
...genFocusOutline(token),

0 commit comments

Comments
 (0)