auro-formkit is a collection of web components that can be used to build forms.
It is a monorepo that contains the following components:
auro-checkboxauro-checkbox-group
auro-comboboxauro-counterauro-counter-group
auro-datepickerauro-dropdownauro-formauro-inputauro-menuauro-menu-option
auro-radioauro-radio-group
auro-select
- Sign up and login forms
- Email and password validation
- Collect shipping and billing info
- Use autofill and validation to reduce errors
- Select dates and times
- Prevent invalid selections (like past dates)
- Search inputs with suggestions
- Filters like price ranges or categories
- Upload images, documents, or media
- Restrict file types and allow multiple files
- Collect ratings, choices, and comments
- Require answers where needed
- Show real-time results (e.g., pricing, totals)
- Break long forms into smaller steps
- Use input types that trigger the right keyboard
- Proper labels and grouped inputs
- Built-in error handling
- Use HTML5 rules instead of custom JavaScript
$ npm i @aurodesignsystem/auro-formkitWhen using TypeScript set moduleResolution to bundler, add the following to your tsconfig.json:
{
"compilerOptions": {
"moduleResolution": "bundler"
}
}This configuration enables proper module resolution for the component's TypeScript files.
In cases where the project is not able to process JS assets, there are pre-processed assets available for use. Legacy browsers such as IE11 are no longer supported.
Each component is imported individually by its export path:
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@latest/auro-checkbox/+esm"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@latest/auro-input/+esm"></script>
<script type="module" src="https://cdn.jsdelivr.net/npm/@aurodesignsystem/auro-formkit@latest/auro-select/+esm"></script>This monorepo is managed using Turborepo.
When you install a dependency in a component or package in auro-formkit, you should install it directly in the package that uses it.
The package's package.json will have every dependency that it needs. This is true for both external and internal dependencies.
- These are packages fetched from the
npmregistry (e.g., Lit, Rollup, Sass) - Declared in
package.jsonusing exact versions or version ranges - Installed in
node_modulesduringnpm installoryarn install
- These are packages from within the
auro-formkitmonorepo - Allow sharing code between different packages in your repository
- Example: The
@aurodesignsystem/comboboxpackage might depend on@aurodesignsystem/input - Must be declared in
package.jsonjust like external dependencies - Use workspace protocols (e.g.,
"workspace:*"or"workspace:^1.0.0")
- Required for the package to function in production
- Example:
{ "dependencies": { "lit": "^3.0.0" } }
- Only needed during development, testing, or building
- Not included in the production bundle
- Example:
{ "devDependencies": { "@aurodesignsystem/auro-dropdown": "*", "@aurodesignsystem/build-tools": "*", "rollup": "^4.24.4" } }
Let's use @aurodesignsystem/combobox as an example to illustrate these concepts:
{
"name": "@aurodesignsystem/combobox",
"dependencies": {
"lit": "^3.2.1"
},
"devDependencies": {
// Internal component dependencies
"@aurodesignsystem/auro-dropdown": "*",
"@aurodesignsystem/auro-input": "*",
// Build utilities
"rollup": "^4.24.4",
"@aurodesignsystem/build-tools": "*"
}
}This structure ensures that:
- The package explicitly declares all its dependencies
- Internal dependencies are properly tracked and versioned
- Development tools are separated from production dependencies
-
External dependencies come from the
npmregistry. -
Internal dependencies let you share functionality within your repository.
This practice has several benefits:
-
Improved clarity: It's easier to understand what a package depends on when its dependencies are listed in its
package.json. Developers working in the repository can see at a glance what dependencies are used within the package. -
Enhanced flexibility: In a monorepo at scale, it can be unrealistic to expect each package to use the same version of an external dependency.
-
Better caching ability: If you install too many dependencies in the root of your repository, you'll be changing the workspace root whenever you add, update, or delete a dependency, leading to unnecessary cache misses.
-
Pruning unused dependencies: When dependencies are installed in the packages that they are meant for, Turborepo can read your lockfile and remove dependencies that aren't used in the packages you need.
For more information, see the Turborepo docs.
The only dependencies that belong in the root package.json are tools for managing the repository.
Some examples of dependencies that make sense to install in the root are turbo, husky, or stylelint.
Conversely, dependencies Auro components rely on should be installed in their respective packages, such as Lit, Rollup, or other auro-formkit dependencies.
Running the dev command will open a localhost development server for all components in the monorepo at once.
To only develop a single component, use the --filter flag:
npx turbo dev --filter=@aurodesignsystem/auro-input