
Security News
The Changelog Podcast: Practical Steps to Stay Safe on npm
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.
@department-of-veterans-affairs/va-design-system-tokens
Advanced tools
VA Design System Tokens Package
The Tokens package contains the design tokens for the VA Mobile Design Library. It uses Style Dictionary as a build system to define our styles in JSON and export them to different formats.
Direct consumption of the tokens package is optional, but recommended. The tokens package contains the same building blocks used to build the design system components which will more easily allow screen content and app-level custom components to follow design system conventions, helping maintain consistency in experience for users. It is also recommended to match the tokens package version to the version of tokens used by the components package you are leveraging, to ensure consistency.
To use the tokens, simply:
@department-of-veterans-affairs/mobile-tokens to your project via your package manager (e.g. yarn)import { colors } from '@department-of-veterans-affairs/mobile-tokens to files you wish to use them in.buttonColor = colors.vadsColorGrayMediumThe tokens package also has light and dark themes available. These themes are a subset of the colors tokens above, containing primitive colors, semantic tokens without an OnLight or OnDark mode specified, and the colors for only the light or dark themes respectively. The OnLight and OnDark mode suffixes are also removed.
The purpose of themes is to allow for assignment of color tokens without the need to specify the light or dark mode, and let your theme provider or handler return the correct theme. For example: instead of having a conditional where you'd assign either the colors.vadsColorForegroundDefaultOnLight or colors.vadsColorForegroundDefaultOnDark token, you could instead use theme.vadsColorForegroundDefault if your app already knows which color scheme it wants to use.
@department-of-veterans-affairs/mobile-tokens to your project via your package manager (e.g. yarn)import { themes } from '@department-of-veterans-affairs/mobile-tokens to files you wish to use them in.themes.light or themes.darkWe have also made a hook available in the component library that will return the appropriate light or dark theme based on the user's OS setting. To use the hook:
@department-of-veterans-affairs/mobile-component-library to your project via your package manager (e.g. yarn)import { useTheme } from '@department-of-veterans-affairs/mobile-component-library' const theme = useTheme()
const componentStyle = {
color: theme.vadsColorForegroundDefault
}
Depending on what is being contributed, the recommendation for how to proceed differs.
If you are contributing a simple addition or update of an existing token, the recommendation is to do so in the GitHub web interface by updating the relevant src tokens file and running an alpha publish against the branch for the package to affirm the dist/ folder correctly forms up your updated/added token as expected in the resulting NPM package.
If you are contributing many tokens or need to adjust build processes, you should get set up locally. See the directions in the components package documentation for doing so with minor modifications to that process of changing directory to the tokens package (va-mobile-library/packages/tokens) instead of components and not having the final running steps as the tokens:build command is essentially running the tokens as it generates the output folders based on the build/config setup and tokens in the src/ folder.
Note: the folder structure and file naming within the src/ folder is relevant so follow the existing structure and direct questions to the DSVA Slack channel.
| Command | Description |
|---|---|
tokens:build | Takes any JSON files in the src/tokens folder and transforms them according to the defined transformations in the config.js |
FAQs
VA Design System Tokens Package
The npm package @department-of-veterans-affairs/va-design-system-tokens receives a total of 29 weekly downloads. As such, @department-of-veterans-affairs/va-design-system-tokens popularity was classified as not popular.
We found that @department-of-veterans-affairs/va-design-system-tokens demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 24 open source maintainers collaborating on the project.
Did you know?

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.

Security News
Experts push back on new claims about AI-driven ransomware, warning that hype and sponsored research are distorting how the threat is understood.

Security News
Ruby's creator Matz assumes control of RubyGems and Bundler repositories while former maintainers agree to step back and transfer all rights to end the dispute.