astro-reactive-form/packages/form/components/FieldSet.astro
Alexander Samaniego 93a8d49f0a
feat(form): implement unique IDs (#182)
* Added Short Unique ID npm library

* Added unique ID to form-control

* Added unique ID to form-group

* Unique ID added to <form>

* Added unique IDs to control components

* Added IDs to label and fieldset

* Update Form.astro with requested changes

Co-authored-by: Ayo Ayco <ayo@ayco.io>

* Adjustments for requested changes.

Co-authored-by: Ayo Ayco <ayo@ayco.io>
2022-11-08 08:53:22 +01:00

21 lines
511 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.id} name={group.name}>
{group.name && <legend>{group.name}</legend>}
{
group?.controls?.map((control) => (
<Field showValidationHints={showValidationHints} control={control} readOnly={readOnly} />
))
}
</fieldset>