A Vue 3 implementation of the USWDS. If you need Vue 2 support, check out the USWDS-Vue library.
A Nuxt 3 integration module is available.
Note: You will need to install the USWDS CSS separately.
Vue USWDS can be installed either by including it with a simple script
tag or using NPM and a build system.
The easiest way to include the library with a script tag is to use a CDN such as jsDelivr or unpkg. You can also load the library locally on your server.
When using with a script tag all components will be imported.
<script src="https://unpkg.com/vue@3"></script>
<script src="https://unpkg.com/vue-uswds"></script>
npm install vue-uswds
// or
yarn install vue-uswds
When importing the library via NPM you can import all components or use the À La Carte method to import only specific components. The À La Carte method makes it easier to reduce the final bundle size of your application by only including components you are using.
import Vue from 'vue'
import VueUswds from 'vue-uswds'
const app = Vue.createApp({})
app.use(VueUswds, {
// ...options
})
app.mount('#app')
// App.vue
import Vue from 'vue'
import VueUswds from 'vue-uswds/core' // Import only the core library.
const app = Vue.createApp({})
app.use(VueUswds, {
// ...options
})
app.mount('#app')
// MyComponent.vue
<script>
import { UsaTag } from 'vue-uswds/components'
export default {
components: { UsaTag },
}
</script>
<template>
<UsaTag>My Custom Tag</UsaTag>
</template>
If there are components you wish to use anywhere in your app without first importing them, you can register them globally.
// App.vue
import Vue from 'vue'
import VueUswds from 'vue-uswds/core' // Import only the core library.
import { UsaTag } from 'vue-uswds/components'
const app = Vue.createApp({})
app.use(VueUswds, {
// ...options
})
// Register any global components...
app.component('UsaTag', UsaTag)
app.mount('#app')
npm run commit
which will use Comittizen to walk you through the formatting options of your commit.npm
, not yarn
or pnpm
.npm run storybook
.Use act to test Github actions locally.
Note: Because the act docker containers do not have the XVFB dependency installed, you must use a custom docker container from Cypress by adding:
container:
image: cypress/browsers:node14.17.0-chrome91-ff89
The specific container can be one of Cypress's docker images.
You may also need to temporarily adjust the node matrix versions to use the provided by the Cypress container.
Specific Cypress component tests:
node_modules/.bin/cypress run-ct --spec="src/components/UsaDatePickerCalendar/UsaDatePickerCalendar.test.js" --headed --no-exit
All Cypress component tests headless:
npm run test:component
Headed Cypress interactive component tests:
npm run cypress:open-ct