Skip to content

Commit

Permalink
[@mantine/core] Switch: Add data-checked attribute to the input (#7228)
Browse files Browse the repository at this point in the history
  • Loading branch information
rtivital committed Dec 12, 2024
1 parent b73f37a commit 0060acd
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion packages/@mantine/core/src/components/Switch/Switch.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ export const Switch = factory<SwitchFactory>((_props, ref) => {
classNames={classNames}
styles={styles}
unstyled={unstyled}
data-checked={contextProps.checked || undefined}
data-checked={contextProps.checked || checked || undefined}
variant={variant}
ref={rootRef}
mod={mod}
Expand All @@ -201,6 +201,7 @@ export const Switch = factory<SwitchFactory>((_props, ref) => {
{...rest}
disabled={disabled}
checked={_checked}
data-checked={contextProps.checked || checked || undefined}
onChange={(event) => {
ctx ? contextProps.onChange?.(event) : onChange?.(event);
handleChange(event.currentTarget.checked);
Expand Down

0 comments on commit 0060acd

Please sign in to comment.