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 20, 2022
1 parent e88b62a commit 5ca79e2
Show file tree
Hide file tree
Showing 2 changed files with 4 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
2 changes: 1 addition & 1 deletion src/mantine-core/src/Switch/Switch.tsx
Expand Up @@ -132,7 +132,7 @@ 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 5ca79e2

Please sign in to comment.