@wwnds/core v1.9.1
@wwnds/core
A Sass implementation of the design system's foundations and styling for all components.
Usage
All usage guidance is provided in the developer guide.
Developing
The core library makes considerable use of Sass modules to structure its stylesheets and enable theming through the @forward...with syntax.
Conventions
We follow a handful of conventions to make our stylesheets more manageable and readable. All contributors should strive to follow these conventions.
- Declarations must be wrapped in a mixin.
This ensures that declarations never leak on
@forwardor@use. - Design token defaults should be expressed as abstract Sass variables. These aren't compiled and won't result in any CSS output.
- For example:
$duration-simple: 100ms;
- For example:
- Sass variable tokens should be used to set the token as a CSS custom property prefixed with
--nds-.- For example:
--nds-duration-simple: #{$duration-simple};.
- For example:
- System tokens (static properties associated with a foundation):
- should be declared on the
:rootelement. System tokens are foundational, and should be used globally. - should not be customizable. In other words, they should not include the
!defaultflag.
- should be declared on the
- Role tokens (themeable properties associated with a foundation):
- must be customizable with the
!defaultflag. This makes it possible to override the value on@forwardor@use. - should be named for their property or their role. If a token sets a single property, name it for its property. If it's used in a more abstract way, name it for what it is trying to accomplish (its role).
- Property example:
$background-colorif it's used to set thebackground-colorproperty. - Role example:
$padding-yif it's used for bothpadding-topandpadding-bottom.
- Property example:
- must be customizable with the
- Component tokens (properties associated with a component):
- should be set in a standalone
tokens.scssfile adjacent to the component's styles. - should be customizable with the
!defaultflag. - should default to existing role tokens whenever possible.
- Good 👍:
$background-color: var(--nds-background-color) !default;(role token) - Okay 👍:
$border-color: var(--nds-base-color-40) !default;(system token when no role token exists) - Bad 👎:
$background-color: var(--nds-white) !default;(system token when a role token exists) - Worse 👎:
$background-color: #fff !default;(raw value)
- Good 👍:
- should be named for their property or their role. If a token sets a single property, name it for its property. If it's used in a more abstract way, name it for what it is trying to accomplish (its role).
- Property example:
$background-colorif it's used to set thebackground-colorproperty. - Role example:
$padding-yif it's used for bothpadding-topandpadding-bottom.
- Property example:
- should not be prefixed. Component tokens are prefixed with the component's name when forwarded by the main entry point so including the prefix would result in a doubly-prefixed name (e.g.,
$tooltip-tooltip-border-radius).
- should be set in a standalone
10 months ago
11 months ago
1 year ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
2 years ago
3 years ago
4 years ago
4 years ago
4 years ago
4 years ago
4 years ago
5 years ago
4 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago
5 years ago