Function
FieldStack
({
label,
children,
helper,
action,
error,
alignLabelRow = false,
className,
labelClassName,
helperClassName,
errorClassName,
}: FieldStackProps)
Source from the content-addressed store, hash-verified
| 16 | }; |
| 17 | |
| 18 | export function FieldStack({ |
| 19 | label, |
| 20 | children, |
| 21 | helper, |
| 22 | action, |
| 23 | error, |
| 24 | alignLabelRow = false, |
| 25 | className, |
| 26 | labelClassName, |
| 27 | helperClassName, |
| 28 | errorClassName, |
| 29 | }: FieldStackProps) { |
| 30 | return ( |
| 31 | <Field.Root |
| 32 | className={cn("polli:flex polli:flex-col polli:gap-2", className)} |
| 33 | invalid={Boolean(error)} |
| 34 | > |
| 35 | <div |
| 36 | className={cn( |
| 37 | "polli:flex polli:items-center polli:justify-between polli:gap-2", |
| 38 | alignLabelRow && "polli:min-h-8", |
| 39 | )} |
| 40 | > |
| 41 | <Field.Label |
| 42 | className={cn( |
| 43 | "polli:text-sm polli:font-semibold polli:text-theme-text-strong", |
| 44 | labelClassName, |
| 45 | )} |
| 46 | > |
| 47 | {label} |
| 48 | </Field.Label> |
| 49 | {action} |
| 50 | </div> |
| 51 | {children} |
| 52 | {error ? ( |
| 53 | <Field.ErrorText |
| 54 | className={cn( |
| 55 | "polli:text-xs polli:font-medium polli:leading-5 polli:text-intent-danger-text", |
| 56 | errorClassName, |
| 57 | )} |
| 58 | > |
| 59 | {error} |
| 60 | </Field.ErrorText> |
| 61 | ) : helper ? ( |
| 62 | <Field.HelperText |
| 63 | className={cn( |
| 64 | "polli:text-xs polli:leading-5 polli:text-theme-text-muted", |
| 65 | helperClassName, |
| 66 | )} |
| 67 | > |
| 68 | {helper} |
| 69 | </Field.HelperText> |
| 70 | ) : null} |
| 71 | </Field.Root> |
| 72 | ); |
| 73 | } |
Callers
nothing calls this directly
Tested by
no test coverage detected