@@ -64,6 +64,37 @@ export interface InputToggleProps
6464 */
6565 toggleClassName ?: string ;
6666
67+ /**
68+ * An optional `style` to provide to the invisible `<input>` element that is
69+ * used to toggle the checked state. This prop is only available since the
70+ * `style` prop is passed to the container element, but you probably shouldn't
71+ * really style this element anyways.
72+ *
73+ * @since 2.2.0
74+ */
75+ inputStyle ?: CSSProperties ;
76+
77+ /**
78+ * An optional `className` to provide to the invisible `<input>` element that
79+ * is used to toggle the checked state. This prop does not have many uses and
80+ * is really just provided since the `className` is passed to the container
81+ * element instead of the `<input>`. However, this can be used to update the
82+ * icon styles if needed using the `:checked` state:
83+ *
84+ * ```scss
85+ * .custom-toggle-icon {
86+ * // styles
87+ * }
88+ *
89+ * .custom-input:checked + .custom-toggle-icon {
90+ * // custom checked styles
91+ * }
92+ * ```
93+ *
94+ * @since 2.2.0
95+ */
96+ inputClassName ?: string ;
97+
6798 /**
6899 * Boolean if the icon's overlay should be disabled. The way the Checkbox and
69100 * Radio input elements work is by applying different opacity to the
@@ -148,6 +179,8 @@ const InputToggle = forwardRef<HTMLInputElement, Props>(function InputToggle(
148179 iconClassName,
149180 toggleStyle,
150181 toggleClassName : propToggleClassName ,
182+ inputStyle,
183+ inputClassName,
151184 icon,
152185 onFocus : propOnFocus ,
153186 onBlur : propOnBlur ,
@@ -224,10 +257,11 @@ const InputToggle = forwardRef<HTMLInputElement, Props>(function InputToggle(
224257 { ...props }
225258 { ...handlers }
226259 ref = { ref }
260+ style = { inputStyle }
227261 disabled = { disabled }
228262 onFocus = { onFocus }
229263 onBlur = { onBlur }
230- className = { block ( "input" ) }
264+ className = { cn ( block ( "input" ) , inputClassName ) }
231265 />
232266 < span
233267 style = { iconStyle }
0 commit comments