diff --git a/packages/grafana-ui/src/components/Forms/Checkbox.tsx b/packages/grafana-ui/src/components/Forms/Checkbox.tsx index 9fd8b8ff8c8..8cfc3c5312d 100644 --- a/packages/grafana-ui/src/components/Forms/Checkbox.tsx +++ b/packages/grafana-ui/src/components/Forms/Checkbox.tsx @@ -12,10 +12,12 @@ export interface CheckboxProps extends Omit, 'value' label?: string; description?: string; value?: boolean; + // htmlValue allows to specify the input "value" attribute + htmlValue?: string | number; } export const Checkbox = React.forwardRef( - ({ label, description, value, onChange, disabled, className, ...inputProps }, ref) => { + ({ label, description, value, htmlValue, onChange, disabled, className, ...inputProps }, ref) => { const handleOnChange = useCallback( (e: React.ChangeEvent) => { if (onChange) { @@ -34,6 +36,7 @@ export const Checkbox = React.forwardRef( checked={value} disabled={disabled} onChange={handleOnChange} + value={htmlValue} {...inputProps} ref={ref} />