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

27 lines
563 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { LabelHTMLAttributes } from 'react';
interface LabelProps
2023-10-14 23:46:36 +03:00
extends Omit<React.DetailedHTMLProps<LabelHTMLAttributes<HTMLLabelElement>, HTMLLabelElement>, 'children' | 'title'> {
text?: string
2023-10-14 23:46:36 +03:00
tooltip?: string
2023-07-15 17:46:19 +03:00
}
function Label({ text, tooltip, className, ...restProps }: LabelProps) {
if (!text) {
return null;
}
2023-07-15 17:46:19 +03:00
return (
<label
className={clsx(
'text-sm font-semibold whitespace-nowrap',
className
)}
title={tooltip}
{...restProps}
>
{text}
</label>);
2023-07-15 17:46:19 +03:00
}
export default Label;