mirror of
https://github.com/grafana/grafana.git
synced 2025-02-25 18:55:37 -06:00
grafana-ui: Add checkbox value field (#48436)
* grafana-ui: Add checkbox value field * better naming + comment
This commit is contained in:
parent
62cd722726
commit
49491bc73e
@ -12,10 +12,12 @@ export interface CheckboxProps extends Omit<HTMLProps<HTMLInputElement>, 'value'
|
||||
label?: string;
|
||||
description?: string;
|
||||
value?: boolean;
|
||||
// htmlValue allows to specify the input "value" attribute
|
||||
htmlValue?: string | number;
|
||||
}
|
||||
|
||||
export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
||||
({ label, description, value, onChange, disabled, className, ...inputProps }, ref) => {
|
||||
({ label, description, value, htmlValue, onChange, disabled, className, ...inputProps }, ref) => {
|
||||
const handleOnChange = useCallback(
|
||||
(e: React.ChangeEvent<HTMLInputElement>) => {
|
||||
if (onChange) {
|
||||
@ -34,6 +36,7 @@ export const Checkbox = React.forwardRef<HTMLInputElement, CheckboxProps>(
|
||||
checked={value}
|
||||
disabled={disabled}
|
||||
onChange={handleOnChange}
|
||||
value={htmlValue}
|
||||
{...inputProps}
|
||||
ref={ref}
|
||||
/>
|
||||
|
Loading…
Reference in New Issue
Block a user