Skip to content

Form

Description

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

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

Components

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.

SubmitButton

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