Folder | Description |
---|---|
build | Build scripts for generating files |
dist/fonts | Fonts for use in applications |
dist/icons | Icons for use in applications |
dist/styledictionary | JSON token source files |
docs | Files used by the documentation |
source/icons | Illustrator files for editing icons |
- Build the monorepo, see Getting Started
Base tokens are generated using the Style Dictionary build system, which transforms platform-agnostic token definition files into platform-specific output. These JSON definition files are the source of truth for the colors, fonts, and component design tokens in this repository. To modify the generated tokens, complete these steps:
- Edit the JSON files in
source/styledictionary/properties
. Long term these tokens will be sourced from a Figma design spec but for now it's OK to make manual edits. - Rebuild the generated token files by running the repository's build command,
npm run build
. - Test your changes locally and create a PR using the normal process.
To style a component with token values, you must first map base tokens to theme-aware tokens.
Use Font Awesome names for icons. If Font Awesome doesn't contain an equivalent icon, minimize the use of metaphors; choose descriptive and unambiguous names instead.
✅ Descriptive name | ❌ Metaphor |
---|---|
key |
access-control |
cog |
system-configuration |
arrow-left-from-line |
logout |
Add all appropriate metaphors and synonyms to the icon-metadata.ts
file, so clients can quickly find icons in Storybook. You can find ideas for synonyms in the Font Awesome metadata.
These steps require access to Adobe Illustrator and Perforce so will typically be completed by Brandon O'Keefe, Fred Visser, or another designer.
-
Get the latest copy of the icon source file from NI internal Perforce at
//NIComponents/VisualDesign/ProductionAssets/DiagramPaletteAssets_XML/Nimble/trunk/20.0/source/Nimble_Iconography.ai
. -
Export high-quality, optimized SVG files from the icon source file, by using the Export for Screens… workflow within Adobe Illustrator to export SVG files:
-
Choose File » Export » Export for Screens…
-
In the Export for Screen prompt, confirm that files will be exported to the
dist/icons/svg
folder, and that the remaining settings match the screenshot below. -
Confirm that the SVG settings match the screenshot below.
-
Choose to replace any existing files in the
dist/icons/svg
folder.
-
-
Proceed to the steps below or create a user story requesting that the Nimble team perform them. If filing an issue, attach the new and modified SVG files to the issue.
-
Search for all
<defs>.*</defs>
tags in the exported.svg
files and remove them. This removes all color from the.svg
files and allows us to dynamically change the fill color.- Note: In rare cases, icons will be provided with multiple fixed colors that are not intended to change with the theme or
severity
. These icons should retain the<defs>
tags.
- Note: In rare cases, icons will be provided with multiple fixed colors that are not intended to change with the theme or
-
Confirm the new icon files will build correctly by running:
npm run build -w @ni/nimble-tokens
. -
Generate and build icon components by running
npm run build -w @ni/nimble-components
. This step will report an error at this point but is necessary to enable the next step. -
Add metadata for the new icons to
nimble-components/src/icon-base/tests/icon-metadata.ts
. -
Run
npm run build -w @ni/nimble-components
again. It should now succeed. -
Preview the built files by running:
npm run storybook
, and review the Icons story to confirm that your changes appear correctly. Inspect the icons in each Severity and ensure their color changes. -
Publish a PR with your changes. If there are any new icons, set
changeType
anddependentChangeType
to minor in the beachball change file.