JSPM

@primer/primitives

0.0.0-20250805084643
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 66986
  • Score
    100M100P100Q165439F
  • License MIT

Typography, spacing, and color primitives for Primer design system

Package Exports

  • @primer/primitives/base/motion.css
  • @primer/primitives/base/size.css
  • @primer/primitives/base/typography.css
  • @primer/primitives/dist/build/filters/index.d.ts
  • @primer/primitives/dist/build/filters/index.js
  • @primer/primitives/dist/build/filters/isBorder.d.ts
  • @primer/primitives/dist/build/filters/isBorder.js
  • @primer/primitives/dist/build/filters/isColor.d.ts
  • @primer/primitives/dist/build/filters/isColor.js
  • @primer/primitives/dist/build/filters/isColorWithAlpha.d.ts
  • @primer/primitives/dist/build/filters/isColorWithAlpha.js
  • @primer/primitives/dist/build/filters/isCubicBezier.d.ts
  • @primer/primitives/dist/build/filters/isCubicBezier.js
  • @primer/primitives/dist/build/filters/isDeprecated.d.ts
  • @primer/primitives/dist/build/filters/isDeprecated.js
  • @primer/primitives/dist/build/filters/isDimension.d.ts
  • @primer/primitives/dist/build/filters/isDimension.js
  • @primer/primitives/dist/build/filters/isDuration.d.ts
  • @primer/primitives/dist/build/filters/isDuration.js
  • @primer/primitives/dist/build/filters/isFontFamily.d.ts
  • @primer/primitives/dist/build/filters/isFontFamily.js
  • @primer/primitives/dist/build/filters/isFontWeight.d.ts
  • @primer/primitives/dist/build/filters/isFontWeight.js
  • @primer/primitives/dist/build/filters/isFromFile.d.ts
  • @primer/primitives/dist/build/filters/isFromFile.js
  • @primer/primitives/dist/build/filters/isGradient.d.ts
  • @primer/primitives/dist/build/filters/isGradient.js
  • @primer/primitives/dist/build/filters/isNumber.d.ts
  • @primer/primitives/dist/build/filters/isNumber.js
  • @primer/primitives/dist/build/filters/isShadow.d.ts
  • @primer/primitives/dist/build/filters/isShadow.js
  • @primer/primitives/dist/build/filters/isSource.d.ts
  • @primer/primitives/dist/build/filters/isSource.js
  • @primer/primitives/dist/build/filters/isTransition.d.ts
  • @primer/primitives/dist/build/filters/isTransition.js
  • @primer/primitives/dist/build/filters/isTypography.d.ts
  • @primer/primitives/dist/build/filters/isTypography.js
  • @primer/primitives/dist/build/formats/cssAdvanced.d.ts
  • @primer/primitives/dist/build/formats/cssAdvanced.js
  • @primer/primitives/dist/build/formats/cssCustomMedia.d.ts
  • @primer/primitives/dist/build/formats/cssCustomMedia.js
  • @primer/primitives/dist/build/formats/index.d.ts
  • @primer/primitives/dist/build/formats/index.js
  • @primer/primitives/dist/build/formats/javascriptCommonJs.d.ts
  • @primer/primitives/dist/build/formats/javascriptCommonJs.js
  • @primer/primitives/dist/build/formats/javascriptEsm.d.ts
  • @primer/primitives/dist/build/formats/javascriptEsm.js
  • @primer/primitives/dist/build/formats/jsonFigma.d.ts
  • @primer/primitives/dist/build/formats/jsonFigma.js
  • @primer/primitives/dist/build/formats/jsonNestedPrefixed.d.ts
  • @primer/primitives/dist/build/formats/jsonNestedPrefixed.js
  • @primer/primitives/dist/build/formats/jsonOneDimensional.d.ts
  • @primer/primitives/dist/build/formats/jsonOneDimensional.js
  • @primer/primitives/dist/build/formats/jsonPostCssFallback.d.ts
  • @primer/primitives/dist/build/formats/jsonPostCssFallback.js
  • @primer/primitives/dist/build/formats/typescriptExportDefinition.d.ts
  • @primer/primitives/dist/build/formats/typescriptExportDefinition.js
  • @primer/primitives/dist/build/formats/utilities/getPropName.d.ts
  • @primer/primitives/dist/build/formats/utilities/getPropName.js
  • @primer/primitives/dist/build/formats/utilities/jsonToFlat.d.ts
  • @primer/primitives/dist/build/formats/utilities/jsonToFlat.js
  • @primer/primitives/dist/build/formats/utilities/jsonToNestedValue.d.ts
  • @primer/primitives/dist/build/formats/utilities/jsonToNestedValue.js
  • @primer/primitives/dist/build/formats/utilities/prefixTokens.d.ts
  • @primer/primitives/dist/build/formats/utilities/prefixTokens.js
  • @primer/primitives/dist/build/parsers/index.d.ts
  • @primer/primitives/dist/build/parsers/index.js
  • @primer/primitives/dist/build/parsers/w3cJsonParser.d.ts
  • @primer/primitives/dist/build/parsers/w3cJsonParser.js
  • @primer/primitives/dist/build/platforms/css.d.ts
  • @primer/primitives/dist/build/platforms/css.js
  • @primer/primitives/dist/build/platforms/deprecatedJson.d.ts
  • @primer/primitives/dist/build/platforms/deprecatedJson.js
  • @primer/primitives/dist/build/platforms/docJson.d.ts
  • @primer/primitives/dist/build/platforms/docJson.js
  • @primer/primitives/dist/build/platforms/fallbacks.d.ts
  • @primer/primitives/dist/build/platforms/fallbacks.js
  • @primer/primitives/dist/build/platforms/figma.d.ts
  • @primer/primitives/dist/build/platforms/figma.js
  • @primer/primitives/dist/build/platforms/index.d.ts
  • @primer/primitives/dist/build/platforms/index.js
  • @primer/primitives/dist/build/platforms/javascript.d.ts
  • @primer/primitives/dist/build/platforms/javascript.js
  • @primer/primitives/dist/build/platforms/json.d.ts
  • @primer/primitives/dist/build/platforms/json.js
  • @primer/primitives/dist/build/platforms/styleLint.d.ts
  • @primer/primitives/dist/build/platforms/styleLint.js
  • @primer/primitives/dist/build/platforms/typeDefinitions.d.ts
  • @primer/primitives/dist/build/platforms/typeDefinitions.js
  • @primer/primitives/dist/build/platforms/typescript.d.ts
  • @primer/primitives/dist/build/platforms/typescript.js
  • @primer/primitives/dist/build/preprocessors/themeOverrides.d.ts
  • @primer/primitives/dist/build/preprocessors/themeOverrides.js
  • @primer/primitives/dist/build/preprocessors/utilities/transformTokens.d.ts
  • @primer/primitives/dist/build/preprocessors/utilities/transformTokens.js
  • @primer/primitives/dist/build/primerStyleDictionary.d.ts
  • @primer/primitives/dist/build/primerStyleDictionary.js
  • @primer/primitives/dist/build/schemas/alphaValue.d.ts
  • @primer/primitives/dist/build/schemas/alphaValue.js
  • @primer/primitives/dist/build/schemas/baseToken.d.ts
  • @primer/primitives/dist/build/schemas/baseToken.js
  • @primer/primitives/dist/build/schemas/borderToken.d.ts
  • @primer/primitives/dist/build/schemas/borderToken.js
  • @primer/primitives/dist/build/schemas/collections.d.ts
  • @primer/primitives/dist/build/schemas/collections.js
  • @primer/primitives/dist/build/schemas/colorHexValue.d.ts
  • @primer/primitives/dist/build/schemas/colorHexValue.js
  • @primer/primitives/dist/build/schemas/colorToken.d.ts
  • @primer/primitives/dist/build/schemas/colorToken.js
  • @primer/primitives/dist/build/schemas/cubicBezierToken.d.ts
  • @primer/primitives/dist/build/schemas/cubicBezierToken.js
  • @primer/primitives/dist/build/schemas/designToken.d.ts
  • @primer/primitives/dist/build/schemas/designToken.js
  • @primer/primitives/dist/build/schemas/dimensionToken.d.ts
  • @primer/primitives/dist/build/schemas/dimensionToken.js
  • @primer/primitives/dist/build/schemas/dimensionValue.d.ts
  • @primer/primitives/dist/build/schemas/dimensionValue.js
  • @primer/primitives/dist/build/schemas/durationToken.d.ts
  • @primer/primitives/dist/build/schemas/durationToken.js
  • @primer/primitives/dist/build/schemas/durationValue.d.ts
  • @primer/primitives/dist/build/schemas/durationValue.js
  • @primer/primitives/dist/build/schemas/fontFamilyToken.d.ts
  • @primer/primitives/dist/build/schemas/fontFamilyToken.js
  • @primer/primitives/dist/build/schemas/fontWeightToken.d.ts
  • @primer/primitives/dist/build/schemas/fontWeightToken.js
  • @primer/primitives/dist/build/schemas/fontWeightValue.d.ts
  • @primer/primitives/dist/build/schemas/fontWeightValue.js
  • @primer/primitives/dist/build/schemas/gradientToken.d.ts
  • @primer/primitives/dist/build/schemas/gradientToken.js
  • @primer/primitives/dist/build/schemas/numberToken.d.ts
  • @primer/primitives/dist/build/schemas/numberToken.js
  • @primer/primitives/dist/build/schemas/referenceValue.d.ts
  • @primer/primitives/dist/build/schemas/referenceValue.js
  • @primer/primitives/dist/build/schemas/scopes.d.ts
  • @primer/primitives/dist/build/schemas/scopes.js
  • @primer/primitives/dist/build/schemas/shadowToken.d.ts
  • @primer/primitives/dist/build/schemas/shadowToken.js
  • @primer/primitives/dist/build/schemas/stringToken.d.ts
  • @primer/primitives/dist/build/schemas/stringToken.js
  • @primer/primitives/dist/build/schemas/tokenName.d.ts
  • @primer/primitives/dist/build/schemas/tokenName.js
  • @primer/primitives/dist/build/schemas/tokenType.d.ts
  • @primer/primitives/dist/build/schemas/tokenType.js
  • @primer/primitives/dist/build/schemas/transitionToken.d.ts
  • @primer/primitives/dist/build/schemas/transitionToken.js
  • @primer/primitives/dist/build/schemas/typographyToken.d.ts
  • @primer/primitives/dist/build/schemas/typographyToken.js
  • @primer/primitives/dist/build/schemas/validTokenType.d.ts
  • @primer/primitives/dist/build/schemas/validTokenType.js
  • @primer/primitives/dist/build/schemas/viewportRangeToken.d.ts
  • @primer/primitives/dist/build/schemas/viewportRangeToken.js
  • @primer/primitives/dist/build/transformers/borderToCss.d.ts
  • @primer/primitives/dist/build/transformers/borderToCss.js
  • @primer/primitives/dist/build/transformers/colorAlphaToCss.d.ts
  • @primer/primitives/dist/build/transformers/colorAlphaToCss.js
  • @primer/primitives/dist/build/transformers/colorToHex.d.ts
  • @primer/primitives/dist/build/transformers/colorToHex.js
  • @primer/primitives/dist/build/transformers/colorToRgbAlpha.d.ts
  • @primer/primitives/dist/build/transformers/colorToRgbAlpha.js
  • @primer/primitives/dist/build/transformers/colorToRgbaFloat.d.ts
  • @primer/primitives/dist/build/transformers/colorToRgbaFloat.js
  • @primer/primitives/dist/build/transformers/cubicBezierToCss.d.ts
  • @primer/primitives/dist/build/transformers/cubicBezierToCss.js
  • @primer/primitives/dist/build/transformers/dimensionToPixelUnitless.d.ts
  • @primer/primitives/dist/build/transformers/dimensionToPixelUnitless.js
  • @primer/primitives/dist/build/transformers/dimensionToRem.d.ts
  • @primer/primitives/dist/build/transformers/dimensionToRem.js
  • @primer/primitives/dist/build/transformers/dimensionToRemPxArray.d.ts
  • @primer/primitives/dist/build/transformers/dimensionToRemPxArray.js
  • @primer/primitives/dist/build/transformers/durationToCss.d.ts
  • @primer/primitives/dist/build/transformers/durationToCss.js
  • @primer/primitives/dist/build/transformers/figmaAttributes.d.ts
  • @primer/primitives/dist/build/transformers/figmaAttributes.js
  • @primer/primitives/dist/build/transformers/floatToPixel.d.ts
  • @primer/primitives/dist/build/transformers/floatToPixel.js
  • @primer/primitives/dist/build/transformers/fontFamilyToCss.d.ts
  • @primer/primitives/dist/build/transformers/fontFamilyToCss.js
  • @primer/primitives/dist/build/transformers/fontFamilyToFigma.d.ts
  • @primer/primitives/dist/build/transformers/fontFamilyToFigma.js
  • @primer/primitives/dist/build/transformers/fontWeightToNumber.d.ts
  • @primer/primitives/dist/build/transformers/fontWeightToNumber.js
  • @primer/primitives/dist/build/transformers/gradientToCss.d.ts
  • @primer/primitives/dist/build/transformers/gradientToCss.js
  • @primer/primitives/dist/build/transformers/index.d.ts
  • @primer/primitives/dist/build/transformers/index.js
  • @primer/primitives/dist/build/transformers/jsonDeprecated.d.ts
  • @primer/primitives/dist/build/transformers/jsonDeprecated.js
  • @primer/primitives/dist/build/transformers/namePathToCamelCase.d.ts
  • @primer/primitives/dist/build/transformers/namePathToCamelCase.js
  • @primer/primitives/dist/build/transformers/namePathToDotNotation.d.ts
  • @primer/primitives/dist/build/transformers/namePathToDotNotation.js
  • @primer/primitives/dist/build/transformers/namePathToFigma.d.ts
  • @primer/primitives/dist/build/transformers/namePathToFigma.js
  • @primer/primitives/dist/build/transformers/namePathToKebabCase.d.ts
  • @primer/primitives/dist/build/transformers/namePathToKebabCase.js
  • @primer/primitives/dist/build/transformers/namePathToPascalCase.d.ts
  • @primer/primitives/dist/build/transformers/namePathToPascalCase.js
  • @primer/primitives/dist/build/transformers/namePathToSlashNotation.d.ts
  • @primer/primitives/dist/build/transformers/namePathToSlashNotation.js
  • @primer/primitives/dist/build/transformers/shadowToCss.d.ts
  • @primer/primitives/dist/build/transformers/shadowToCss.js
  • @primer/primitives/dist/build/transformers/transitionToCss.d.ts
  • @primer/primitives/dist/build/transformers/transitionToCss.js
  • @primer/primitives/dist/build/transformers/typographyToCss.d.ts
  • @primer/primitives/dist/build/transformers/typographyToCss.js
  • @primer/primitives/dist/build/transformers/utilities/alpha.d.ts
  • @primer/primitives/dist/build/transformers/utilities/alpha.js
  • @primer/primitives/dist/build/transformers/utilities/checkRequiredTokenProperties.d.ts
  • @primer/primitives/dist/build/transformers/utilities/checkRequiredTokenProperties.js
  • @primer/primitives/dist/build/transformers/utilities/getTokenValue.d.ts
  • @primer/primitives/dist/build/transformers/utilities/getTokenValue.js
  • @primer/primitives/dist/build/transformers/utilities/hasSpaceInString.d.ts
  • @primer/primitives/dist/build/transformers/utilities/hasSpaceInString.js
  • @primer/primitives/dist/build/transformers/utilities/hexToRgbaFloat.d.ts
  • @primer/primitives/dist/build/transformers/utilities/hexToRgbaFloat.js
  • @primer/primitives/dist/build/transformers/utilities/invalidTokenError.d.ts
  • @primer/primitives/dist/build/transformers/utilities/invalidTokenError.js
  • @primer/primitives/dist/build/transformers/utilities/isRgbaFloat.d.ts
  • @primer/primitives/dist/build/transformers/utilities/isRgbaFloat.js
  • @primer/primitives/dist/build/transformers/utilities/rgbaFloatToHex.d.ts
  • @primer/primitives/dist/build/transformers/utilities/rgbaFloatToHex.js
  • @primer/primitives/dist/build/types/border.d.ts
  • @primer/primitives/dist/build/types/borderTokenValue.d.ts
  • @primer/primitives/dist/build/types/colorHex.d.ts
  • @primer/primitives/dist/build/types/platformInitializer.d.ts
  • @primer/primitives/dist/build/types/shadow.d.ts
  • @primer/primitives/dist/build/types/shadowTokenValue.d.ts
  • @primer/primitives/dist/build/types/sizeEm.d.ts
  • @primer/primitives/dist/build/types/sizePx.d.ts
  • @primer/primitives/dist/build/types/sizeRem.d.ts
  • @primer/primitives/dist/build/types/styleDictionaryConfigGenerator.d.ts
  • @primer/primitives/dist/build/types/tokenBuildInput.d.ts
  • @primer/primitives/dist/build/types/typographyTokenValue.d.ts
  • @primer/primitives/dist/build/types/w3cTransformedToken.d.ts
  • @primer/primitives/dist/build/utilities/asArray.d.ts
  • @primer/primitives/dist/build/utilities/asArray.js
  • @primer/primitives/dist/build/utilities/copyFromDir.d.ts
  • @primer/primitives/dist/build/utilities/copyFromDir.js
  • @primer/primitives/dist/build/utilities/filterStringArray.d.ts
  • @primer/primitives/dist/build/utilities/filterStringArray.js
  • @primer/primitives/dist/build/utilities/getFlag.d.ts
  • @primer/primitives/dist/build/utilities/getFlag.js
  • @primer/primitives/dist/build/utilities/index.d.ts
  • @primer/primitives/dist/build/utilities/index.js
  • @primer/primitives/dist/build/utilities/joinFriendly.d.ts
  • @primer/primitives/dist/build/utilities/joinFriendly.js
  • @primer/primitives/dist/build/utilities/log.d.ts
  • @primer/primitives/dist/build/utilities/log.js
  • @primer/primitives/dist/build/utilities/lowerCaseFirstCharacter.d.ts
  • @primer/primitives/dist/build/utilities/lowerCaseFirstCharacter.js
  • @primer/primitives/dist/build/utilities/schemaErrorMessage.d.ts
  • @primer/primitives/dist/build/utilities/schemaErrorMessage.js
  • @primer/primitives/dist/build/utilities/toCamelCase.d.ts
  • @primer/primitives/dist/build/utilities/toCamelCase.js
  • @primer/primitives/dist/build/utilities/toPascalCase.d.ts
  • @primer/primitives/dist/build/utilities/toPascalCase.js
  • @primer/primitives/dist/build/utilities/treeWalker.d.ts
  • @primer/primitives/dist/build/utilities/treeWalker.js
  • @primer/primitives/dist/build/utilities/upperCaseFirstCharacter.d.ts
  • @primer/primitives/dist/build/utilities/upperCaseFirstCharacter.js
  • @primer/primitives/dist/css/base/motion/motion.css
  • @primer/primitives/dist/css/base/size/size.css
  • @primer/primitives/dist/css/base/typography/typography.css
  • @primer/primitives/dist/css/functional/size/border.css
  • @primer/primitives/dist/css/functional/size/breakpoints.css
  • @primer/primitives/dist/css/functional/size/size-coarse.css
  • @primer/primitives/dist/css/functional/size/size-fine.css
  • @primer/primitives/dist/css/functional/size/size.css
  • @primer/primitives/dist/css/functional/size/viewport.css
  • @primer/primitives/dist/css/functional/themes/dark-colorblind-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/dark-colorblind.css
  • @primer/primitives/dist/css/functional/themes/dark-dimmed-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/dark-dimmed.css
  • @primer/primitives/dist/css/functional/themes/dark-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/dark-tritanopia-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/dark-tritanopia.css
  • @primer/primitives/dist/css/functional/themes/dark.css
  • @primer/primitives/dist/css/functional/themes/light-colorblind-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/light-colorblind.css
  • @primer/primitives/dist/css/functional/themes/light-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/light-tritanopia-high-contrast.css
  • @primer/primitives/dist/css/functional/themes/light-tritanopia.css
  • @primer/primitives/dist/css/functional/themes/light.css
  • @primer/primitives/dist/css/functional/typography/typography.css
  • @primer/primitives/dist/css/primitives.css
  • @primer/primitives/dist/docs/base/motion/motion.json
  • @primer/primitives/dist/docs/base/size/size.json
  • @primer/primitives/dist/docs/base/typography/typography.json
  • @primer/primitives/dist/docs/functional/size/border.json
  • @primer/primitives/dist/docs/functional/size/breakpoints.json
  • @primer/primitives/dist/docs/functional/size/size-coarse.json
  • @primer/primitives/dist/docs/functional/size/size-fine.json
  • @primer/primitives/dist/docs/functional/size/size.json
  • @primer/primitives/dist/docs/functional/size/viewport.json
  • @primer/primitives/dist/docs/functional/themes/dark-colorblind-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/dark-colorblind.json
  • @primer/primitives/dist/docs/functional/themes/dark-dimmed-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/dark-dimmed.json
  • @primer/primitives/dist/docs/functional/themes/dark-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/dark-tritanopia-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/dark-tritanopia.json
  • @primer/primitives/dist/docs/functional/themes/dark.json
  • @primer/primitives/dist/docs/functional/themes/light-colorblind-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/light-colorblind.json
  • @primer/primitives/dist/docs/functional/themes/light-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/light-tritanopia-high-contrast.json
  • @primer/primitives/dist/docs/functional/themes/light-tritanopia.json
  • @primer/primitives/dist/docs/functional/themes/light.json
  • @primer/primitives/dist/docs/functional/typography/typography.json
  • @primer/primitives/dist/fallbacks/base/motion/motion.json
  • @primer/primitives/dist/fallbacks/base/size/size.json
  • @primer/primitives/dist/fallbacks/base/typography/typography.json
  • @primer/primitives/dist/fallbacks/color-fallbacks.json
  • @primer/primitives/dist/fallbacks/functional/size/border.json
  • @primer/primitives/dist/fallbacks/functional/size/breakpoints.json
  • @primer/primitives/dist/fallbacks/functional/size/size-coarse.json
  • @primer/primitives/dist/fallbacks/functional/size/size-fine.json
  • @primer/primitives/dist/fallbacks/functional/size/size.json
  • @primer/primitives/dist/fallbacks/functional/size/viewport.json
  • @primer/primitives/dist/fallbacks/functional/typography/typography.json
  • @primer/primitives/dist/figma/dimension/dimension.json
  • @primer/primitives/dist/figma/figma.json
  • @primer/primitives/dist/figma/scales/dark-dimmed.json
  • @primer/primitives/dist/figma/scales/dark-high-constrast.json
  • @primer/primitives/dist/figma/scales/dark.json
  • @primer/primitives/dist/figma/scales/light-high-constrast.json
  • @primer/primitives/dist/figma/scales/light.json
  • @primer/primitives/dist/figma/themes/dark-colorblind-high-contrast.json
  • @primer/primitives/dist/figma/themes/dark-colorblind.json
  • @primer/primitives/dist/figma/themes/dark-dimmed-high-contrast.json
  • @primer/primitives/dist/figma/themes/dark-dimmed.json
  • @primer/primitives/dist/figma/themes/dark-high-contrast.json
  • @primer/primitives/dist/figma/themes/dark-tritanopia-high-contrast.json
  • @primer/primitives/dist/figma/themes/dark-tritanopia.json
  • @primer/primitives/dist/figma/themes/dark.json
  • @primer/primitives/dist/figma/themes/light-colorblind-high-contrast.json
  • @primer/primitives/dist/figma/themes/light-colorblind.json
  • @primer/primitives/dist/figma/themes/light-high-contrast.json
  • @primer/primitives/dist/figma/themes/light-tritanopia-high-contrast.json
  • @primer/primitives/dist/figma/themes/light-tritanopia.json
  • @primer/primitives/dist/figma/themes/light.json
  • @primer/primitives/dist/figma/typography/typography.json
  • @primer/primitives/dist/internalCss/dark-colorblind-high-contrast.css
  • @primer/primitives/dist/internalCss/dark-colorblind.css
  • @primer/primitives/dist/internalCss/dark-dimmed-high-contrast.css
  • @primer/primitives/dist/internalCss/dark-dimmed.css
  • @primer/primitives/dist/internalCss/dark-high-contrast.css
  • @primer/primitives/dist/internalCss/dark-tritanopia-high-contrast.css
  • @primer/primitives/dist/internalCss/dark-tritanopia.css
  • @primer/primitives/dist/internalCss/dark.css
  • @primer/primitives/dist/internalCss/light-colorblind-high-contrast.css
  • @primer/primitives/dist/internalCss/light-colorblind.css
  • @primer/primitives/dist/internalCss/light-high-contrast.css
  • @primer/primitives/dist/internalCss/light-tritanopia-high-contrast.css
  • @primer/primitives/dist/internalCss/light-tritanopia.css
  • @primer/primitives/dist/internalCss/light.css
  • @primer/primitives/dist/removed/color.json
  • @primer/primitives/dist/removed/testing.json5
  • @primer/primitives/dist/styleLint/base/motion/motion.json
  • @primer/primitives/dist/styleLint/base/size/size.json
  • @primer/primitives/dist/styleLint/base/typography/typography.json
  • @primer/primitives/dist/styleLint/functional/size/border.json
  • @primer/primitives/dist/styleLint/functional/size/breakpoints.json
  • @primer/primitives/dist/styleLint/functional/size/size-coarse.json
  • @primer/primitives/dist/styleLint/functional/size/size-fine.json
  • @primer/primitives/dist/styleLint/functional/size/size.json
  • @primer/primitives/dist/styleLint/functional/size/viewport.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-colorblind-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-colorblind.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-dimmed-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-dimmed.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-tritanopia-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/dark-tritanopia.json
  • @primer/primitives/dist/styleLint/functional/themes/dark.json
  • @primer/primitives/dist/styleLint/functional/themes/light-colorblind-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/light-colorblind.json
  • @primer/primitives/dist/styleLint/functional/themes/light-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/light-tritanopia-high-contrast.json
  • @primer/primitives/dist/styleLint/functional/themes/light-tritanopia.json
  • @primer/primitives/dist/styleLint/functional/themes/light.json
  • @primer/primitives/dist/styleLint/functional/typography/typography.json
  • @primer/primitives/functional/border.css
  • @primer/primitives/functional/breakpoints.css
  • @primer/primitives/functional/size-coarse.css
  • @primer/primitives/functional/size-fine.css
  • @primer/primitives/functional/size.css
  • @primer/primitives/functional/typography.css
  • @primer/primitives/primitives.css
  • @primer/primitives/src/tokens/base/color/dark/dark.dimmed.json5
  • @primer/primitives/src/tokens/base/color/dark/dark.high-contrast.json5
  • @primer/primitives/src/tokens/base/color/dark/dark.json5
  • @primer/primitives/src/tokens/base/color/dark/display-dark.json5
  • @primer/primitives/src/tokens/base/color/light/display-light.json5
  • @primer/primitives/src/tokens/base/color/light/light.high-contrast.json5
  • @primer/primitives/src/tokens/base/color/light/light.json5
  • @primer/primitives/src/tokens/base/motion/easing.json5
  • @primer/primitives/src/tokens/base/motion/timing.json5
  • @primer/primitives/src/tokens/base/size/size.json5
  • @primer/primitives/src/tokens/base/typography/typography.json5
  • @primer/primitives/src/tokens/component/avatar.json5
  • @primer/primitives/src/tokens/component/avatarStack.json5
  • @primer/primitives/src/tokens/component/button.json5
  • @primer/primitives/src/tokens/component/card.json5
  • @primer/primitives/src/tokens/component/codeMirror.json5
  • @primer/primitives/src/tokens/component/contribution.json5
  • @primer/primitives/src/tokens/component/counter.json5
  • @primer/primitives/src/tokens/component/diffBlob.json5
  • @primer/primitives/src/tokens/component/header.json5
  • @primer/primitives/src/tokens/component/headerSerach.json5
  • @primer/primitives/src/tokens/component/highlight.json5
  • @primer/primitives/src/tokens/component/label.json5
  • @primer/primitives/src/tokens/component/menu.json5
  • @primer/primitives/src/tokens/component/overlay.json5
  • @primer/primitives/src/tokens/component/page.json5
  • @primer/primitives/src/tokens/component/progressBar.json5
  • @primer/primitives/src/tokens/component/reactionButton.json5
  • @primer/primitives/src/tokens/component/selectMenu.json5
  • @primer/primitives/src/tokens/component/sideNav.json5
  • @primer/primitives/src/tokens/component/skeletonLoader.json5
  • @primer/primitives/src/tokens/component/timelineBadge.json5
  • @primer/primitives/src/tokens/component/tooltip.json5
  • @primer/primitives/src/tokens/component/topicTag.json5
  • @primer/primitives/src/tokens/component/treeView.json5
  • @primer/primitives/src/tokens/component/underlineNav.json5
  • @primer/primitives/src/tokens/fallback/color-fallbacks.json
  • @primer/primitives/src/tokens/functional/border/border.json5
  • @primer/primitives/src/tokens/functional/color/bgColor.json5
  • @primer/primitives/src/tokens/functional/color/borderColor.json5
  • @primer/primitives/src/tokens/functional/color/control.json5
  • @primer/primitives/src/tokens/functional/color/data-vis.json5
  • @primer/primitives/src/tokens/functional/color/display.json5
  • @primer/primitives/src/tokens/functional/color/fgColor.json5
  • @primer/primitives/src/tokens/functional/color/focus.json5
  • @primer/primitives/src/tokens/functional/color/selection.json5
  • @primer/primitives/src/tokens/functional/color/syntax.json5
  • @primer/primitives/src/tokens/functional/shadow/shadow.json5
  • @primer/primitives/src/tokens/functional/size/border.json5
  • @primer/primitives/src/tokens/functional/size/breakpoints.json5
  • @primer/primitives/src/tokens/functional/size/size-coarse.json5
  • @primer/primitives/src/tokens/functional/size/size-fine.json5
  • @primer/primitives/src/tokens/functional/size/size.json5
  • @primer/primitives/src/tokens/functional/size/viewport.json5
  • @primer/primitives/src/tokens/functional/typography/typography.json5
  • @primer/primitives/src/tokens/removed/color.json
  • @primer/primitives/src/tokens/removed/testing.json5
  • @primer/primitives/themes/dark-colorblind-high-contrast.css
  • @primer/primitives/themes/dark-colorblind.css
  • @primer/primitives/themes/dark-dimmed-high-contrast.css
  • @primer/primitives/themes/dark-dimmed.css
  • @primer/primitives/themes/dark-high-contrast.css
  • @primer/primitives/themes/dark-tritanopia-high-contrast.css
  • @primer/primitives/themes/dark-tritanopia.css
  • @primer/primitives/themes/dark.css
  • @primer/primitives/themes/light-colorblind-high-contrast.css
  • @primer/primitives/themes/light-colorblind.css
  • @primer/primitives/themes/light-high-contrast.css
  • @primer/primitives/themes/light-tritanopia-high-contrast.css
  • @primer/primitives/themes/light-tritanopia.css
  • @primer/primitives/themes/light.css

Readme

Primer Primitives

npm package Storybook A11y contrast check

This repo contains values for color, spacing, and typography primitives for use with Primer, GitHub's design system.

primer primitives diagram showing how the package connects with other primer libraries primer primitives diagram showing how the package connects with other primer libraries

Install

This repository is distributed on npm. After installing npm, you can install @primer/primitives with this command.

npm install --save @primer/primitives

Usage

Storybook | Docs

See Primitives documentation for more information on theming and using CSS variables.

Data is served from the dist/ folder:

  • dist/css contains CSS files with values available as CSS variables

All available imports:

/* size, motion & typography in one file */
@import '@primer/primitives/primitives.css';

/* motion */
@import '@primer/primitives/base/motion.css';

/* size/typography */
@import '@primer/primitives/base/typography.css';
@import '@primer/primitives/base/size.css';
@import '@primer/primitives/functional/border.css';
@import '@primer/primitives/functional/breakpoints.css';
@import '@primer/primitives/functional/size.css';
@import '@primer/primitives/functional/viewport.css';
@import '@primer/primitives/functional/typography.css';

/* color */
@import '@primer/primitives/themes/light.css';
@import '@primer/primitives/themes/light-tritanopia.css';
@import '@primer/primitives/themes/light-high-contrast.css';
@import '@primer/primitives/themes/light-colorblind.css';
@import '@primer/primitives/themes/dark.css';
@import '@primer/primitives/themes/dark-colorblind.css';
@import '@primer/primitives/themes/dark-dimmed.css';
@import '@primer/primitives/themes/dark-high-contrast.css';
@import '@primer/primitives/themes/dark-tritanopia.css';

Design token data

Design token data is stored in the src/tokens directory. These tokens are compiled with style dictionary in scripts/buildTokens.ts.

To make working with tokens easier, we added some additional functionality on top of what style dictionary comes with:

Extending and Overwriting

We have two main color modes: light and dark. Additionally we have specific accessibility modes based on those, such as light high contrast.

We added a way to create a mode by only including the changes from the main mode. We call this overrides. Overrides are created in src/tokens/functional/color/[light|dark]/overrides/ and have to be added to themes.config.ts to work. In the individual files, e.g. light.high-contrast.json5 you can now add tokens in the same structure as in any main file, e.g. primitives-light.json5 to replace them.

Transforming Colors with Alpha and Mix

Alpha

You can create color tokens that inherit a color but have a different alpha value by adding the alpha property. Note: The original alpha value will be replaced by your value. If you add alpha: 0.4 to a color, it doesn't matter if the color you reference has no alpha or alpha: 0.7, the new token will always have newly the defined value of alpha: 0.4.

{
  muted: {
    $value: '{base.color.blue.3}',
    alpha: 0.4, // the opacity value of the color === 40% opaque
    $type: 'color',
  },
}

Extensions property

According to the w3c design token specs, the $extensions property is used for additional meta data.

For our Figma export we use the following meta data:

  • collection the collection that the token is added to within Figma
  • mode the mode that the token is added to within the collection in Figma
  • scopes the scopes that are assigned to the token in Figma, the actual Figma compatible scopes are retrieved from an object in the figmaAttributes transformer

Code example

  bgColor: {
    $value: '{borderColor.accent.muted}',
    $type: 'color',
    $extensions: {
      'org.primer.figma': {
        collection: 'pattern/mode',
        mode: 'light',
        scopes: ['bgColor'],
      },
    },
  }

Token names and @-hack

Token names have to be in camelCase or kebab-case and may only include letters, numbers and -. This is enforced by the token validation (npm run lint:tokens). The only exception is the @-hack. This is used when you want to have a default value and sub-values, e.g. bgColor.accent and bgColor.accent.muted. In this case you can create the following structure. The @ will be removed from the name and act as the default value.

{
  bgColor: {
    accent: {
      '@': {
        // values for bgColor-accent (default)
      },
      muted: {
        // values for bgColor-accent-muted
      },
    },
  },
}

License

MIT © GitHub