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

20 lines
424 B
TypeScript
Raw Normal View History

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