Skip to content
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

doc(toggle): Update the Style tab with the latest content template #4446

Open
wants to merge 4 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file modified src/pages/components/toggle/images/toggle-style-color.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Binary file modified src/pages/components/toggle/images/toggle-style-states.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
92 changes: 48 additions & 44 deletions src/pages/components/toggle/style.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,13 @@ structure, and size.

## Color

Both the default and small toggle variants share the same color and interactive
state properties.

| Element | Property | Color token |
| ---------------- | ---------------- | ------------------ |
| Label text | text color | `$text-secondary` |
| Action text | text color | `$text-primary` |
| Label text | text-color | `$text-secondary` |
| State text | text-color | `$text-primary` |
| Background (off) | background-color | `$toggle-off` |
| Handle (off) | background-color | `$icon-on-color` |
| Background (on) | background-color | `$support-success` |
Expand All @@ -38,31 +41,31 @@ structure, and size.
<Row>
<Column colLg={8}>

![On and off toggle states](images/toggle-style-color.png)
![On and off states of default and small toggle](images/toggle-style-color.png)

</Column>
</Row>

<Caption>On and off toggle states</Caption>
<Caption>On and off states of default and small toggle</Caption>

### Interactive states
### Interactive state color

The default and small toggle can be switched on and off across focus, disabled,
and read-only states.

| State | Element | Property | Color token |
| --------- | ----------- | ---------------- | ------------------------- |
| Focus | Toggle | border | `$focus` |
| Disabled | Label text | text color | `$text-disabled` |
| | Action text | text color | `$text-disabled` |
| | Background | background-color | `$button-disabled` |
| | Handle | background-color | `$icon-on-color-disabled` |
| | Checkmark | inner fill | `button-disabled` |
| Read-only | Label text | text color | `$text-secondary` |
| | Action text | text color | `$text-primary` |
| | Background | background-color | transparent |
| | Border | border | `border-subtle` \* |
| | Handle | background-color | `$icon-primary` |
| State | Element | Property | Color token |
| --------- | ---------- | ---------------- | ------------------------- |
| Focus | Toggle | border | `$focus` |
| Disabled | Label text | text-color | `$text-disabled` |
| | State text | text-color | `$text-disabled` |
| | Background | background-color | `$button-disabled` |
| | Handle | background-color | `$icon-on-color-disabled` |
| | Checkmark | inner fill | `$button-disabled` |
| Read-only | Label text | text-color | `$text-secondary` |
| | State text | text-color | `$text-primary` |
| | Background | background-color | transparent |
| | Border | border | `$border-subtle` \* |
| | Handle | background-color | `$icon-primary` |

<Caption fullWidth>
\* Denotes a contextual color token that will change values based on the layer
Expand All @@ -72,34 +75,34 @@ and read-only states.
<Row>
<Column colLg={8}>

![Interactive toggle states](images/toggle-style-states.png)
![Example of default and small toggle interactive state color](images/toggle-style-states.png)
Kritvi-bhatia17 marked this conversation as resolved.
Show resolved Hide resolved

</Column>
</Row>

<Caption>Interactive toggle states.</Caption>
<Caption>Example of default and small toggle interactive state color</Caption>

## Typography

Toggle labels should be set in sentence case, with only the first word in a
phrase and any proper nouns capitalized, and no more than three words.

| Element | Font-size (px/rem) | Font-weight | Type token |
| ----------- | ------------------ | ------------- | ------------------ |
| Label text | 12 / 0.75 | Regular / 400 | `$label-01` |
| Action text | 14 / 0.875 | Regular / 400 | `$body-compact-01` |
| Element | Font-size (px/rem) | Font-weight | Type token |
| ---------- | ------------------ | ------------- | ------------------ |
| Label text | 12 / 0.75 | Regular / 400 | `$label-01` |
| State text | 14 / 0.875 | Regular / 400 | `$body-compact-01` |

## Structure

### Default toggle
### Default toggle structure

| Element | Property | px / rem | Spacing token |
| ----------- | ------------------------- | --------- | ------------- |
| Toggle | width | 48 / 3 | – |
| | height | 24 / 1.5 | – |
| Handle | height, width | 18 / 1.25 | – |
| Label text | margin-top, margin-bottom | 16 / 1 | `$spacing-05` |
| Action text | margin-left | 8 / 0.5 | `$spacing-03` |
| Element | Property | px / rem | Spacing token |
| ---------- | ------------------------- | --------- | ------------- |
| Toggle | width | 48 / 3 | – |
| | height | 24 / 1.5 | – |
| Handle | height, width | 18 / 1.25 | – |
| Label text | margin-top, margin-bottom | 16 / 1 | `$spacing-05` |
| State text | margin-left | 8 / 0.5 | `$spacing-03` |

<div className="image--fixed">

Expand All @@ -111,14 +114,15 @@ phrase and any proper nouns capitalized, and no more than three words.
Structure and spacing measurements for default toggle | px / rem
</Caption>

### Small toggle
### Small toggle structure

| Element | Property | px / rem | Spacing token |
| ----------- | ------------- | ---------- | ------------- |
| Toggle | width | 32 / 2 | – |
| | height | 16 / 1 | – |
| Handle | height, width | 10 / 0.625 | `$spacing-03` |
| Action text | margin left | 8 / 0.5 | `$spacing-03` |
| Element | Property | px / rem | Spacing token |
| ---------- | ------------------------- | ---------- | ------------- |
| Toggle | width | 32 / 2 | – |
| | height | 16 / 1 | – |
| Handle | height, width | 10 / 0.625 | `$spacing-03` |
| Label text | margin-top, margin-bottom | 16 / 1 | `$spacing-05` |
| State text | margin left | 8 / 0.5 | `$spacing-03` |

<div className="image--fixed">

Expand All @@ -132,18 +136,18 @@ phrase and any proper nouns capitalized, and no more than three words.

## Size

| Size | Height px / rem |
| ---------- | --------------- |
| Small (sm) | 16 / 1 |
| Default | 24 / 1.5 |
| Size | Height (px / rem) |
| ---------- | ----------------- |
| Small (sm) | 16 / 1 |
| Default | 24 / 1.5 |

<div className="image--fixed">

![Sizes for toggle](images/toggle-style-sizes.png)

</div>

<Caption>Toggle sizes | px / rem</Caption>
<Caption>Default and small sizes of toggle | px / rem</Caption>

## Feedback

Expand Down