Skip to main content
Version: Previous

Design System Tokens - Miscellaneous

You can adjust any of the defaults in the src/_config/values folder of your design system. This covers a number of tokens and options.

  • prefix: Web Component name prefix
  • direction: the primary document direction (LTR or RTL)
  • disabledOpacity: the opacity of disabled controls
  • strokeWidth: controls the width of the stroke of a component that has a stroke
  • focusStrokeWidth: controls with width of the stroke of a component that has a stroke when it has document focus

prefix

export const prefix = 'alpha';

Custom Web components (as opposed to standard HTML components like <h1> or <div>) require a hyphen character (-) included in the name e.g. <alpha-button>. The part of the name before the hyphen is called the prefix and can be customised e.g.:

export const prefix = 'custom';

You will then be able to use your component in HTML as <custom-button>.

direction

The primary document direction (LTR or RTL). Many CSS layout properties like flexbox and CSS grid automatically handle reflow depending on the document's primary direction. There are also CSS logical properties that can be used as well to apply localized margins, paddings, borders and positioning. Unfortunately, browser support for these properties is limited and there are still styling cases not covered by these properties (directional glyphs, transforms, etc). That is why teh Genesis web framework provides several mechanisms to apply direction-based styles.

Usage

direction: var(--direction);

disabledOpacity

This controls the opacity of disabled controls.

Usage

opacity: --disabled-opacity;

strokeWidth

Controls the width of the stroke of a component that has a stroke.

Usage

border: calc(var(--stroke-width)} * 1px) solid #000;

focusStrokeWidth

This controls the width of the stroke of a component that has a stroke when it has document focus.

Usage

box-shadow: 0 0 0 calc(var(--focus-stroke-width) * 1px) #333;