fix: update Field component to allow description as a function for dynamic content

This commit is contained in:
faisolavolut 2025-03-14 09:48:03 +07:00
parent 8b8dfadaa8
commit c0dd392de0
1 changed files with 4 additions and 2 deletions

View File

@ -69,7 +69,7 @@ export interface FieldProps {
visibleLabel?: boolean; visibleLabel?: boolean;
autoRefresh?: boolean; autoRefresh?: boolean;
forceDisabled?: boolean; forceDisabled?: boolean;
description?: string; description?: string | (() => any);
} }
export const Field: React.FC<FieldProps> = ({ export const Field: React.FC<FieldProps> = ({
fm, fm,
@ -516,7 +516,9 @@ export const Field: React.FC<FieldProps> = ({
</div> </div>
</TooltipBetter> </TooltipBetter>
{description ? ( {description ? (
<div className="text-xs text-gray-500 py-1">{description}</div> <div className="text-xs text-gray-500 py-1">
{typeof description === "function" ? description() : description}
</div>
) : ( ) : (
<></> <></>
)} )}