-
Notifications
You must be signed in to change notification settings - Fork 59
feat(docs): add Figma Tokens page #3458
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
base: ouds/main
Are you sure you want to change the base?
Changes from all commits
3245995
44af5ab
05b987f
bed6fb9
006bfdb
a7136db
63b4bef
c3b5fff
62170e0
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,62 @@ | ||
| --- | ||
| title: Utilities | ||
| description: All OUDS utilities at a glance. | ||
| aliases: | ||
| - "/utilities/" | ||
| - "/docs/utilities/" | ||
| - "/docs/[[config:docs_version]]/utilities/" | ||
| toc: true | ||
| --- | ||
|
|
||
| ## General usage | ||
|
|
||
| Our utilities are built on top of our [semantic tokens]([[docsref:/foundation/tokens#semantic-tokens]]) and our [composite tokens]([[docsref:/foundation/tokens#composite-tokens]]). They are the preferred way to use our tokens. When a token is used on Figma side, you should check if there is a utility class available for it. | ||
|
|
||
| We build our CSS variables following the architecture of the Figma tokens: | ||
| - [Raw tokens]([[docsref:/foundation/tokens#raw-tokens]]): No raw token is available as a utility. | ||
| - [Semantic tokens]([[docsref:/foundation/tokens#semantic-tokens]]): Semantic tokens are all [available as utilities](#using-our-utilities). | ||
| - [Composite tokens]([[docsref:/foundation/tokens#composite-tokens]]): Composite tokens are all [available as utilities](#using-our-utilities). | ||
| - [Component tokens]([[docsref:/foundation/tokens#component-tokens]]): No component token is available as a utility. | ||
|
|
||
| ## Using our utilities | ||
|
|
||
| To [integrate a Figma design](https://youtu.be/EnGJE0jZLPU?t=200), you will have to use tokens that are defined as `ouds/**`. This page gives you some directions on how to use these tokens within your codebase. | ||
|
|
||
| <Callout type="info" title="This is the recommended method." /> | ||
|
|
||
| When a token is used on Figma side, you should check if there is a utility class available for it. If there is, you should use it. This way, you will be sure that the token is applied correctly, and that it will be updated automatically when the token value changes. | ||
|
|
||
| <BsTable> | ||
| | On Figma I see | Used token | Utility classes | Utility link | | ||
| | -------------- | ---------- | --------------- | ------------ | | ||
| | A color for a background, a border or a content, used depending on a user action `ouds/color/action/*`. | `ouds/color/action/pressed` | `--bs-color-action-pressed` | <Callout type="warning" class="my-none"><p>This case is a bit special and you should read about [our color page]([[docsref:/foundation/colors]]).</p></Callout> | | ||
| | A background color using a standard token `ouds/color/{bg\|surface}/*`. | `ouds/color/bg/secondary`<br/>`ouds/color/surface/brand-primary` | `.bg-secondary`<br/>`.bg-surface-brand-primary` | [Background]([[docsref:/utilities/background]]) | | ||
| | A border using a standard token `ouds/color/border/*` or `ouds/border/*`. | `ouds/color/border/default`<br/>`ouds/border/radius/small`<br/>`ouds/border/width/thick` | `.border-default`<br/>`.rounded-small`<br/>`.border-thick` | [Border]([[docsref:/utilities/border]]) | | ||
| | A content using a standard color token `ouds/color/content/*`. | `ouds/color/content/muted`<br/>`ouds/color/content/on/brand-primary` | `.text-muted`<br/>`.text-on-brand-primary` | [Color]([[docsref:/utilities/color]]) | | ||
| | An opacity using a standard token `ouds/opacity/*`. Be careful where the token is applied. | `ouds/opacity/medium` | `.opacity-medium` | [Opacity]([[docsref:/utilities/opacity]]) | | ||
| | A shadow using an aggregated reference. Having a token shaped like `ouds/elevation/*` is a good sign that this reference has been used or should have been. | `ouds/elevation/**/emphasized` | `.shadow-emphasized` | [Shadow]([[docsref:/utilities/shadow]]) | | ||
|
Collaborator
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. Not sure I understand your sentence here "is a good sign that this reference has been used or should have been." ?
Member
Author
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. Yeah I didn't know how to say it, but I wanted to say that the presence of this token is a good marker that a composite tokens should be used instead of single tokens. |
||
| | A spacing using a standard token `ouds/space/{scaled\|fixed}/*` or `ouds/space/{column-gap\|row-gap}/*`. | `ouds/space/scaled/2xlarge`<br/>`ouds/space/fixed/medium`<br/>`ouds/space/row-gap/none` | `.p-scaled-2xlarge`<br/>`.p-medium`<br/>`.row-gap-none` | [Spacing]([[docsref:/utilities/spacing]]) | | ||
| | A text using an aggregated reference. Having a token shaped like `ouds/font/*` or `font-ref/size/weight` is a good sign that this reference has been used or should have been. | `ouds/font/**/body-large`<br/>`Body/Large/Strong` | `.fs-bl`<br/>`.fs-bl.fw-bold` | [Typography]([[docsref:/utilities/text#font-size]]) | | ||
| | A spacing using a grid token `ouds/grid/*` | `ouds/grid/column-gap`<br/>`ouds/grid/margin` | `.gap-gridgap`<br/>`.px-gridmargin` | [Spacing]([[docsref:/utilities/spacing#grid-measures]]) | | ||
| </BsTable> | ||
|
|
||
| ## Using our variables | ||
|
|
||
| <Callout type="warning"> | ||
| This method should only be use if there is no utility class available for the token you want to use, or if you need to apply the token on a pseudo element, or if you are creating a custom component. If you use this method, you will need to check that the token value is applied correctly, and that it will be updated automatically when the token value changes. | ||
| </Callout> | ||
|
|
||
| Variables names can be easily inferred from token names, [this is explained in the tokens documentation]([[docsref:/foundation/tokens#variables]]). | ||
|
|
||
| <BsTable> | ||
| | On Figma I see | Used token | Associated CSS variables | Associated Sass variables | | ||
| | -------------- | ---------- | --------------- | --------------- | | ||
| | A background color using a standard token `ouds/color/*`. | `ouds/color/bg/secondary`<br/>`ouds/color/surface/brand-primary`<br/>`ouds/color/action/hover` | `--bs-color-bg-secondary`<br/>`--bs-color-surface-brand-primary`<br/>`--bs-color-action-hover` | `$ouds-color-bg-secondary`<br/>`$ouds-color-surface-brand-primary`<br/>`$ouds-color-action-hover` | | ||
| | A border using a standard token `ouds/color/border/*` or `ouds/border/*`. | `ouds/color/border/default`<br/>`ouds/border/radius/small`<br/>`ouds/border/width/thick` | `--bs-color-border-default`<br/>`none`<br/>`none` | `$ouds-color-border-default`<br/>`$ouds-border-radius-small`<br/>`$ouds-border-width-thick` | | ||
| | A content using a standard color token `ouds/color/content/*`. | `ouds/color/content/muted`<br/>`ouds/color/content/on/brand-primary`<br/>`ouds/color/content/on/action/hover` | `--bs-color-content-muted`<br/>`--bs-color-content-on-brand-primary`<br/>`--bs-color-content-on-action-hover` | `$ouds-color-content-muted`<br/>`$ouds-color-content-on-brand-primary`<br/>`$ouds-color-content-on-action-hover` | | ||
| | An opacity using a standard token `ouds/opacity/*`. Be careful where the token is applied. | `ouds/opacity/medium` | `none` | `$ouds-opacity-medium` | | ||
| | A shadow using an aggregated reference. Having a token shaped like `ouds/elevation/*` is a good sign that this reference has been used or should have been. | `ouds/elevation/**/emphasized` | `none` | `$ouds-elevation-emphasized` | | ||
| | A spacing using a standard token `ouds/space/{scaled\|fixed}/*` or `ouds/space/{column-gap\|row-gap}/*`. | `ouds/space/scaled/2xlarge`<br/>`ouds/space/fixed/medium`<br/>`ouds/space/row-gap/none` | `--bs-space-scaled-2xlarge`<br/>`none`<br/>`none` | `none`<br/>`$ouds-space-fixed-medium`<br/>`$ouds-space-row-gap-none` | | ||
| | A text using an aggregated reference. Having a token shaped like `ouds/font/*` or `font-ref/size/weight` is a good sign that this reference has been used or should have been. | `ouds/font/**/body-large`<br/>`Body/Large/Strong` | `get-font-size("body-large")`<br/>`none`<br/>As you can see, this one is a bit special and calls a mixin [`get-font-size()`]([[docsref:/foundation/typography/#text-style-for-custom-components]]). | `none`<br/>`$ouds-font-weight-web-body-strong` | | ||
| | A spacing using a grid token `ouds/grid/*` | `ouds/grid/column-gap`<br/>`ouds/grid/margin` | `--bs-grid-gap`<br/>`--bs-grid-margin` | `none`<br/>`none` | | ||
| </BsTable> | ||
This file was deleted.
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.
I would add a Callout here to urge people to read the Foundation / Colors page when they need to use a color token.
"Please read our colors documentation page when working with color tokens"