-
Notifications
You must be signed in to change notification settings - Fork 33
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
feat(Forms): introduce
decoupleForm
prop to Form.Handler (#4332)
- Loading branch information
1 parent
76bddf0
commit 0b02b6e
Showing
12 changed files
with
451 additions
and
279 deletions.
There are no files selected for viewing
2 changes: 1 addition & 1 deletion
2
packages/dnb-design-system-portal/src/docs/uilib/extensions/forms/Form/Handler.mdx
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,14 +6,30 @@ showTabs: true | |
|
||
`Form` provides the main forms-helpers including data provider and event handling. | ||
|
||
```jsx | ||
```tsx | ||
import { Form, Field } from '@dnb/eufemia/extensions/forms' | ||
render( | ||
<Form.Handler data={existingData} onSubmit={submitHandler}> | ||
<Field.Email path="/email" /> | ||
<Form.ButtonRow> | ||
<Form.SubmitButton /> | ||
</Form.ButtonRow> | ||
</Form.Handler>, | ||
) | ||
|
||
const existingData = { | ||
email: '[email protected]', | ||
} | ||
|
||
function MyForm() { | ||
return ( | ||
<Form.Handler | ||
defaultData={existingData} | ||
onSubmit={async (data) => { | ||
await makeRequest(data) | ||
}} | ||
> | ||
<Form.MainHeading>Heading</Form.MainHeading> | ||
<Form.Card> | ||
<Field.Email path="/email" /> | ||
</Form.Card> | ||
|
||
<Form.ButtonRow> | ||
<Form.SubmitButton /> | ||
</Form.ButtonRow> | ||
</Form.Handler> | ||
) | ||
} | ||
``` |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.