-
Notifications
You must be signed in to change notification settings - Fork 94
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
docs: Oryx design tokens #2025
docs: Oryx design tokens #2025
Changes from 1 commit
679ce2e
159ff20
fd01a3f
7d16c12
6b5aa9c
c79fc55
93913df
9bf0238
411115d
6176318
a8b916b
98ebdd5
d0c0211
1440fcb
d843ea0
1d1fc2c
db8c137
5247d3d
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Please, update this document in 202307.0 as well. |
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why did you create a new document in 202212, not in 202307? |
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
--- | ||
title: "Oryx: Design Tokens" | ||
description: Design tokens provide a centralized and consistent approach for styling components in Oryx applications. | ||
last_updated: July 24, 2023 | ||
template: concept-topic-template | ||
--- | ||
|
||
Design tokens are a fundamental aspect of the Oryx web framework, providing a powerful system for achieving consistent and customizable styles throughout the application. Design tokens are extensively used inside the [color system](/docs/scos/dev/front-end-development/{{page.version}}/oryx/styling/oryx-colors-system.html), typography, icons and many more. Design tokens ensure a clean separation between styles and components, making it easier to manage and maintain the application's design system. This document focuses on the structure and usage of design tokens in Oryx. | ||
|
||
## CSS variables | ||
|
||
Design tokens are provided as CSS variables in the application code. The variables follow a structured naming convention to ensure consistency and avoid conflicts. The variables are prefixed with "oryx" to avoid naming conflicts with 3rd party variables and are written in kebab-case. | ||
|
||
The CSS variables are written in the root element of the application. This is the `oryx-app` component by default. CSS variables are inherited by all descendants of the root component. This makes is convenient to access the variables throughout the entire application. CSS variables can however be overridden at any element in te application. | ||
tolerants marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
If you like to reuse the CSS variables outside the root element of the application, or if you are not using the `oryx-app` as the root, you can bootstrap the application using an alternative root: | ||
|
||
```ts | ||
import { appBuilder } from "@spryker-oryx/core"; | ||
|
||
appBuilder().withAppOptions({ components: { root: "body" } }); | ||
``` | ||
|
||
## Usage of Design Tokens | ||
|
||
Design tokens are used extensively throughout Oryx components to achieve consistent and cohesive visual styles. Instead of hardcoding style values directly in component CSS, design tokens are used as CSS variables to define the styles. This way, developers can easily modify the visual appearance of the entire application by adjusting the corresponding design token values. | ||
|
||
### Example: Using Design Tokens in CSS | ||
tolerants marked this conversation as resolved.
Show resolved
Hide resolved
|
||
|
||
```css | ||
.button { | ||
background-color: var(--oryx-color-primary-9); | ||
font-size: var(--oryx-typography-h1-size); | ||
} | ||
``` | ||
|
||
## Themes | ||
|
||
Design tokens are organized in themes. This allows you to quickly switch from one theme to another as well as to create your own theme. | ||
tolerants marked this conversation as resolved.
Show resolved
Hide resolved
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Add these changes to 202307 please