/** * Copyright (c) 2025 Bytedance Ltd. and/or its affiliates * SPDX-License-Identifier: MIT */ import React, { useCallback } from 'react'; import { Typography, Tooltip } from '@douyinfe/semi-ui'; import { TypeTag } from '../type-tag'; import './index.css'; const { Text } = Typography; interface FormItemProps { children: React.ReactNode; name: string; type: string; required?: boolean; description?: string; labelWidth?: number; vertical?: boolean; } export function FormItem({ children, name, required, description, type, labelWidth, vertical, }: FormItemProps): JSX.Element { const renderTitle = useCallback( (showTooltip?: boolean) => (
{name} {required && *}
), [] ); return (
{description ? {renderTitle()} : renderTitle(true)}
{children}
); }