import cn from '@/utils/classnames' import Tooltip from '../../tooltip' import { useTranslation } from 'react-i18next' export type LabelProps = { htmlFor: string label: string isRequired?: boolean showOptional?: boolean tooltip?: string className?: string } const Label = ({ htmlFor, label, isRequired, showOptional, tooltip, className, }: LabelProps) => { const { t } = useTranslation() return (
{!isRequired && showOptional &&
{t('common.label.optional')}
} {isRequired &&
*
} {tooltip && ( {tooltip}
} triggerClassName='ml-0.5 w-4 h-4' triggerTestId={`${htmlFor}-tooltip`} /> )} ) } export default Label