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

29 lines
529 B
TypeScript
Raw Normal View History

import clsx from 'clsx';
import { CProps } from '../props';
2023-12-28 14:04:44 +03:00
interface LabelProps extends CProps.Label {
text?: string;
2023-07-15 17:46:19 +03:00
}
function Label({ text, className, ...restProps }: LabelProps) {
if (!text) {
return null;
}
if (restProps.htmlFor) {
return (
<label className={clsx('cc-label', className)} {...restProps}>
{text}
</label>
);
} else {
return (
<span className={clsx('cc-label', className)} {...restProps}>
{text}
</span>
);
}
2023-07-15 17:46:19 +03:00
}
2023-12-28 14:04:44 +03:00
export default Label;