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: update tag docs with interactive tags #3912

Merged
Merged
Show file tree
Hide file tree
Changes from 22 commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
bb4f4bc
update usage.mdx
laurenmrice Feb 13, 2024
59b845a
update and add usage images
laurenmrice Feb 13, 2024
1f2cc1f
update
laurenmrice Feb 13, 2024
28b932a
update style tab
laurenmrice Feb 24, 2024
b96ea05
update usage tab
laurenmrice Feb 24, 2024
a2bbedf
update usage tab and images
laurenmrice Feb 24, 2024
3622f2b
update style
laurenmrice Feb 24, 2024
2342afa
chore: merge conflicts
alisonjoseph Feb 28, 2024
1bbcf48
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
cd80730
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
d0ccb1e
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
b8ff3cc
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
0a06e13
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
18aa833
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
8989851
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
22b90b2
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
6930987
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
d148a5e
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
1eaf30e
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
0524222
Update src/pages/components/tag/style.mdx
laurenmrice Feb 28, 2024
a0c14b7
Merge branch 'main' into interactive-tags-doc-update
laurenmrice Mar 1, 2024
5fab87d
update images
laurenmrice Mar 5, 2024
bb9f43c
update usage.mdx
laurenmrice Mar 5, 2024
5e28c5b
update style.mdx
laurenmrice Mar 5, 2024
272b20d
add notification
laurenmrice Mar 5, 2024
bfac937
update notification
laurenmrice Mar 5, 2024
a7270ae
update usage.mdx from review
laurenmrice Mar 6, 2024
368d8ca
update style.mdx from review
laurenmrice Mar 6, 2024
7100d15
update typos
laurenmrice Mar 6, 2024
aaa9f70
Merge branch 'main' into interactive-tags-doc-update
laurenmrice Mar 6, 2024
117256c
update structure section
laurenmrice Mar 6, 2024
bdde041
Merge branch 'interactive-tags-doc-update' of https://github.com/laur…
laurenmrice Mar 6, 2024
5e45264
fix size image
laurenmrice Mar 6, 2024
21f0bff
image bug
laurenmrice Mar 6, 2024
49a35be
fix style issue
laurenmrice Mar 6, 2024
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.
Binary file modified src/pages/components/tag/images/tag-style-size.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.
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.
296 changes: 235 additions & 61 deletions src/pages/components/tag/style.mdx
Original file line number Diff line number Diff line change
@@ -1,75 +1,214 @@
---
title: Tag
description:
Tags are used for items that need to be labeled, categorized, or organized
using keywords that describe them.
The following page documents visual specifications such as color, typography,
structure, and size.
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>

</AnchorLinks>

## Color

Tag uses component level tokens and values from the IBM Design Language
[color palette](https://www.ibm.com/design/language/elements/color). In the
light themes tags use color step 20 for the background and step 70 for the text.
In the dark themes, tags use color step 70 for the background and step 20 for
the text. For the list of token values, see
[Carbon repo](https://github.com/carbon-design-system/carbon/blob/main/packages/themes/src/component-tokens/tag/tokens.js).

| Tag color | Color token |
| ------------- | --------------------------- |
| Default | `$tag-background-gray` |
| | `$tag-color-gray` |
| | `$tag-hover-gray` |
| Red | `$tag-background-red` |
| | `$tag-color-red` |
| | `$tag-hover-red` |
| Magenta | `$tag-background-magenta` |
| | `$tag-color-magenta` |
| | `$tag-hover-magenta` |
| Purple | `$tag-background-purple` |
| | `$tag-color-purple` |
| | `$tag-hover-purple` |
| Blue | `$tag-background-blue` |
| | `$tag-color-blue` |
| | `$tag-hover-blue` |
| Cyan | `$tag-background-cyan` |
| | `$tag-color-cyan` |
| | `$tag-hover-cyan` |
| Teal | `$tag-background-teal` |
| | `$tag-color-teal` |
| | `$tag-hover-teal` |
| Green | `$tag-background-green` |
| | `$tag-color-green` |
| | `$tag-hover-green` |
| Gray | `$tag-background-gray` |
| | `$tag-color-gray` |
| | `$tag-hover-gray` |
| Cool gray | `$tag-background-cool-gray` |
| | `$tag-color-cool-gray` |
| | `$tag-hover-cool-gray` |
| Warm gray | `$tag-background-warm-gray` |
| | `$tag-color-warm-gray` |
| | `$tag-hover-warm-gray` |
| High contrast | `$background-inverse` |
| | `$text-inverse` |
Read-only, dismissible, and operational tag variants of tag use component tokens
with values from the IBM Design Language
[color palette](https://www.ibm.com/design/language/color). Light themes use
step 70 for text and icons, step 40 for borders, and step 20 for backgrounds.
Dark themes use step 20 for text and icons, step 50 for borders, and step 70 for
backgrounds. The only exception where
[core tokens](https://carbondesignsystem.com/elements/color/overview/#core-tokens)
are used are in high contrast and outline styles.

The selectable tag variant only uses core tokens and does not use component
tokens.

| Variant | Color | Element | Property | Color token |
| --------------- | ------------- | ---------- | ---------------- | ------------------------------ |
| Read-only tag | All colors | Text | text-color | See all component color tokens |
| | | Icon | icon-color | See all component color tokens |
| | | Background | background-color | See all component color tokens |
| | High contrast | Text | text-color | `$text-inverse` |
| | | Icon | icon-color | `$icon-color` |
| | | Border | border | `$border-inverse` |
| | | Background | background-color | `$background-inverse` |
| | Outline | Text | text-color | `$text-primary` |
| | | Icon | icon-color | `$icon-primary` |
| | | Border | border | `$border-inverse` |
| | | Background | background-color | `$background` |
| Dismissible tag | All colors | Text | text-color | See all component color tokens |
| | | Icon | icon-color | See all component color tokens |
| | | Background | background-color | See all component color tokens |
| | High contrast | Text | text-color | `$text-inverse` |
| | | Icon | icon-color | `$icon-color` |
| | | Border | border | `$border-inverse` |
| | | Background | background-color | `$background-inverse` |
| | Outline | Text | text-color | `$text-primary` |
| | | Icon | icon-color | `$icon-primary` |
| | | Border | border | `$border-inverse` |
| | | Background | background-color | `$background` |
| Operational tag | All colors | Text | text-color | See all component color tokens |
| | | Icon | icon-color | See all component color tokens |
| | | Border | border | See all component color tokens |
| | | Background | background-color | See all component color tokens |
| Selectable tag | | Text | text-color | `$text-primary` |
| | | Icon | icon-color | `$icon-primary` |
| | | Border | border | `$border-inverse` |
| | | Background | background-color | `$layer` \* |

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

<Row>
<Column colLg={8}>

![Read-only tag colors.](images/tag-style-color-read-only.png)

</Column>
</Row>

<Caption>Read-only tag colors</Caption>

<Row>
<Column colLg={8}>

![Dismissible tag colors.](images/tag-style-color-dismissible.png)

</Column>
</Row>

<Caption>Dismissible tag colors</Caption>

<Row>
<Column colLg={8}>

![Operational tag colors.](images/tag-style-color-operational.png)

</Column>
</Row>

<Caption>Operational tag colors</Caption>

<Row>
<Column colLg={8}>

![Selectable tag color.](images/tag-style-color-selectable.png)

</Column>
</Row>

<Caption>Selectable tag color</Caption>

### Interactive state color

Read-only tag variants do not have interactive state colors because they do not
have interactive functionality.

Dismissible and operational tag variants use component tokens for hover states.
They use core tokens for focus and disabled states.

The selectable tag variant only uses core tokens and does not use component
tokens.

| Variant | Color | State | Element | Property | Color token |
| --------------- | ------------- | -------- | ---------- | ---------------- | ------------------------------ |
| Dismissible tag | All colors | Hover | Background | background-color | See all component color tokens |
| | | Focus | Border | border | `$focus` |
| | | Disabled | Text | text-color | `$text-disabled` |
| | | | Background | background-color | `$layer` \* |
| | High contrast | Hover | Background | background-color | `$background-hover` |
| | | Focus | Border | border | `$focus` |
| | | Disabled | Text | text-color | `$text-disabled` |
| | | | Background | background-color | `$layer` \* |
| | Outline | Hover | Background | background-color | `$background-hover` |
| | | Focus | Border | border | `$focus` |
| | | Disabled | Text | text-color | `$text-disabled` |
| | | | Border | border | `$border-disabled` |
| | | | Background | background-color | `$background-disabled` |
| Operational tag | All colors | Hover | Background | background-color | See all component color tokens |
| | | Focus | Border | border | `$focus` |
| | | Disabled | Text | text-color | `$text-disabled` |
| | | | Border | border | `$border-disabled` |
| | | | Background | background-color | `$layer` \* |
| Selectable tag | | Hover | Background | background-color | `$layer-hover` \* |
| | | Focus | Border | border | `$focus` |
| | | Disabled | Text | text-color | `$text-disabled` |
| | | | Border | border | `$border-disabled` |
| | | | Background | background-color | `$layer` \* |

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

<Row>
<Column colLg={8}>

![Dismissible tag interactive colors.](images/tag-style-interactive-color-dismissible.png)

</Column>
</Row>

<Caption>Dismissible tag interactive colors</Caption>

<Row>
<Column colLg={8}>

![Operational tag interactive colors.](images/tag-style-interactive-color-operational.png)

</Column>
</Row>

<Caption>Operational tag interactive colors</Caption>

<Row>
<Column colLg={8}>

![Selectable tag interactive colors.](images/tag-style-interactive-color-selectable.png)

</Column>
</Row>

<Caption>Selectable tag interactive colors</Caption>

## Typography

Tag labels should be set in sentence case, and should only have one word.
However, if more than one is necessary, then connect the words using a hyphen
with no spaces.
Tag titles should be concise and describe the tag in a few words or be under 20
characters when possible. Only include long title content in tags when
necessary, for instance, for user-defined names or system-generated strings of
text.

| Element | Font-size (px/rem) | Font-weight | Type token |
| Element | Font size (px/rem) | Font weight | Type token |
| ------- | ------------------ | ------------- | ----------- |
| Label | 12 / 0.75 | Regular / 400 | `$label-01` |
| Title | 12 / 0.75 | Regular / 400 | `$label-01` |

## Structure

All tags have the same height. However, the width of tags varies based on the
amount of content. All four corners of a tag are rounded with a 24px radius.
There are three fixed heights of tags—large (32px), medium (24px), and small
(18px). However, the width of tags can vary based on the length of the title.

| Element | Property | px / rem | Spacing token |
| -------- | --------------------------- | ---------- | ------------- |
| Tag (lg) | height | 32 / 2 | – |
laurenmrice marked this conversation as resolved.
Show resolved Hide resolved
| | radius | 24px | – |
laurenmrice marked this conversation as resolved.
Show resolved Hide resolved
| | margin | 8 / 0.5 | `$spacing-03` |
| | padding-left, padding-right | 12 / .75 | `$spacing-04` |
| Tag (md) | height | 24 / 1.5 | – |
| | radius | 12px | – |
laurenmrice marked this conversation as resolved.
Show resolved Hide resolved
| | margin | 8 / 0.5 | `$spacing-03` |
Expand All @@ -81,23 +220,58 @@ amount of content. All four corners of a tag are rounded with a 24px radius.

<div className="image--fixed">

![Structure and spacing measurements](images/tag-style-1.png)
![Structure and spacing measurements of read-only tag | px / rem.](images/tag-style-structure-read-only.png)

</div>

<Caption>Structure and spacing measurements for a tag | px / rem</Caption>
<Caption>
Structure and spacing measurements of read-only tag | px / rem.
</Caption>

<div className="image--fixed">

![Structure and spacing measurements of dismissible tag | px / rem.](images/tag-style-structure-dismissible.png)

</div>

<Caption>
Structure and spacing measurements of dismissible tag | px / rem.
</Caption>

<div className="image--fixed">

![Structure and spacing measurements of operational tag | px / rem.](images/tag-style-structure-operational.png)

</div>

<Caption>
Structure and spacing measurements of operational tag | px / rem.
</Caption>

<div className="image--fixed">

![Structure and spacing measurements of selectable tag | px / rem.](images/tag-style-structure-selectable.png)

</div>

<Caption>
Structure and spacing measurements of selectable tag | px / rem.
</Caption>

## Size

## Sizes
There are three tag sizes — small, medium, and large.

| Size | Height px / rem |
| ------ | --------------- |
| Small | 18px / 1.125 |
| Medium | 24 / 1.5 |
| Element | Size | Height (px/rem) |
| --------- | ----------- | --------------- |
| Container | Small (sm) | 18 / 1.125 |
| | Medium (md) | 24 / 1.5 |
| | Large (lg) | 32 / 2 |

<div className="image--fixed">

![Sizes for tag](images/tag-style-size.png)

</div>

<Caption>Tag sizes | px / rem</Caption>
<Caption>Large, medium, and small sizes of tag</Caption>
Loading
Loading