-
-
Notifications
You must be signed in to change notification settings - Fork 31
Svelte 5 dynamic form building with formisch #154
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Changes from all commits
Commits
Show all changes
16 commits
Select commit
Hold shift + click to select a range
bd9240a
Blog: Add dynamic invoice form guide with Svelte 5 and Formisch
flySewa 6f1425a
Fix blog post formatting and add missing blog metadata
flySewa 16cac43
Improve clarity and conciseness in dynamic invoice form guide
flySewa b587264
Add type annotation to submitInvoice function
flySewa e0088f0
Enhance Formisch documentation with detailed benefits
flySewa c8447d1
Add Svelte invoice example to repo
fabian-hiller 8956b5f
Update a few things in dynamic invoice form post
fabian-hiller 0324da5
Address PR review feedback and futhre improve post and example
fabian-hiller 97aa41a
Refactor invoice total calculation with $derived
flySewa a023d6d
Improve line total calculation in dynamic invoice form
flySewa 7cc37e7
Refine language and explanations in invoice form docs
flySewa f7fffef
Clarify invoice total explanation in documentation
flySewa d256966
Update publication date
flySewa f708f2f
Enhance discussion on form state management
flySewa 707e55a
Fix errors
flySewa f794eed
Fix formatting of code example in blog post
fabian-hiller File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,4 @@ | ||
| node_modules | ||
| dist | ||
| .DS_Store | ||
| *.local |
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,39 @@ | ||
| # Dynamic Invoice Form — Formisch + Svelte 5 | ||
|
|
||
| A minimal, standalone [Vite](https://vite.dev) + [Svelte 5](https://svelte.dev) example that builds a dynamic invoice form with [Formisch](https://formisch.dev) and [Valibot](https://valibot.dev). | ||
|
|
||
| It demonstrates the ideas from the guide [_Building a Dynamic Invoice Form in Svelte 5 with Formisch_](https://formisch.dev/blog/dynamic-invoice-form-svelte/): | ||
|
|
||
| - A single Valibot schema as the source of truth for structure, validation and typed output | ||
| - Nested fields (`client.name`, `client.email`) wired with `Field` | ||
| - Dynamic line items with `FieldArray`, plus `insert` / `remove` | ||
| - Live totals derived from the form input with Svelte 5's `$derived` | ||
| - Typed, validated output on submit and one-call `reset` | ||
|
|
||
| ## Getting started | ||
|
|
||
| ```bash | ||
| npm install | ||
| npm run dev | ||
| ``` | ||
|
|
||
| Then open the printed local URL. | ||
|
|
||
| ## Scripts | ||
|
|
||
| | Command | Description | | ||
| | ----------------- | ---------------------------------------- | | ||
| | `npm run dev` | Start the Vite dev server | | ||
| | `npm run build` | Build for production into `dist/` | | ||
| | `npm run preview` | Preview the production build | | ||
| | `npm run check` | Type-check the project with svelte-check | | ||
|
|
||
| ## Project structure | ||
|
|
||
| ``` | ||
| src/ | ||
| ├── App.svelte # The invoice form (fields, array, totals, submit) | ||
| ├── schema.ts # Valibot InvoiceSchema + inferred InvoiceOutput type | ||
| ├── main.ts # App entry point | ||
| └── app.css # Minimal styling | ||
| ``` | ||
This file contains hidden or 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 |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="UTF-8" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0" /> | ||
| <title>Dynamic Invoice Form · Formisch + Svelte 5</title> | ||
| </head> | ||
| <body> | ||
| <div id="app"></div> | ||
| <script type="module" src="/src/main.ts"></script> | ||
| </body> | ||
| </html> |
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.