--- import type { FormControl } from '../core/form-control'; export interface Props { control: FormControl; showValidationHints: boolean; showOnlyLabel?: boolean; } const { control, showValidationHints, showOnlyLabel = false } = Astro.props; const { validators = [] } = control; const isRequired = showValidationHints && validators.includes('validator-required'); const validatorAttirbutes: Record = validators?.reduce( (prev, validator) => { const split: string[] = validator.split(':'); const label: string = `data-${split[0]}` || 'invalid'; const value: string | null = split.length > 1 ? split[1] ?? null : 'true'; return { ...prev, [label]: value, }; }, {} ); ---
{ control.label && control.labelPosition === 'left' && ( ) } { !showOnlyLabel && ( ) } { control.label && control.labelPosition === 'right' && ( ) }