Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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
Next Next commit
Add Progress-item
  • Loading branch information
simurai committed May 19, 2020
commit 9016e3cf6168e35a72cd8fec2427a77eefa77234
14 changes: 9 additions & 5 deletions docs/content/components/progress.md
Original file line number Diff line number Diff line change
Expand Up @@ -59,14 +59,18 @@ In cases where it's not possible to describe the progress in text, provide an `a

## Progress with multiple values

To show the progress of tasks in multiple states (such as "done", "in progress", and "open"), use distinct background color utilities and give each one a percentage width proportional to the total number. Children are stacked from left to right, so if your widths add up to 100%, your bars will too.
To show the progress of tasks in multiple states (such as "done", "in progress", and "open"), add the `Progress-item` class and a distinct background color utility. Then give each one a percentage width proportional to the total number. Children are stacked from left to right, so if your widths add up to 100%, your bars will too.

```html live
<div class="tooltipped tooltipped-n" aria-label="tasks: 80 done, 14 in progress, 6 open">
<span class="Progress">
<span class="bg-green" style="width: 80%;"></span>
<span class="bg-purple" style="width: 14%;"></span>
<span class="bg-red" style="width: 6%;"></span>
<span class="Progress" style="width: 100px;">
<span class="Progress-item bg-green" style="width: 50%;"></span>
<span class="Progress-item bg-purple" style="width: 25%;"></span>
<span class="Progress-item bg-pink" style="width: 15%;"></span>
<span class="Progress-item bg-red" style="width: 8%;"></span>
<span class="Progress-item bg-blue" style="width: 2%;"></span>
</span>
</div>
```

Note that items with very low percentage values will still show with a minimum width of `2px`.
6 changes: 6 additions & 0 deletions src/progress/progress.scss
Original file line number Diff line number Diff line change
Expand Up @@ -16,3 +16,9 @@
.Progress--small {
height: 5px;
}

.Progress-item + .Progress-item {
min-width: 2px;
// stylelint-disable-next-line primer/spacing
margin-left: 2px;
}
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I like how simple this solution is. If only we could do flex gap now. 😩