mirror of
https://github.com/estruyf/vscode-front-matter.git
synced 2026-05-09 14:54:45 +02:00
20 lines
571 B
TypeScript
20 lines
571 B
TypeScript
import * as React from 'react';
|
|
import { ReactNode } from 'react';
|
|
import './LabelField.css';
|
|
|
|
export interface ILabelFieldProps {
|
|
id: string;
|
|
label: string | ReactNode;
|
|
required?: boolean;
|
|
}
|
|
|
|
export const LabelField: React.FunctionComponent<ILabelFieldProps> = ({ label, id, required }: React.PropsWithChildren<ILabelFieldProps>) => {
|
|
return (
|
|
label ? (
|
|
<label className="autoform__label" htmlFor={id}>
|
|
{label}
|
|
{required && <span title='Required field' className='autoform__label__required'>*</span>}
|
|
</label>
|
|
) : null
|
|
);
|
|
}; |