mirror of
https://github.com/invoke-ai/InvokeAI
synced 2024-08-30 20:32:17 +00:00
feat(ui): add tooltip to IAISwitch
This commit is contained in:
parent
4f7820719b
commit
2270c270ef
@ -5,6 +5,7 @@ import {
|
|||||||
FormLabelProps,
|
FormLabelProps,
|
||||||
Switch,
|
Switch,
|
||||||
SwitchProps,
|
SwitchProps,
|
||||||
|
Tooltip,
|
||||||
} from '@chakra-ui/react';
|
} from '@chakra-ui/react';
|
||||||
import { memo } from 'react';
|
import { memo } from 'react';
|
||||||
|
|
||||||
@ -13,6 +14,7 @@ interface Props extends SwitchProps {
|
|||||||
width?: string | number;
|
width?: string | number;
|
||||||
formControlProps?: FormControlProps;
|
formControlProps?: FormControlProps;
|
||||||
formLabelProps?: FormLabelProps;
|
formLabelProps?: FormLabelProps;
|
||||||
|
tooltip?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@ -25,9 +27,11 @@ const IAISwitch = (props: Props) => {
|
|||||||
width = 'auto',
|
width = 'auto',
|
||||||
formControlProps,
|
formControlProps,
|
||||||
formLabelProps,
|
formLabelProps,
|
||||||
|
tooltip,
|
||||||
...rest
|
...rest
|
||||||
} = props;
|
} = props;
|
||||||
return (
|
return (
|
||||||
|
<Tooltip label={tooltip} hasArrow placement="top" isDisabled={!tooltip}>
|
||||||
<FormControl
|
<FormControl
|
||||||
isDisabled={isDisabled}
|
isDisabled={isDisabled}
|
||||||
width={width}
|
width={width}
|
||||||
@ -43,6 +47,7 @@ const IAISwitch = (props: Props) => {
|
|||||||
)}
|
)}
|
||||||
<Switch {...rest} />
|
<Switch {...rest} />
|
||||||
</FormControl>
|
</FormControl>
|
||||||
|
</Tooltip>
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user