ConceptPortal-public/rsconcept/frontend/src/components/Common/Label.tsx

21 lines
428 B
TypeScript
Raw Normal View History

2023-07-15 17:46:19 +03:00
interface LabelProps {
text: string
htmlFor?: string
required?: boolean
title?: string
}
2023-07-25 20:27:29 +03:00
function Label({ text, htmlFor, required = false, title }: LabelProps) {
2023-07-15 17:46:19 +03:00
return (
2023-07-25 20:27:29 +03:00
<label
2023-07-15 17:46:19 +03:00
className='text-sm font-semibold'
htmlFor={htmlFor}
title={ (required && !title) ? 'обязательное поле' : title }
>
{text + (required ? '*' : '')}
</label>
);
}
2023-07-25 20:27:29 +03:00
export default Label;