Skip to content

Commit

Permalink
[@mantine/core] Switch: add data-disabled + change color when disable…
Browse files Browse the repository at this point in the history
…d on label
  • Loading branch information
omarsy committed Sep 21, 2022
1 parent e88b62a commit 833620c
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 1 deletion.
3 changes: 3 additions & 0 deletions src/mantine-core/src/Switch/Switch.styles.ts
Expand Up @@ -163,6 +163,9 @@ export default createStyles((theme, { size, radius, color }: SwitchStylesParams)
paddingLeft: theme.spacing.sm,
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],
},
},

trackLabel: {
Expand Down
6 changes: 5 additions & 1 deletion src/mantine-core/src/Switch/Switch.tsx
Expand Up @@ -132,7 +132,11 @@ export const Switch: SwitchComponent = forwardRef<HTMLInputElement, SwitchProps>
</div>

{label && (
<div data-testid="label" className={classes.label}>
<div
data-testid="label"
data-disabled={rest.disabled || undefined}
className={classes.label}
>
{label}
</div>
)}
Expand Down

0 comments on commit 833620c

Please sign in to comment.