Almost everyone working on VA.gov at some point will need to build a new feature, something that doesn't fit into the existing applications or widgets we have currently. This article will help guide you to the right way to implement that new feature.
Types of features on VA.gov
Broadly, we have three kinds of features on VA.gov: static content pages, applications, and widgets.
Static content pages are pages that are built through the Metalsmith build process and are static html stored in AWS. If you're reading this site, you're probably not the person who would be addding one of these pages. Typically these pages are added by content editors in the vagov-content repo or in the Drupal CMS. You may, however, be tasked with adding more complex behaviors to these pages, which is discussed later in the widgets section.
On VA.gov, we use the term "widgets" to describe features that implement some kind of dynamic behavior in a contained place on a page. Examples of this include our saved application widgets, which display information about in progress applications a signed-in user may have, which is shown on various static content pages. Typically these widgets are written in React and are lazily loaded in separate bundles from the default static pages JS bundle.
div for the React application to mount to. These applications have their own JS bundle and the most flexibility for how to render content for a Veteran to interact with.
Examples of applications include our multi page forms, the claim status tracker app, etc.
Choosing the right type
Content pages are the best choice if:
The content on the page or pages you need are completely static and don't change based on api or user data
Widgets are the best choice if:
You need to implement some kind of dynamic behavior based on user input or api data
The dynamic behavior you need is a small part of the overall page
You want content editors to have control over most of what is on the page or pages
You have multiple pages with the same dynamic behavior and want to share code between them
Applications are the best choice if:
Your feature has multiple pages that need to be dynamically created based on user input or api data
Your feature requires a lot of interaction and very little of the page you need is static