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

docs: Adding dismissible docs #3581

Merged
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
b598414
docs: Adding dismissible docs
kingtraceyj Jun 6, 2023
e7c3d6e
docs: add dismissible images
kingtraceyj Jun 6, 2023
630badc
docs: update image names
kingtraceyj Jun 6, 2023
19a139e
Merge branch 'main' into dismissible-tabs-docs
kingtraceyj Jun 6, 2023
7bce3df
docs: dismissible color and structure sections
kingtraceyj Jun 7, 2023
2c785ba
docs: updated style images
kingtraceyj Jun 7, 2023
c0ba31f
Merge branch 'main' into dismissible-tabs-docs
alisonjoseph Jun 7, 2023
7e511c3
docs: updated caption formatting
kingtraceyj Jun 7, 2023
0b709a5
docs: removed a br
kingtraceyj Jun 7, 2023
849e1c0
chore(mdx): fix formatting
tw15egan Jun 8, 2023
e621924
Update src/pages/components/tabs/style.mdx
kingtraceyj Jun 12, 2023
a7a5e28
Update src/pages/components/tabs/usage.mdx
kingtraceyj Jun 12, 2023
4eeac61
Update src/pages/components/tabs/usage.mdx
kingtraceyj Jun 12, 2023
6fa31a0
Update src/pages/components/tabs/usage.mdx
kingtraceyj Jun 12, 2023
44d03a4
Merge branch 'main' into dismissible-tabs-docs
kingtraceyj Jun 12, 2023
a837e32
Merge branch 'main' into dismissible-tabs-docs
kingtraceyj Jun 13, 2023
b153498
Merge branch 'dismissible-tabs-docs' of https://github.com/kingtracey…
kingtraceyj Jun 13, 2023
dd36365
docs: update titles and images
kingtraceyj Jun 13, 2023
347ebb8
docs: removed a few anchor links
kingtraceyj Jun 13, 2023
8385ee8
docs: updated image caption
kingtraceyj Jun 14, 2023
b1badc3
Merge branch 'main' into dismissible-tabs-docs
kingtraceyj Jun 28, 2023
56bc09b
Merge branch 'main' into dismissible-tabs-docs
kingtraceyj Jun 29, 2023
cdb4daa
Merge branch 'dismissible-tabs-docs' of https://github.com/kingtracey…
kingtraceyj Jun 29, 2023
b31e117
updated dismissible image
kingtraceyj Jun 29, 2023
685f6af
fix: format
francinelucca Jun 29, 2023
46603b7
Merge branch 'main' into dismissible-tabs-docs
kingtraceyj Jul 5, 2023
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
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.
216 changes: 214 additions & 2 deletions src/pages/components/tabs/style.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,21 @@ description:
tabs: ['Usage', 'Style', 'Code', 'Accessibility']
---

<PageDescription>

The following page documents visual specifications such as color, typography,
structure, and size.

</PageDescription>

<AnchorLinks>

<AnchorLink>Color</AnchorLink> <AnchorLink>Typography</AnchorLink>
<AnchorLink>Structure</AnchorLink> <AnchorLink>Size</AnchorLink>
<AnchorLink>Feedback</AnchorLink>
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved

</AnchorLinks>

## Color

### Line tabs
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved
Expand All @@ -29,7 +44,7 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']

<br />

#### Interactive states
#### Interactive state color

<br />

Expand Down Expand Up @@ -82,6 +97,67 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']
tabs.
</Caption>

### Dismissible line tabs

| Type | Element | Property | Color token |
| ---------- | ------- | ---------------- | --------------------- |
| Unselected | Tab | background-color | transparent |
| | | border-bottom | `$border-subtle` \* |
| | Label | text-color | `$text-secondary` |
| | Icon | svg | `$icon-secondary` |
| Selected | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | Tab | border-bottom | `$border-interactive` |

<div className="image--fixed">

![Example of selected and unselected dismissible line tabs](images/tab-style-9.png)

</div>

<Caption>Example of selected and unselected dismissible line tabs.</Caption>

<br />

#### Interactive state color

<br />

| State | Element | Property | Color token |
| -------- | --------------- | ---------------- | ------------------- |
| Hover | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | | background-color | `$background-hover` |
| | Tab | border-bottom | `$border-strong` |
| Focus | Tab: unselected | border | `$focus` |
| | Tab: selected | border | `$focus` |
| Disabled | Label | text-color | `$text-disabled` |
| | Icon | svg | `$icon-disabled` |
| | Tab | background-color | transparent |
| | | border-bottom | `$border-disabled` |

<div className="image--fixed">

![Examples of unselected close hover, unselected hover, unselected focus, and disabled states for dismissible line tabs](images/tab-style-11a.png)

</div>

<Caption>
Examples of unselected close hover, unselected hover, unselected focus, and
disabled states for dismissible line tabs.
</Caption>

tw15egan marked this conversation as resolved.
Show resolved Hide resolved
<div className="image--fixed">

![Examples of selected close hover, selected focus, and disabled states for dismissible line tabs](images/tab-style-11b.png)

</div>

<Caption>
Examples of unselected close hover, unselected hover, unselected focus, and
disabled states for dismissible line tabs.
</Caption>

### Contained tabs

| Type | Element | Property | Color token |
Expand Down Expand Up @@ -110,7 +186,7 @@ tabs: ['Usage', 'Style', 'Code', 'Accessibility']

<br />

#### Interactive states
#### Interactive state color

<br />

Expand Down Expand Up @@ -167,6 +243,85 @@ tabs.](images/tab-style-5.png)
tabs.
</Caption>

### Dismissible contained tabs

| Type | Element | Property | Color token |
| ---------- | ---------------- | ---------------- | --------------------- |
| Unselected | Tab | background-color | `$layer-accent` \* |
| | | border-right | `$border-strong` \* |
| | Label | text-color | `$text-secondary` |
| | Icon | svg | `$icon-secondary` |
| | Dismissible icon | svg | `$icon-secondary` |
| Selected | Tab | background-color | `$layer` \* |
| | | border-top | `$border-interactive` |
| | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | Dismissible icon | svg | `$icon-primary` |

<Caption>
* Denotes a contextual color token that will change values based on the layer
it is placed on.
</Caption>

<div className="image--fixed">

![Examples of selected and unselected dismissible contained tabs](images/tab-style-10.png)

</div>

<Caption>
Examples of selected and unselected dismissible contained tabs.
</Caption>

<br />

#### Interactive state color

<br />

| State | Element | Property | Color token |
| -------- | ---------------------------- | ---------------- | ------------------------ |
| Hover | Tab | background-color | `$layer-accent-hover` \* |
| | Label | text-color | `$text-primary` |
| | Icon | svg | `$icon-primary` |
| | Dismissible icon | svg | `$icon-primary` |
| | Selected: dismissible icon | background-color | `$layer-hover` \* |
| | Unselected: dismissible icon | background-color | `$layer-accent-hover` \* |
| Focus | Tab | border | `$focus` |
| Disabled | Label | text-color | `$text-disabled` |
| | Icon | svg | `$icon-disabled` |
| | Tab | background-color | `$button-disabled` |
| | | border-right | `$border-disabled` |

<Caption>
* Denotes a contextual color token that will change values based on the layer
it is placed on.
</Caption>

<div className="image--fixed">

![Unselected hover, unselected close hover, unselected focus, and disabled states for dismissible contained
tabs.](images/tab-style-12a.png)

</div>

<Caption>
Examples of unselected hover, unselected close hover, unselected focus, and
disabled states for dismissible contained tabs.
</Caption>

<div className="image--fixed">

![Selected close hover, selected focus, and disabled states for dismissible contained
tabs.](images/tab-style-12b.png)

</div>

<Caption>
Examples of selected close hover, selected focus, and disabled states for
dismissible contained tabs.
</Caption>

## Typography

Tab labels should be set in sentence case, and should not exceed three words.
Expand Down Expand Up @@ -224,6 +379,36 @@ Tab labels should be set in sentence case, and should not exceed three words.
Structure and spacing measurements for icon-only line tabs | px / rem
</Caption>

### Dismissible line tabs

| Element | Property | px / rem | Spacing token |
| ---------------- | --------------------------- | ---------- | ------------- |
| Tab | height | 40 / 2.5 | – |
| | 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` |
| Dismissible icon | padding-right | 16 / 1 | `$spacing-05` |
| | padding-left | 8 / 0.5 | `$spacing-03` |
| | svg | 16 x 16 | – |
| Icon | padding-right | 8 / 0.5 | `$spacing-03` |
| | padding-left | 16 / 1 | `$spacing-05` |
| | svg | 16 x 16 | – |

<div className="image--fixed">

![Structure and spacing measurements for dismissible line tabs without icons (top) and with icons (bottom).](images/tab-style-13.png)

</div>

<Caption>
Structure and spacing measurements for line tabs without icons (top) and with
icons (bottom) | px / rem
</Caption>

<br />

### Contained tabs

| Element | Property | px / rem | Spacing token |
Expand Down Expand Up @@ -270,3 +455,30 @@ Tab labels should be set in sentence case, and should not exceed three words.
<Caption>
Structure and spacing measurements for icon-only contained tabs | px / rem
</Caption>

### Dismissible 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` |
| Dismissible icon | padding-right | 16 / 1 | `$spacing-05` |
| | padding-left | 8 / .5 | `$spacing-03` |
| | svg | 16 x 16 | – |
| Icon | padding-right | 8 / .5 | `$spacing-03` |
| | padding-left | 16 / 1 | `$spacing-05` |
| | svg | 16 x 16 | – |
| Tab | border-right | 1px | – |

<div className="image--fixed">

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

</div>

<Caption>
Structure and spacing measurements for dismissible contained tabs without
icons (top) and with icons (bottom)| px / rem
</Caption>
65 changes: 65 additions & 0 deletions src/pages/components/tabs/usage.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -451,6 +451,71 @@ secondary labels with line tabs or auto-width contained tabs.
</Column>
</Row>

### Dismissible tabs

Dismissible tabs allow users to close tabs providing a focused and relevant
experience. Users can add or remove tabs as needed, accommodating future content
additions or modifications without drastically changing the overall layout or
structure.

<Row>
<Column colLg={8}>

![Dismissible tabs](images/tabs-usage-15.png)

</Column>
</Row>

<Caption>
Example of dismissible line tabs (top) and dismissible contained tabs (bottom)
</Caption>

#### When to use

- Use dismissible tabs to offer flexibility and scalability in complex
interfaces that require users to create multiple sections or modules.
- Use dismissible tabs content created or curated by the user.
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved
- Use to focus a specific data set or search results.

#### When not to use

- Do not use when tabs contain frequently used or critical information
- Do not use as navigation
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved

#### Considerations
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved

Carbon provides an option to include icons within the dismissible tabs. Only use
icons within dismissible tabs if all tabs will include icons. Do not mix
dismisible tabs without icons with dismissible tabs with icons.

There are various ways to trigger a new tab. The trigger button can visually
change its shape and size depending on the use case. Keep the trigger close to
kingtraceyj marked this conversation as resolved.
Show resolved Hide resolved
enough to the new tab to associate the add action with the new tab item. The
order of tabs can be ascending or descending depending on use case but do keep
them in a sequential, logical order.

When dismissing a tab, an inline warning or modal may be used when information
contained in a tab will no longer be accessible or difficult to retrieve. Since
warnings, especially modals, are highly disruptive, only use when the dismissal
causes errors, unintentional deletions, or unsaved changes.

If all tabs are dismissible, make sure a user understands how to trigger new
tabs once the tabs are gone. Provide visual cues, such as a container or
placeholder tab, so the user clearly understands that the trigger button is
creating a new tab in a place they expect.

<Row>
<Column colLg={8}>

![Dismissible tabs](images/tabs-usage-16.png)
francinelucca marked this conversation as resolved.
Show resolved Hide resolved

</Column>
</Row>

<Caption>
Example of dismissible tabs within a UI utilizing a button to add a tab
</Caption>

## Related

#### Content switcher versus tabs
Expand Down