Skip to content

Commit

Permalink
[@mantine/core] Checkbox: add data-disabled + change color when disab…
Browse files Browse the repository at this point in the history
…led on label (#2508)
  • Loading branch information
omarsy committed Sep 24, 2022
1 parent 865fbde commit 2c1b3dd
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/mantine-core/src/Checkbox/Checkbox.styles.ts
Expand Up @@ -71,6 +71,9 @@ export default createStyles(
lineHeight: `${_size}px`,
color: theme.colorScheme === 'dark' ? theme.colors.dark[0] : theme.black,
cursor: theme.cursorType,
'&[data-disabled]': {
color: theme.colorScheme === 'dark' ? theme.colors.dark[3] : theme.colors.gray[5],
},
},

input: {
Expand Down
4 changes: 3 additions & 1 deletion src/mantine-core/src/Checkbox/Checkbox.tsx
Expand Up @@ -67,6 +67,7 @@ export const Checkbox: CheckboxComponent = forwardRef<HTMLInputElement, Checkbox
style,
sx,
checked,
disabled,
color,
label,
indeterminate,
Expand Down Expand Up @@ -113,6 +114,7 @@ export const Checkbox: CheckboxComponent = forwardRef<HTMLInputElement, Checkbox
type="checkbox"
className={classes.input}
checked={indeterminate || checked}
disabled={disabled}
{...rest}
{...contextProps}
/>
Expand All @@ -121,7 +123,7 @@ export const Checkbox: CheckboxComponent = forwardRef<HTMLInputElement, Checkbox
</div>

{label && (
<label className={classes.label} htmlFor={uuid}>
<label data-disabled={disabled || undefined} className={classes.label} htmlFor={uuid}>
{label}
</label>
)}
Expand Down

0 comments on commit 2c1b3dd

Please sign in to comment.