diff --git a/.changeset/unlucky-bikes-care.md b/.changeset/unlucky-bikes-care.md new file mode 100644 index 0000000000..34992e17f5 --- /dev/null +++ b/.changeset/unlucky-bikes-care.md @@ -0,0 +1,5 @@ +--- +"@nextui-org/switch": patch +--- + +Fix switch base element type it is an input now. diff --git a/packages/components/switch/src/switch.tsx b/packages/components/switch/src/switch.tsx index bea99a7ad3..bee6a80bae 100644 --- a/packages/components/switch/src/switch.tsx +++ b/packages/components/switch/src/switch.tsx @@ -6,7 +6,7 @@ import {UseSwitchProps, useSwitch} from "./use-switch"; export interface SwitchProps extends UseSwitchProps {} -const Switch = forwardRef<"label", SwitchProps>((props, ref) => { +const Switch = forwardRef<"input", SwitchProps>((props, ref) => { const { Component, children, diff --git a/packages/components/switch/src/use-switch.ts b/packages/components/switch/src/use-switch.ts index 4dfb7b4226..431733ac97 100644 --- a/packages/components/switch/src/use-switch.ts +++ b/packages/components/switch/src/use-switch.ts @@ -23,7 +23,7 @@ export type SwitchThumbIconProps = { isSelected: boolean; className: string; }; -interface Props extends HTMLNextUIProps<"label"> { +interface Props extends HTMLNextUIProps<"input"> { /** * Ref to the DOM node. */ diff --git a/packages/components/switch/stories/switch.stories.tsx b/packages/components/switch/stories/switch.stories.tsx index 94aeb38735..33a753a70b 100644 --- a/packages/components/switch/stories/switch.stories.tsx +++ b/packages/components/switch/stories/switch.stories.tsx @@ -159,7 +159,7 @@ export const DisableAnimation = { }, }; -export const WiththumbIcon = { +export const WithThumbIcon = { args: { ...defaultProps, size: "xl",