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

Tab style v11 #2376

Merged
merged 16 commits into from
Jun 9, 2021
Binary file modified src/pages/components/tabs/images/tab-style-1.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.
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.
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.
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.
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.
249 changes: 229 additions & 20 deletions src/pages/components/tabs/style.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,22 +5,153 @@ description:
tabs: ['Usage', 'Style', 'Code', 'Accessibility']
---

<AnchorLinks>

<AnchorLink>Color</AnchorLink>
<AnchorLink>Typography</AnchorLink>
<AnchorLink>Structure</AnchorLink>

</AnchorLinks>

## Color

| Class | Property | Color token |
| ------------------------------- | ------------- | ----------------- |
| `.bx--tabs__nav-link` | text color | `$text-02` |
| `.bx--tabs__nav-item` | border-bottom | `$ui-03` |
| `.bx--tabs__nav-link:selected` | text color | `$text-01` |
| `.bx--tabs__nav-item--selected` | border-bottom | `$interactive-04` |
### Line tabs

| State | Element | Property | Color token |
| -------- | --------------------- | ---------------- | ---------------------------------------------- |
| Enabled | Background | background-color | transparent |
| | Label | text-color | `$text-secondary` |
| | Icon | svg | `$icon-secondary` |
| | Background | border-bottom | `$border-subtle` |
| | Scrollable icon | svg | `$icon-primary` |
| | Scrollable fade | background-color | 8px, linear-gradient white to 100% transparent |
| | Scrollable background | background-color | `$background` |
| Selected | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | Background | border-bottom | `$interactive` |

<div className="image--fixed">

![Example of selected and enabled line tabs](images/tab-style-1.png)

</div>

<Caption>Example of selected and enabled line tabs.</Caption>

<br />

#### Interactive states

<br />

| State | Element | Property | Color token |
| -------------- | --------------------- | ---------------- | ------------------- |
| Hover | Background | border-bottom | `$interactive` |
| | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | Scrollable background | background-color | `$background-hover` |
| Active | Scrollable background | background-color | `$layer-accent` |
| Focus | Scrollable background | border | `$focus` |
| Focus-enabled | Label | text-color | `$text-secondary` |
| | Background | border | `$interactive` |
| | Icon | svg | `$icon-secondary` |
| Focus-selected | Label | text-color | `$text-primary` |
| | Background | border | `$interactive` |
| | Icon | svg | `$icon-primary` |
| Disabled | Label | text-color | `$text-disabled` |
| | Icon | svg | `$icon-disabled` |
| | Background | background-color | `$icon-disabled` |

<div className="image--fixed">

![Examples of hover, focus-enabled, focus-selected, and disabled states](images/tab-style-3.png)

</div>

<Caption>
Examples of hover, focus-enabled, focus-selected, and disabled states for line
tabs.
</Caption>

### Interactive states
<div className="image--fixed">

![Examples of enabled, hover, active, and disabled states for scrollable line tabs](images/tab-style-4.png)

</div>

<Caption>
Examples of enabled, hover, active, and disabled states for scrollable line
tabs.
</Caption>

### Contained tabs

| State | Element | Property | Color token |
| -------- | --------------- | ---------------- | --------------------- |
| Enabled | Background | background-color | `$layer-accent` |
| | Label | text-color | `$text-secondary` |
| | Icon | svg | `$icon-secondary` |
| | Background | border-right | `$border-strong` |
| | Scrollable icon | svg | `$icon-secondary` |
| | Label | text-color | `$text-primary` |
| Selected | Background | background-color | `$layer` |
| | Icon | svg | `$icon-primary` |
| | Background | border-top | `$border-interactive` |

<div className="image--fixed">

![Examples of selected and enabled contained tabs](images/tab-style-2.png)

</div>

<Caption>Examples of selected and enabled contained tabs.</Caption>

<br />

#### Interactive states

<br />

| State | Element | Property | Color token |
| -------------- | --------------------- | ---------------- | ---------------------- |
| Hover | Background | background-color | `$layer-accent-hover` |
| | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | Scrollable background | background-color | `$layer-accent-hover` |
| Active | Scrollable background | background-color | `$layer-accent-active` |
| Focus | Scrollable background | border | `$focus` |
| Focus-enabled | Label | text-color | `$text-secondary` |
| | Background | background-color | `$layer-accent` |
| | Icon | svg | `$icon-secondary` |
| Focus-selected | Label | text-color | `$text-primary` |
| | Background | background-color | `$layer` |
| | Icon | svg | `$icon-primary` |
| Disabled | Label | text-color | `$text-disabled` |
| | Icon | svg | `$icon-disabled` |
| | Background | background-color | `$icon-disabled` |
| | Border | border-right | `$border-disabled` |

<div className="image--fixed">

| Class | Property | Color token |
| --------------------------- | ------------- | ----------- |
| `.bx--tabs__nav-link:hover` | text color | `$text-01` |
| `.bx--tabs__nav-item:hover` | border-bottom | `$ui-04` |
| `.bx--tabs__nav-item:focus` | border | `$focus` |
![Hover, focus-enabled, focus-selected, and disabled states for contained
tabs.](images/tab-style-5.png)

</div>

<Caption>
Hover, focus-enabled, focus-selected, and disabled states for contained tabs.
</Caption>

<div className="image--fixed">

![Enabled, hover, active, and focus states for contained scrollable tabs.](images/tab-style-6.png)

</div>

<Caption>
Examples of enabled, hover, active, and focus states for contained scrollable
tabs.
</Caption>

## Typography

Expand All @@ -33,17 +164,95 @@ Tab label should be set in sentence case, and should not exceed three words.

## Structure

| Class | Property | px / rem | Spacing token |
| --------------------- | --------------------------- | -------- | ------------- |
| `.bx--tabs__nav-item` | border-bottom | 2px | – |
| `.bx--tabs__nav-link` | padding-left, padding-right | 16 / 1 | `$spacing-05` |
| `.bx--tabs__nav-link` | padding-top, padding-bottom | 8 / 0.5 | `$spacing-03` |
| `bx--tabs__nav-item` | margin-left | 1px | - |
### Line tabs
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved

| Element | Property | px / rem | Spacing token |
| --------------- | --------------------------- | ---------- | ------------- |
| Tab | height | 40 / 2.5 | – |
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved
| | border-bottom | 2px | – |
| | width | auto-width | – |
| | margin-left | 1px | – |
| Label | padding-left, padding-right | 16 / 1 | `$spacing-05` |
| | padding-top, padding-bottom | 8 / 0.5 | `$spacing-03` |
| Icon | padding-right | 16 / 1 | `$spacing-05` |
| | padding-left | 8 / 0.5 | `$spacing-03` |
| | svg | 16 x 16 | – |
| Scrollable icon | svg | 16 x 16 | – |

<div className="image--fixed">

![Structure and spacing measurements for line tabs.](images/tab-style-7.png)

</div>

<Caption>Structure and spacing measurements for line tabs | px / rem</Caption>

<br />

#### Icon-only modifier

<br />

| Element | Property | px / rem | Spacing token |
| -------- | ------------- | -------- | ------------- |
| Tab (md) | height, width | 40 / 2.5 | – |
| | svg | 16 x 16 | – |
| Tab (lg) | height, width | 48 / 3 | – |
| | svg | 20 x 20 | – |

<div className="image--fixed">

![Structure and spacing measurements for line tabs in px and rem](images/tab-style-7b.png)

</div>

<Caption>
Structure and spacing measurements for icon-only line tabs | px / rem
</Caption>

### Contained tabs

| Element | Property | px / rem | Spacing token |
| --------------------- | --------------------------- | ---------------- | ------------- |
| Tab | height | 40 / 2.5 | – |
| | border-top | 2px | – |
| | width | auto-width, grid | – |
| Label | padding-left, padding-right | 16 / 1 | `$spacing-05` |
| Icon | padding-right | 16 / 1 | `$spacing-05` |
| | padding-left | 16 / 1 | `$spacing-05` |
| | svg | 16 x 16 | – |
| Tab | border-right | 1px | – |
| Scrollable icon | svg | 16 x 16 | – |
| Scrollable background | border-right, border-left | 1px | – |

<div className="image--fixed">

![Structure and spacing measurements for contained tabs in px and rem](images/tab-style-8.png)

</div>

<Caption>
Structure and spacing measurements for contained tabs | px / rem
</Caption>

<br />

#### Icon-only modifier

<br />

| Element | Property | px / rem | Spacing token |
| -------- | ------------- | -------- | ------------- |
| Tab (lg) | height, width | 48 / 3 | – |
| | svg | 20 x 20 | – |

<div className="image--fixed">

![Structure and spacing measurements for tabs](images/tab-style-1.png)
![Structure and spacing measurements for icon-only contained tabs in px and
rem](images/tab-style-8b.png)

</div>

<Caption>Structure and spacing measurements for tile | px / rem</Caption>
<Caption>
Structure and spacing measurements for icon-only contained tabs | px / rem
</Caption>