@n8n/design-system 2.19.0 → 2.20.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.turbo/turbo-build.log +85 -84
- package/dist/design-system.css +1 -1
- package/dist/n8n-design-system.es.js +11613 -11458
- package/dist/n8n-design-system.umd.js +34 -34
- package/package.json +1 -1
- package/src/index.ts +2 -2
- package/src/styleguide/colour.mdx +52 -0
- package/src/styleguide/css-tokens.mdx +97 -0
- package/src/styleguide/motion.mdx +104 -0
- package/src/styleguide/shadow.mdx +96 -0
- package/src/styleguide/spacing-size.mdx +78 -0
- package/src/styleguide/type.mdx +91 -0
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -20,7 +20,7 @@ export { default as N8nInputNumber2 } from './v2/components/InputNumber/InputNum
|
|
|
20
20
|
export type * from './v2/components/InputNumber/InputNumber.types';
|
|
21
21
|
export { default as N8nDropdownMenu } from './v2/components/DropdownMenu/DropdownMenu.vue';
|
|
22
22
|
export type * from './v2/components/DropdownMenu/DropdownMenu.types';
|
|
23
|
-
export { default as N8nSwitch2 } from './
|
|
24
|
-
export type * from './
|
|
23
|
+
export { default as N8nSwitch2 } from './components/N8nSwitch/Switch.vue';
|
|
24
|
+
export type * from './components/N8nSwitch/Switch.types';
|
|
25
25
|
export { createPasswordRules } from './components/N8nFormInput/validators';
|
|
26
26
|
export { locale };
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
import PrimitivesColorTable from './components/PrimitivesColorTable.vue';
|
|
4
|
+
|
|
5
|
+
<Meta title="Styleguide/Colour" />
|
|
6
|
+
|
|
7
|
+
# Colour
|
|
8
|
+
|
|
9
|
+
We have a vast, beautiful color palette out of the box. Prefer using these rather than custom colours (e.g #ff0000). These are similar to Tailwind CSS.
|
|
10
|
+
|
|
11
|
+
Each colour has 13 steps ranging from lightest (50) to darkest (950).
|
|
12
|
+
|
|
13
|
+
<div class="sb-unstyled">
|
|
14
|
+
<PrimitivesColorTable />
|
|
15
|
+
</div>
|
|
16
|
+
|
|
17
|
+
## Tokens
|
|
18
|
+
|
|
19
|
+
Instead of using the raw primitive colours, it's often better to use a token. These are aliases for common use cases (e.g text color) to make it easier to keep UI consistent and flexible.
|
|
20
|
+
|
|
21
|
+
### Text
|
|
22
|
+
|
|
23
|
+
| Token | Description |
|
|
24
|
+
| ----------------------- | ----------------------------------------------- |
|
|
25
|
+
| `--text-color` | Default body text and primary labels. |
|
|
26
|
+
| `--text-color--subtle` | Secondary text such as helper copy or metadata. |
|
|
27
|
+
| `--text-color--subtler` | Tertiary or low-emphasis text. |
|
|
28
|
+
| `--text-color--inverse` | Text shown on dark or inverse surfaces. |
|
|
29
|
+
|
|
30
|
+
### Background
|
|
31
|
+
|
|
32
|
+
| Token | Description |
|
|
33
|
+
| ----------------------- | ------------------------------------------------------ |
|
|
34
|
+
| `--background--surface` | Base surface for cards, panels, and page sections. |
|
|
35
|
+
| `--background--hover` | Hover state for neutral interactive surfaces. |
|
|
36
|
+
| `--background--active` | Pressed/active state for neutral interactive surfaces. |
|
|
37
|
+
| `--background--success` | Success banners, badges, or confirmation surfaces. |
|
|
38
|
+
| `--background--warning` | Warning callouts and cautionary surfaces. |
|
|
39
|
+
| `--background--danger` | Danger/error surfaces behind destructive messaging. |
|
|
40
|
+
| `--background--info` | Informational surfaces and neutral notices. |
|
|
41
|
+
|
|
42
|
+
### Border
|
|
43
|
+
|
|
44
|
+
| Token | Description |
|
|
45
|
+
| ------------------------- | ------------------------------------------------- |
|
|
46
|
+
| `--border-color` | Default border for inputs, cards, and separators. |
|
|
47
|
+
| `--border-color--subtle` | Low-contrast dividers and lightweight outlines. |
|
|
48
|
+
| `--border-color--strong` | More prominent outlines for elevated contrast. |
|
|
49
|
+
| `--border-color--success` | Borders for success states and confirmations. |
|
|
50
|
+
| `--border-color--warning` | Borders for warning states and cautions. |
|
|
51
|
+
| `--border-color--danger` | Borders for error states and destructive actions. |
|
|
52
|
+
| `--border-color--info` | Borders for informational states. |
|
|
@@ -0,0 +1,97 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Styleguide/CSS Tokens" />
|
|
4
|
+
|
|
5
|
+
# CSS Tokens
|
|
6
|
+
|
|
7
|
+
Our CSS variables are layered so we can keep the design system consistent and themeable.
|
|
8
|
+
|
|
9
|
+
## Token layers
|
|
10
|
+
|
|
11
|
+
There are two main token layers
|
|
12
|
+
|
|
13
|
+
1. Primitives (`@n8n/design-system/src/css/_primitives.scss`)
|
|
14
|
+
2. Semantic Tokens (`@n8n/design-system/src/css/_tokens.scss`)
|
|
15
|
+
|
|
16
|
+
### Primitives
|
|
17
|
+
|
|
18
|
+
Raw design decisions: color scales, spacing, typography, radius, heights, durations, easing, and shadows.
|
|
19
|
+
|
|
20
|
+
```scss
|
|
21
|
+
--color--orange-500: oklch(...);
|
|
22
|
+
--spacing--sm: 1rem;
|
|
23
|
+
--font-size--md: 1rem;
|
|
24
|
+
--shadow--md: 0 10px 15px -3px var(--shadow-color), 0 4px 6px -4px var(--shadow-color);
|
|
25
|
+
```
|
|
26
|
+
|
|
27
|
+
### Semantic theme tokens
|
|
28
|
+
|
|
29
|
+
Contextual tokens used by components (`--text-color`, `--background--surface`, `--border-color--success`, etc.).
|
|
30
|
+
These map to primitives (directly or through compatibility aliases), and have light/dark definitions via `@mixin theme` and `@mixin theme-dark`.
|
|
31
|
+
|
|
32
|
+
## How to choose tokens
|
|
33
|
+
|
|
34
|
+
- Use semantic tokens first in component styles (for example `--text-color`, `--background--surface`, `--icon-color`).
|
|
35
|
+
- Use primitives when you need a low-level scale value (for example spacing, radius, or a specific color step).
|
|
36
|
+
- Add new semantic tokens in `src/css/_tokens.scss` when the value is reused by multiple components or represents a shared UI meaning.
|
|
37
|
+
- Add new primitive tokens in `src/css/_primitives.scss` only for new base scales.
|
|
38
|
+
|
|
39
|
+
## Naming rules
|
|
40
|
+
|
|
41
|
+
Naming is validated by `@n8n/css-var-naming` in `packages/@n8n/stylelint-config/src/rules/css-var-naming.ts` for files in `@n8n/design-system/src/css`.
|
|
42
|
+
|
|
43
|
+
### Required format
|
|
44
|
+
|
|
45
|
+
- Use groups separated by double dashes: `--group--group`.
|
|
46
|
+
- Use lowercase alphanumerics; single dashes are allowed only within a group.
|
|
47
|
+
- Keep values after properties (for example `--color--primary`, not `--primary--color`).
|
|
48
|
+
|
|
49
|
+
```scss
|
|
50
|
+
/* valid */
|
|
51
|
+
--background--surface
|
|
52
|
+
--button--color--background--primary--hover
|
|
53
|
+
--font-weight--regular
|
|
54
|
+
|
|
55
|
+
/* invalid */
|
|
56
|
+
--background-surface
|
|
57
|
+
--Primary--color
|
|
58
|
+
--primary--color
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
### Property vocabulary
|
|
62
|
+
|
|
63
|
+
Variable names must include a recognized property group such as `color`, `background`, `text-color`, `border-color`, `spacing`, `radius`, `shadow`, `font-size`, `font-weight`, `duration`, or `easing`.
|
|
64
|
+
|
|
65
|
+
### Allowed exceptions
|
|
66
|
+
|
|
67
|
+
- `--n8n--*` prefix bypasses validation for local/internal helper variables.
|
|
68
|
+
- Namespaces `--reka--*`, `--ag--*`, and `--chat--*` are ignored for third-party interoperability.
|
|
69
|
+
- Single-group variables are only allowed for specific standalone properties (for example `--border`, `--radius`, `--shadow`, `--font-family`).
|
|
70
|
+
|
|
71
|
+
## Migration pattern (single-dash to double-dash)
|
|
72
|
+
|
|
73
|
+
When replacing older tokens, preserve compatibility by chaining fallbacks:
|
|
74
|
+
|
|
75
|
+
```scss
|
|
76
|
+
--color--secondary: var(--color-secondary, var(--color--purple-600));
|
|
77
|
+
```
|
|
78
|
+
|
|
79
|
+
This gives us:
|
|
80
|
+
|
|
81
|
+
- New naming for design system code.
|
|
82
|
+
- Existing overrides for embed/custom CSS users.
|
|
83
|
+
- Safe, incremental migration without breaking consumers.
|
|
84
|
+
|
|
85
|
+
## Practical guidance for contributors
|
|
86
|
+
|
|
87
|
+
- Prefer updating existing semantic tokens before introducing new one-off variables.
|
|
88
|
+
- If you must add a temporary exception, scope it tightly with `/* stylelint-disable @n8n/css-var-naming */` and re-enable immediately.
|
|
89
|
+
- Avoid hardcoded color hex values in component styles when an existing token can express the same intent.
|
|
90
|
+
|
|
91
|
+
---
|
|
92
|
+
|
|
93
|
+
<small>
|
|
94
|
+
Compatibility note: `src/css/_tokens.legacy.scss` contains non-semantic compatibility aliases used
|
|
95
|
+
during migration to the double-dash naming format. Keep new work on primitives + semantic tokens
|
|
96
|
+
in `src/css/_primitives.scss` and `src/css/_tokens.scss`.
|
|
97
|
+
</small>
|
|
@@ -0,0 +1,104 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
import MotionExamples from './components/MotionExamples.vue';
|
|
3
|
+
|
|
4
|
+
<Meta title="Styleguide/Motion" />
|
|
5
|
+
|
|
6
|
+
# Motion
|
|
7
|
+
|
|
8
|
+
Motion should make n8n feel responsive, understandable, and calm. Use animation to explain
|
|
9
|
+
state changes, guide attention, or show progress. Avoid motion that is decorative, slow,
|
|
10
|
+
distracting, or repeated so often that it gets in the way.
|
|
11
|
+
|
|
12
|
+
Motion utilities live in `@n8n/design-system/src/css/mixins/motion.scss`.
|
|
13
|
+
|
|
14
|
+
## Principles
|
|
15
|
+
|
|
16
|
+
- **Keep motion purposeful**: Use motion when it helps users understand what has changed (e.g loading states, enter/existing surfaces). Don't add motion for the sake of it.
|
|
17
|
+
- **Prefer subtle movement**: Most motion should be short and low-distance. Small transitions, such as opacity and translations, are enough. Don't animate rapid frequently interactions (e.g hover states)
|
|
18
|
+
- **Prefer non re-painting values**: Opacity and transform are the safest animation properties for performance. Use caution with layout and paint properties like height, width, box-shadow, background-color, and filter. When using those properties, add `will-change`.
|
|
19
|
+
- **Always aim for +60fps**: Motion should feel smooth and responsive. If an animation causes jank or lag, simplify the animation or use a more performant approach.
|
|
20
|
+
- **Respect reduced motion**: Always provide a non-animated fallback for users who prefer reduced motion. Motion mixins should handle `prefers-reduced-motion` internally so that consumers can use them without repeating media queries.
|
|
21
|
+
- **Easing**: Use easing to make motion feel more natural. Avoid linear easing for UI interactions, as it can feel mechanical and less responsive. Instead, use `ease-out` for entrances and exits, and `ease-in-out` for movements of already visible elements. Avoid `ease-in` for most UI animations, as it can delay feedback and make the interface feel sluggish.
|
|
22
|
+
|
|
23
|
+
## Available Mixins
|
|
24
|
+
|
|
25
|
+
| Mixin | Use for | Notes |
|
|
26
|
+
| ------------------------------- | ----------------------------------- | ---------------------------------------------------------- |
|
|
27
|
+
| `motion.spin` | Loading indicators | Continuous rotation. |
|
|
28
|
+
| `motion.skeleton-pulse` | Skeleton loading placeholders | Use for placeholder surfaces, not interactive elements. |
|
|
29
|
+
| `motion.shimmer` | Text or inline loading states | Best for short-lived AI or thinking states. |
|
|
30
|
+
| `motion.popover-in` | Dropdowns, menus, floating surfaces | Uses opacity, translate, and scale. |
|
|
31
|
+
| `motion.collapsible-slide-down` | Opening collapsible content | Animates height. Use only when height animation is needed. |
|
|
32
|
+
| `motion.collapsible-slide-up` | Closing collapsible content | Animates height. Use only when height animation is needed. |
|
|
33
|
+
| `motion.fade-in` | Simple entrance | Prefer for subtle one-off reveals. |
|
|
34
|
+
| `motion.fade-in-up` | Entrance from below | Use for vertical reveal patterns. |
|
|
35
|
+
| `motion.fade-in-down` | Entrance from above | Use when the element visually comes from above. |
|
|
36
|
+
| `motion.fade-in-left` | Entrance from left | Use for horizontal directional context. |
|
|
37
|
+
| `motion.fade-in-right` | Entrance from right | Use for horizontal directional context. |
|
|
38
|
+
| `motion.fade-out` | Simple exit | Use for removal without spatial movement. |
|
|
39
|
+
| `motion.fade-out-down` | Exit downward | Pair with matching entrance direction when possible. |
|
|
40
|
+
| `motion.fade-out-up` | Exit upward | Pair with matching entrance direction when possible. |
|
|
41
|
+
| `motion.fade-out-left` | Exit left | Pair with matching entrance direction when possible. |
|
|
42
|
+
| `motion.fade-out-right` | Exit right | Pair with matching entrance direction when possible. |
|
|
43
|
+
| `motion.blink-background` | Cursor-like attention states | Avoid for large areas or frequent UI. |
|
|
44
|
+
| `motion.typing-blink` | Typing indicators | Use for small repeated indicators only. |
|
|
45
|
+
| `motion.pulse-glow` | Rare emphasis or loading pulse | Animates `box-shadow`; use sparingly. |
|
|
46
|
+
| `motion.pulse-glow-delayed` | Secondary delayed pulse | Only use with `pulse-glow`. |
|
|
47
|
+
| `motion.width-transition` | Width changes | Layout-affecting. Use cautiously. |
|
|
48
|
+
| `motion.height-transition` | Height changes | Layout-affecting. Use cautiously. |
|
|
49
|
+
|
|
50
|
+
## Using Mixins
|
|
51
|
+
|
|
52
|
+
Motion mixins expose CSS variables for local customization. Prefer local overrides over
|
|
53
|
+
creating new keyframes.
|
|
54
|
+
|
|
55
|
+
```scss
|
|
56
|
+
.dropdown {
|
|
57
|
+
--animation--popover-in--duration: var(--duration--snappy);
|
|
58
|
+
--animation--popover-in--translate-y: var(--spacing--4xs);
|
|
59
|
+
|
|
60
|
+
@include motion.popover-in;
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
## Examples
|
|
65
|
+
|
|
66
|
+
<MotionExamples />
|
|
67
|
+
|
|
68
|
+
## Adding New Mixins
|
|
69
|
+
|
|
70
|
+
Before adding a new mixin, check whether an existing mixin can be customized with CSS
|
|
71
|
+
variables.
|
|
72
|
+
|
|
73
|
+
Add a new mixin only when:
|
|
74
|
+
|
|
75
|
+
- The motion pattern is reused by multiple components.
|
|
76
|
+
- The animation has a clear product purpose.
|
|
77
|
+
- The behavior cannot be expressed cleanly with existing mixins.
|
|
78
|
+
- The mixin includes reduced-motion handling.
|
|
79
|
+
- The mixin uses design-system duration and easing tokens.
|
|
80
|
+
|
|
81
|
+
New mixins should follow this shape:
|
|
82
|
+
|
|
83
|
+
```scss
|
|
84
|
+
@mixin example-motion {
|
|
85
|
+
animation: exampleMotion var(--animation--example-motion--duration, var(--duration--snappy))
|
|
86
|
+
var(--animation--example-motion--easing, var(--easing--ease-out));
|
|
87
|
+
|
|
88
|
+
@media (prefers-reduced-motion: reduce) {
|
|
89
|
+
animation: none;
|
|
90
|
+
}
|
|
91
|
+
}
|
|
92
|
+
|
|
93
|
+
@keyframes exampleMotion {
|
|
94
|
+
from {
|
|
95
|
+
opacity: 0;
|
|
96
|
+
transform: translateY(var(--animation--example-motion--translate, var(--spacing--4xs)));
|
|
97
|
+
}
|
|
98
|
+
|
|
99
|
+
to {
|
|
100
|
+
opacity: 1;
|
|
101
|
+
transform: translateY(0);
|
|
102
|
+
}
|
|
103
|
+
}
|
|
104
|
+
```
|
|
@@ -0,0 +1,96 @@
|
|
|
1
|
+
import { Meta, Source } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Styleguide/Shadow" />
|
|
4
|
+
|
|
5
|
+
# Shadows
|
|
6
|
+
|
|
7
|
+
Create depth and elevation for UI elements
|
|
8
|
+
|
|
9
|
+
Shadows can be applied using the `shadow-*` primitive. Variants range from `xs` to `xl` and can be used to create depth and elevation for UI elements.
|
|
10
|
+
|
|
11
|
+
Below is a table showcasing the different shadow variants available in the design system.
|
|
12
|
+
|
|
13
|
+
| Step | Value | Description |
|
|
14
|
+
| ------- | ------------------------ | -------------------------------------------------------------- |
|
|
15
|
+
| outline | `var(--shadow--outline)` | Used for focus outlines and similar effects. |
|
|
16
|
+
| 2xs | `var(--shadow--2xs)` | Used for very subtle shadows, such as small elements. |
|
|
17
|
+
| xs | `var(--shadow--xs)` | Used for slightly subtle shadows, such as on buttons or cards. |
|
|
18
|
+
| sm | `var(--shadow--sm)` | Used for standard shadows, such as on popovers or selects. |
|
|
19
|
+
| md | `var(--shadow--md)` | Used for more prominent shadows, such as floating elements. |
|
|
20
|
+
| lg | `var(--shadow--lg)` | Used for larger shadows. |
|
|
21
|
+
| xl | `var(--shadow--xl)` | Used for elevated elements, such as dialogs. |
|
|
22
|
+
|
|
23
|
+
## Example
|
|
24
|
+
|
|
25
|
+
Shadows can be applied using the `shadow-*` primitive. It's recommended to create a local variable and apply the `_primitives.scss` token for flexibility.
|
|
26
|
+
|
|
27
|
+
<div class="sb-unstyled shadow-demo">
|
|
28
|
+
<div class="shadow-demo__item">
|
|
29
|
+
<div class="shadow-demo__label">.box1</div>
|
|
30
|
+
<div class="shadow-demo__card" style={{ boxShadow: 'var(--shadow--xs)' }} />
|
|
31
|
+
</div>
|
|
32
|
+
<div class="shadow-demo__item">
|
|
33
|
+
<div class="shadow-demo__label">.box2</div>
|
|
34
|
+
<div class="shadow-demo__card" style={{ boxShadow: 'var(--shadow--md)' }} />
|
|
35
|
+
</div>
|
|
36
|
+
<div class="shadow-demo__item">
|
|
37
|
+
<div class="shadow-demo__label">.box3</div>
|
|
38
|
+
<div class="shadow-demo__card" style={{ boxShadow: 'var(--shadow--xl)' }} />
|
|
39
|
+
</div>
|
|
40
|
+
</div>
|
|
41
|
+
|
|
42
|
+
```css
|
|
43
|
+
.box {
|
|
44
|
+
width: 160px;
|
|
45
|
+
height: 160px;
|
|
46
|
+
border-radius: var(--radius--lg);
|
|
47
|
+
background: var(--background--surface);
|
|
48
|
+
box-shadow: var(--n8n--shadow--box);
|
|
49
|
+
}
|
|
50
|
+
|
|
51
|
+
.box1 {
|
|
52
|
+
--n8n--shadow--box: var(--shadow--xs);
|
|
53
|
+
}
|
|
54
|
+
|
|
55
|
+
.box2 {
|
|
56
|
+
--n8n--shadow--box: var(--shadow--md);
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
.box3 {
|
|
60
|
+
--n8n--shadow--box: var(--shadow--xl);
|
|
61
|
+
}
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
<style>
|
|
65
|
+
{`
|
|
66
|
+
.shadow-demo {
|
|
67
|
+
display: grid;
|
|
68
|
+
grid-template-columns: repeat(3, minmax(0, 1fr));
|
|
69
|
+
gap: var(--spacing--lg);
|
|
70
|
+
padding: var(--spacing--xl);
|
|
71
|
+
padding-bottom:calc(2rem + var(--spacing--xl));
|
|
72
|
+
border-radius:var(--radius--lg) var(--radius--lg) 0 0;
|
|
73
|
+
border: 1px solid var(--border-color);
|
|
74
|
+
border-bottom:0;
|
|
75
|
+
background: light-dark(var(--color--neutral-100), var(--color--neutral-900));
|
|
76
|
+
margin-bottom:-2rem;
|
|
77
|
+
}
|
|
78
|
+
.shadow-demo__item {
|
|
79
|
+
display: flex;
|
|
80
|
+
flex-direction: column;
|
|
81
|
+
align-items: center;
|
|
82
|
+
gap: var(--spacing--md);
|
|
83
|
+
}
|
|
84
|
+
.shadow-demo__label {
|
|
85
|
+
color: var(--text-color);
|
|
86
|
+
font-weight: var(--font-weight--semibold);
|
|
87
|
+
}
|
|
88
|
+
.shadow-demo__card {
|
|
89
|
+
width: 160px;
|
|
90
|
+
height: 160px;
|
|
91
|
+
border: 1px solid var(--border-color);
|
|
92
|
+
border-radius: var(--radius--lg);
|
|
93
|
+
background: var(--background--surface);
|
|
94
|
+
}
|
|
95
|
+
`}
|
|
96
|
+
</style>
|
|
@@ -0,0 +1,78 @@
|
|
|
1
|
+
import { Meta } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Styleguide/Spacing & Size" />
|
|
4
|
+
|
|
5
|
+
# Spacing & Size
|
|
6
|
+
|
|
7
|
+
Our spacing scale is built to keep visual rhythm consistent across components, with step names (`5xs` to `5xl`) that map to fixed pixel values.
|
|
8
|
+
|
|
9
|
+
Use adjacent steps when adjusting layouts so spacing feels intentional instead of drifting into one-off values.
|
|
10
|
+
The height scale complements spacing and gives controls a shared size language, so buttons, inputs, and panels align naturally.
|
|
11
|
+
|
|
12
|
+
## Spacing
|
|
13
|
+
|
|
14
|
+
| Name | Size (px) | Visualization |
|
|
15
|
+
| ---- | --------- | ------------------------------------------------------------------------------ |
|
|
16
|
+
| 5xs | 2px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--5xs)' }} /> |
|
|
17
|
+
| 4xs | 4px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--4xs)' }} /> |
|
|
18
|
+
| 3xs | 6px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--3xs)' }} /> |
|
|
19
|
+
| 2xs | 8px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--2xs)' }} /> |
|
|
20
|
+
| xs | 12px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--xs)' }} /> |
|
|
21
|
+
| sm | 16px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--sm)' }} /> |
|
|
22
|
+
| md | 20px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--md)' }} /> |
|
|
23
|
+
| lg | 24px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--lg)' }} /> |
|
|
24
|
+
| xl | 32px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--xl)' }} /> |
|
|
25
|
+
| 2xl | 48px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--2xl)' }} /> |
|
|
26
|
+
| 3xl | 64px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--3xl)' }} /> |
|
|
27
|
+
| 4xl | 128px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--4xl)' }} /> |
|
|
28
|
+
| 5xl | 256px | <span class="spacing-size spacing" style={{ width: 'var(--spacing--5xl)' }} /> |
|
|
29
|
+
|
|
30
|
+
## Height
|
|
31
|
+
|
|
32
|
+
| Name | Size (px) | Visualization |
|
|
33
|
+
| ---- | --------- | ----------------------------------------------------------------------------- |
|
|
34
|
+
| 5xs | 8px | <span class="spacing-size height" style={{ height: 'var(--height--5xs)' }} /> |
|
|
35
|
+
| 4xs | 12px | <span class="spacing-size height" style={{ height: 'var(--height--4xs)' }} /> |
|
|
36
|
+
| 3xs | 16px | <span class="spacing-size height" style={{ height: 'var(--height--3xs)' }} /> |
|
|
37
|
+
| 2xs | 20px | <span class="spacing-size height" style={{ height: 'var(--height--2xs)' }} /> |
|
|
38
|
+
| xs | 24px | <span class="spacing-size height" style={{ height: 'var(--height--xs)' }} /> |
|
|
39
|
+
| sm | 28px | <span class="spacing-size height" style={{ height: 'var(--height--sm)' }} /> |
|
|
40
|
+
| md | 32px | <span class="spacing-size height" style={{ height: 'var(--height--md)' }} /> |
|
|
41
|
+
| lg | 36px | <span class="spacing-size height" style={{ height: 'var(--height--lg)' }} /> |
|
|
42
|
+
| xl | 40px | <span class="spacing-size height" style={{ height: 'var(--height--xl)' }} /> |
|
|
43
|
+
| 2xl | 48px | <span class="spacing-size height" style={{ height: 'var(--height--2xl)' }} /> |
|
|
44
|
+
| 3xl | 56px | <span class="spacing-size height" style={{ height: 'var(--height--3xl)' }} /> |
|
|
45
|
+
| 4xl | 64px | <span class="spacing-size height" style={{ height: 'var(--height--4xl)' }} /> |
|
|
46
|
+
| 5xl | 96px | <span class="spacing-size height" style={{ height: 'var(--height--5xl)' }} /> |
|
|
47
|
+
|
|
48
|
+
### Negative Values
|
|
49
|
+
|
|
50
|
+
To get negative values, use the `calc()` function like so:
|
|
51
|
+
|
|
52
|
+
```css
|
|
53
|
+
.box {
|
|
54
|
+
margin-inline: calc(var(--spacing--xs) * -1); /* -12px */
|
|
55
|
+
}
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
<style>
|
|
59
|
+
{`
|
|
60
|
+
|
|
61
|
+
.spacing-size {
|
|
62
|
+
display: inline-block;
|
|
63
|
+
margin:var(--spacing--4xs);
|
|
64
|
+
background: var(--color--mint-500);
|
|
65
|
+
border-radius: var(--radius--4xs);
|
|
66
|
+
}
|
|
67
|
+
|
|
68
|
+
.spacing-size.height {
|
|
69
|
+
aspect-ratio:1/1;
|
|
70
|
+
min-width: 2px;
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
.spacing-size.spacing {
|
|
74
|
+
min-width: 2px;
|
|
75
|
+
height:var(--spacing--xs);
|
|
76
|
+
}
|
|
77
|
+
`}
|
|
78
|
+
</style>
|
|
@@ -0,0 +1,91 @@
|
|
|
1
|
+
import { Meta, Typeset } from '@storybook/addon-docs/blocks';
|
|
2
|
+
|
|
3
|
+
<Meta title="Styleguide/Type" />
|
|
4
|
+
|
|
5
|
+
export const typography = {
|
|
6
|
+
type: {
|
|
7
|
+
primary: 'InterVariable, sans-serif',
|
|
8
|
+
monospace: "CommitMono, ui-monospace, Menlo, Consolas, 'DejaVu Sans Mono', monospace",
|
|
9
|
+
},
|
|
10
|
+
weight: {
|
|
11
|
+
regular: '400',
|
|
12
|
+
medium: '500',
|
|
13
|
+
bold: '600',
|
|
14
|
+
},
|
|
15
|
+
size: {
|
|
16
|
+
s1: 8,
|
|
17
|
+
s2: 10,
|
|
18
|
+
s3: 12,
|
|
19
|
+
s4: 13,
|
|
20
|
+
s5: 14,
|
|
21
|
+
m1: 16,
|
|
22
|
+
m2: 18,
|
|
23
|
+
m3: 20,
|
|
24
|
+
l1: 28,
|
|
25
|
+
},
|
|
26
|
+
};
|
|
27
|
+
|
|
28
|
+
export const SampleText = 'The quick brown fox jumps over the lazy dog.';
|
|
29
|
+
|
|
30
|
+
# Type
|
|
31
|
+
|
|
32
|
+
**Font:** InterVariable
|
|
33
|
+
|
|
34
|
+
**Weights:** 400 (regular), 500 (medium), 600 (bold)
|
|
35
|
+
|
|
36
|
+
<Typeset
|
|
37
|
+
fontSizes={[
|
|
38
|
+
typography.size.s1,
|
|
39
|
+
typography.size.s2,
|
|
40
|
+
typography.size.s3,
|
|
41
|
+
typography.size.s4,
|
|
42
|
+
typography.size.s5,
|
|
43
|
+
typography.size.m1,
|
|
44
|
+
typography.size.m2,
|
|
45
|
+
typography.size.m3,
|
|
46
|
+
typography.size.l1,
|
|
47
|
+
]}
|
|
48
|
+
fontWeight={typography.weight.bold}
|
|
49
|
+
sampleText={SampleText}
|
|
50
|
+
fontFamily={typography.type.primary}
|
|
51
|
+
/>
|
|
52
|
+
|
|
53
|
+
---
|
|
54
|
+
|
|
55
|
+
**Font:** CommitMono
|
|
56
|
+
|
|
57
|
+
**Weights:** 400 (regular), 600 (bold)
|
|
58
|
+
|
|
59
|
+
<Typeset
|
|
60
|
+
fontSizes={[
|
|
61
|
+
typography.size.s1,
|
|
62
|
+
typography.size.s2,
|
|
63
|
+
typography.size.s3,
|
|
64
|
+
typography.size.s4,
|
|
65
|
+
typography.size.s5,
|
|
66
|
+
typography.size.m1,
|
|
67
|
+
typography.size.m2,
|
|
68
|
+
typography.size.m3,
|
|
69
|
+
typography.size.l1,
|
|
70
|
+
]}
|
|
71
|
+
fontWeight={typography.weight.bold}
|
|
72
|
+
sampleText={SampleText}
|
|
73
|
+
fontFamily={typography.type.monospace}
|
|
74
|
+
/>
|
|
75
|
+
|
|
76
|
+
## Usage
|
|
77
|
+
|
|
78
|
+
When rendering text inside the app, use `<Heading />` or `<Text />` and stick to the style and size set.
|
|
79
|
+
Both of them share the same size and weight options.
|
|
80
|
+
|
|
81
|
+
| Step | Size | Letter spacing | Line height |
|
|
82
|
+
| ---- | ----------------------- | --------------------------------- | ------------------------ |
|
|
83
|
+
| 4xs | `var(--font-size--4xs)` | `var(--letter-spacing--wide)` | `var(--line-height--xs)` |
|
|
84
|
+
| 3xs | `var(--font-size--3xs)` | `var(--letter-spacing--normal)` | `var(--line-height--sm)` |
|
|
85
|
+
| 2xs | `var(--font-size--2xs)` | `var(--letter-spacing--normal)` | `var(--line-height--md)` |
|
|
86
|
+
| xs | `var(--font-size--xs)` | `var(--letter-spacing--normal)` | `var(--line-height--md)` |
|
|
87
|
+
| sm | `var(--font-size--sm)` | `var(--letter-spacing--normal)` | `var(--line-height--lg)` |
|
|
88
|
+
| md | `var(--font-size--md)` | `var(--letter-spacing--normal)` | `var(--line-height--lg)` |
|
|
89
|
+
| lg | `var(--font-size--lg)` | `var(--letter-spacing--tight)` | `var(--line-height--xl)` |
|
|
90
|
+
| xl | `var(--font-size--xl)` | `var(--letter-spacing--tighter)` | `var(--line-height--xl)` |
|
|
91
|
+
| 2xl | `var(--font-size--2xl)` | `var(--letter-spacing--tightest)` | `var(--line-height--xl)` |
|