Scalable Forms in Vue

Rate this content
Bookmark

Discover the art of creating scalable forms in Vue using FormKit — ideal for teams with complex form-heavy projects. This talk delves into strategies for decomposing forms into smaller, composable components, simplifying development, and enhancing team efficiency.

This talk has been presented at Vue.js Live 2024, check out the latest edition of this Tech Conference.

FAQ

Scalability in client-side code refers to the ability of the code to be reused effectively across teams of varying sizes, from small teams to large organizations. It involves promoting best practices, ensuring code is approachable for all skill levels, and being conducive to collaborative development.

Justin Schrader is a developer known for his involvement in open-source projects like FormKit, Arrow.js, AutoAnimate, Tempo, and Drag'n'Drop. You can follow him on social media at JPSchrader.

FormKit is a comprehensive solution for creating scalable and reusable forms in Vue.js. It provides a wide range of form components and a unique tree architecture to manage form data and validation efficiently.

Code reuse is important for scalable front-ends because it allows teams to efficiently and effectively use existing code across different parts of a project. This reduces redundancy, promotes consistency, and saves development time.

The FormData API has several limitations, including the inability to structure data, limited native validation options, lack of interactivity without JavaScript, and incompatibility with many modern server setups.

FormKit improves form handling by providing a comprehensive set of form components with built-in accessibility and validation features. It uses a tree architecture to manage form data efficiently, eliminating the need for prop drilling and manual data binding.

Key features of FormKit include a wide range of form components, a tree architecture for managing form data, built-in accessibility, validation handling, support for deeply nested structures, and the ability to serialize forms as JSON.

Tempo is a date manipulation library similar to Day.js or Date.fns, while Drag'n'Drop is an easy-to-use drag-and-drop library. Both are open-source projects created by Justin Schrader.

The main advantage of using FormKit over other form libraries like vValidate is its comprehensive approach to handling forms. FormKit not only provides validation but also addresses deeply nested structures, reusable components without prop drilling, and built-in accessibility.

FormKit supports accessibility by shipping form components with accessible HTML out of the box, including ARIA attributes and other best practices to ensure that forms are usable by people with disabilities.

Justin Schroeder
Justin Schroeder
23 min
25 Apr, 2024

Comments

Sign in or register to post your comment.

Video Summary and Transcription

Scalable forms in Vue, approachable for all skill levels, with code reusability and best practices. Front-ends divided into websites and applications, with forms being highly interactive and logic-heavy. Form Components in Vue provide accessible markup, delightful validation, and customizable props. Using vModeling encourages code reuse and collaboration. FormKit offers a comprehensive solution to form problems, including structured data, unique form keys, and robust validation UX. It simplifies form creation, supports CMS-like experiences, and provides advanced features and TypeScript support.
Available in Español: Formularios escalables en Vue

1. Introduction to Scalable Forms in Vue

Short description:

Scalable Forms in Vue. Scalability on the client side. Code reusability and size of organization as metrics. Vue 2 scalability issues. Extract and reuse components. Rubric for measuring scalability: code reuse and best practices. Approachable for all skill levels.

Hi, I'm UJSlive, and thank you so much for coming to my talk, Scalable Forms in Vue. Now scalability brings up a question right away. What is scalability? And generally when we think about scalability, we think about sort of back-end tools, right? From the server side, it might look like load balancers and horizontal versus vertical scaling. Perhaps the requests per second in a traditional web application might be the way that you think about scalability, horizontal versus vertical scaling, things like that.

But I want to talk about a different kind of scalability today. And that's on the client side. What does scalability mean in your client side code? In your Vue code, what does scalability mean? Well, it means things like code reusability and the size of your organization plays a role, how big of an organization can use your front-end code and developers per project might be a good key metric to sort of be able to measure your scalability. Does this front-end code work great for a team of five people? How about a team of 100 people? And this is one of the key drivers behind Vue 3. On a podcast recently, Evan Yu was quoted as saying Vue 2 has scalability issues. We have a huge Vue product and we have these huge components that nobody wants to touch anymore. We don't know how to extract and reuse things. Interesting.

So, let's use what Evan is saying. But first, real quick, who am I? My name is Justin Schrader. You can follow me on the socials at JPSchrader. And if you do happen to know me, it's probably from one of these open source tools that I have either created or am involved with, FormKit, Arrow.js, AutoAnimate, Tempo, and Drag'n'Drop. The last two, Tempo and Drag'n'Drop, are brand spanking new. If you haven't checked them out, you should totally go check them out. Tempo is sort of a Day.js or Date.fns alternative and Drag'n'Drop is a really easy to use little Drag'n'Drop library. But that's enough about me. Let's get back to what Evan was saying there. Scalable front-ends. Basically, I think if we distill down what Evan is saying about a scalable front-end and what we sort of know from our own intuition, we can come up with maybe like a rubric to measure scalability. First of all, I think it should enable code reuse, good code reuse. We all kind of know that this is something that is true. When you write code, you should be able to reuse it effectively and efficiently across your team, and that is part of what makes scalable code. Also, it should encourage best practices. Scalable front-ends should encourage best practices. Your code isn't very scalable if, in order to add accessibility, it requires a full rewrite. Also, it should be approachable for all skill levels.

2. Scalability and Skill Diversity

Short description:

Scalability with diverse skill levels. Approachable for all developers. Tailwind's scalability due to standardized set of class names.

This is actually a really big deal when you think about it, especially with a large team. The bigger your team gets, the more likely it is that it's not just going to be a bunch of super senior front-end engineers. No, it's more likely that you have a big diversity of skill levels. Some people who are brand new and some people who maybe have been doing it for a long time. A good, scalable front-end should be able to work well for all of those people. Everybody should find it approachable.

And finally, is it conducive to a team of developers? This is sort of maybe a summation of what we're saying here. How many people can you put on front-ends in order to make them and still have them work efficiently? I think this is maybe one of the biggest drivers behind Tailwind being so successful, is the fact that anybody can step into Tailwind and you don't have to go relearn all of the class names that exist in an existing project. There could be thousands of them. You have a standardized set. Anybody can get in and make modifications. They know the modifications are limited to something local, so on and so forth. This talk's not about Tailwind, but it is to say, I think that's one of the reasons why you can make the claim that Tailwind is scalable.

QnA

Check out more articles and videos

We constantly think of articles and videos that might spark Git people interest / skill us up or help building a stellar career

Everything Beyond State Management in Stores with Pinia
Vue.js London Live 2021Vue.js London Live 2021
34 min
Everything Beyond State Management in Stores with Pinia
Top Content
State management is not limited to complex applications and transitioning to a store offers significant benefits. Pinia is a centralized state management solution compatible with Vue 2 and Vue 3, providing advanced devtools support and extensibility with plugins. The core API of Pinia is similar to Vuex, but with a less verbose version of stores and powerful plugins. Pinia allows for easy state inspection, error handling, and testing. It is recommended to create one file per store for better organization and Pinia offers a more efficient performance compared to V-rex.
Welcome to Nuxt 3
Vue.js London Live 2021Vue.js London Live 2021
29 min
Welcome to Nuxt 3
Top Content
Nux3 has made significant improvements in performance, output optimization, and serverless support. Nuxt Bridge brings the Nitro engine for enhanced performance and easier transition between Nuxt 2 and Nuxt Read. Nuxt 3 supports Webpack 5, Bytes, and Vue 3. NextLab has developed brand new websites using Docus technology. Nuxt.js is recommended for building apps faster and simpler, and Nuxt 2 should be used before migrating to Nuxt 3 for stability. DOCUS is a new project that combines Nuxt with additional features like content modules and an admin panel.
One Year Into Vue 3
Vue.js London Live 2021Vue.js London Live 2021
20 min
One Year Into Vue 3
Top Content
Vue 3 has seen significant adoption and improvements in performance, bundle size, architecture, and TypeScript integration. The ecosystem around Vue 3 is catching up, with new tools and frameworks being developed. The Vue.js.org documentation is undergoing a complete overhaul. PNIA is emerging as the go-to state management solution for Vue 3. The options API and composition API are both viable options in Vue 3, with the choice depending on factors such as complexity and familiarity with TypeScript. Vue 3 continues to support CDN installation and is recommended for new projects.
Design Systems: Walking the Line Between Flexibility and Consistency
React Advanced Conference 2021React Advanced Conference 2021
47 min
Design Systems: Walking the Line Between Flexibility and Consistency
Top Content
The Talk discusses the balance between flexibility and consistency in design systems. It explores the API design of the ActionList component and the customization options it offers. The use of component-based APIs and composability is emphasized for flexibility and customization. The Talk also touches on the ActionMenu component and the concept of building for people. The Q&A session covers topics such as component inclusion in design systems, API complexity, and the decision between creating a custom design system or using a component library.
Utilising Rust from Vue with WebAssembly
Vue.js London Live 2021Vue.js London Live 2021
8 min
Utilising Rust from Vue with WebAssembly
Top Content
In this Talk, the speaker demonstrates how to use Rust with WebAssembly in a Vue.js project. They explain that WebAssembly is a binary format that allows for high-performance code and less memory usage in the browser. The speaker shows how to build a Rust example using the WasmPack tool and integrate it into a Vue template. They also demonstrate how to call Rust code from a Vue component and deploy the resulting package to npm for easy sharing and consumption.
Vue: Feature Updates
Vue.js London 2023Vue.js London 2023
44 min
Vue: Feature Updates
Top Content
The Talk discusses the recent feature updates in Vue 3.3, focusing on script setup and TypeScript support. It covers improvements in defining props using imported types and complex types support. The introduction of generic components and reworked signatures for defined components provides more flexibility and better type support. Other features include automatic inference of runtime props, improved define emits and defined slots, and experimental features like reactive props destructure and define model. The Talk also mentions future plans for Vue, including stabilizing suspense and enhancing computer invalidations.

Workshops on related topic

Vue3: Modern Frontend App Development
Vue.js London Live 2021Vue.js London Live 2021
169 min
Vue3: Modern Frontend App Development
Top Content
Featured WorkshopFree
Mikhail Kuznetcov
Mikhail Kuznetcov
The Vue3 has been released in mid-2020. Besides many improvements and optimizations, the main feature of Vue3 brings is the Composition API – a new way to write and reuse reactive code. Let's learn more about how to use Composition API efficiently.

Besides core Vue3 features we'll explain examples of how to use popular libraries with Vue3.

Table of contents:
- Introduction to Vue3
- Composition API
- Core libraries
- Vue3 ecosystem

Prerequisites:
IDE of choice (Inellij or VSC) installed
Nodejs + NPM
Build a Data-Rich Beautiful Dashboard With MUI X's Data Grid and Joy UI
React Summit 2023React Summit 2023
137 min
Build a Data-Rich Beautiful Dashboard With MUI X's Data Grid and Joy UI
Top Content
WorkshopFree
Sam Sycamore
Siriwat (Jun) Kunaporn
2 authors
Learn how to put MUI’s complete ecosystem to use to build a beautiful and sophisticated project management dashboard in a fraction of the time that it would take to construct it from scratch. In particular, we’ll see how to integrate the MUI X Data Grid with Joy UI, our newest component library and sibling to the industry-standard Material UI.
Table of contents:- Introducing our project and tools- App setup and package installation- Constructing the dashboard- Prototyping, styling, and themes - Joy UI features- Filtering, sorting, editing - Data Grid features- Conclusion, final thoughts, Q&A
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Vue.js London Live 2021Vue.js London Live 2021
117 min
Using Nitro – Building an App with the Latest Nuxt Rendering Engine
Top Content
Workshop
Daniel Roe
Daniel Roe
We'll build a Nuxt project together from scratch using Nitro, the new Nuxt rendering engine, and Nuxt Bridge. We'll explore some of the ways that you can use and deploy Nitro, whilst building a application together with some of the real-world constraints you'd face when deploying an app for your enterprise. Along the way, fire your questions at me and I'll do my best to answer them.
Monitoring 101 for React Developers
React Summit US 2023React Summit US 2023
107 min
Monitoring 101 for React Developers
Top Content
WorkshopFree
Lazar Nikolov
Sarah Guthals
2 authors
If finding errors in your frontend project is like searching for a needle in a code haystack, then Sentry error monitoring can be your metal detector. Learn the basics of error monitoring with Sentry. Whether you are running a React, Angular, Vue, or just “vanilla” JavaScript, see how Sentry can help you find the who, what, when and where behind errors in your frontend project. 
Workshop level: Intermediate
TresJS create 3D experiences declaratively with Vue Components
Vue.js London 2023Vue.js London 2023
137 min
TresJS create 3D experiences declaratively with Vue Components
Workshop
Alvaro Saburido
Alvaro Saburido
- Intro 3D - Intro WebGL- ThreeJS- Why TresJS- Installation or Stackblitz setup - Core Basics- Setting up the Canvas- Scene- Camera- Adding an object- Geometries- Arguments- Props- Slots- The Loop- UseRenderLoop composable- Before and After rendering callbacks- Basic Animations- Materials- Basic Material- Normal Material- Toon Material- Lambert Material- Standard and Physical Material- Metalness, roughness - Lights- AmbientLight- DirectionalLight- PointLights- Shadows- Textures- Loading textures with useTextures- Tips and tricks- Misc- Orbit Controls- Loading models with Cientos- Debugging your scene- Performance
Building Vue forms with VeeValidate
Vue.js London Live 2021Vue.js London Live 2021
176 min
Building Vue forms with VeeValidate
Workshop
Abdelrahman Awad
Abdelrahman Awad
In this workshop, you will learn how to use vee-validate to handle form validation, manage form values and handle submissions effectively. We will start from the basics with a simple login form all the way to using the composition API and building repeatable and multistep forms.

Table of contents:
- Introduction to vee-validate
- Building a basic form with vee-validate components
- Handling validation and form submissions
- Building validatable input components with the composition API
- Field Arrays and repeatable inputs
- Building a multistep form
Prerequisites:
VSCode setup and an empty Vite + Vue project.