--- import { Icon } from 'astro-icon/components' import { Markdown } from 'astro-remote' import { cn } from '../lib/cn' import type { AstroChildren } from '../lib/astro' import type { MarkdownString } from '../lib/markdown' import type { HTMLAttributes } from 'astro/types' type Props = HTMLAttributes<'div'> & { children: AstroChildren label: string name: string description?: MarkdownString descriptionLabel?: string required?: HTMLAttributes<'input'>['required'] error?: string[] | string icon?: string inputId?: string hideLabel?: boolean } const { label, name, description, descriptionLabel, required, error, icon, class: className, inputId, hideLabel, ...htmlProps } = Astro.props const hasError = !!error && error.length > 0 ---
{ !hideLabel && (
{icon && } {required && '*'} {!!descriptionLabel && ( {descriptionLabel} )}
) } { hasError && (typeof error === 'string' ? (

{error}

) : ( )) } { !!description && (
) }