Skip to content

Description

Form provides the main forms-helpers including data provider and event handling.

import { Card } from '@dnb/eufemia'
import { Form, Field } from '@dnb/eufemia/extensions/forms'
render(
<Form.Handler data={existingData} onSubmit={submitHandler}>
<Card>
<Field.Email path="/dataPath" />
<Form.ButtonRow>
<Form.SubmitButton />
</Form.ButtonRow>
</Card>
</Form.Handler>,
)

Components

ButtonRow

Form.ButtonRow is a wrapper for horizontally separated buttons.

Element

Form.Element is a wrapper component for the HTML form element.

Handler

Form.Handler provides both the DataContext.Provider and a HTML form element.

MainHeading

Form.MainHeading is a standardized main heading for sections, ensuring default layout, spacing etc.

SubHeading

Form.SubHeading is a standardized sub heading for sections, ensuring default layout, spacing etc.

SubmitButton

Form.SubmitButton connects to the Form.Handler to submit the active state of the internal DataContext, triggering onSubmit.