astro-reactive-form/packages/form/components/FieldSet.astro
Allan Siqueira f502e6ca24
feat(form): readOnly flag (#166)
* feat: add readOnly flag on form

* fix: resolve PR coments

* fix: add flag disabled to fields that dont have effect on readonly attr
2022-10-31 17:27:43 +01:00

21 lines
513 B
Text

---
import type { FormGroup } from '../core/form-group';
import Field from './Field.astro';
export interface Props {
group: FormGroup;
showValidationHints: boolean;
readOnly?: boolean;
}
const { group, showValidationHints, readOnly = false } = Astro.props;
---
<fieldset id={group.name} name={group.name}>
{group.name && <legend>{group.name}</legend>}
{
group?.controls?.map((control) => (
<Field showValidationHints={showValidationHints} control={control} readOnly={readOnly} />
))
}
</fieldset>