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

v4: Rename .label class to .tag #19157

Merged
merged 2 commits into from
Feb 17, 2016
Merged
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
46 changes: 0 additions & 46 deletions docs/components/label.md

This file was deleted.

10 changes: 5 additions & 5 deletions docs/components/list-group.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,22 +24,22 @@ The most basic list group is simply an unordered list with list items, and the p
</ul>
{% endexample %}

## Labels
## Tags

Add labels to any list group item to show unread counts, activity, etc.
Add tags to any list group item to show unread counts, activity, etc.

{% example html %}
<ul class="list-group">
<li class="list-group-item">
<span class="label label-default label-pill pull-xs-right">14</span>
<span class="tag tag-default tag-pill pull-xs-right">14</span>
Cras justo odio
</li>
<li class="list-group-item">
<span class="label label-default label-pill pull-xs-right">2</span>
<span class="tag tag-default tag-pill pull-xs-right">2</span>
Dapibus ac facilisis in
</li>
<li class="list-group-item">
<span class="label label-default label-pill pull-xs-right">1</span>
<span class="tag tag-default tag-pill pull-xs-right">1</span>
Morbi leo risus
</li>
</ul>
Expand Down
46 changes: 46 additions & 0 deletions docs/components/tag.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
---
layout: docs
title: Tags
group: components
---

Small and adaptive tag for adding context to just about any content.

## Example

Tags scale to match the size of the immediate parent element by using relative font sizing and `em` units.

{% example html %}
<h1>Example heading <span class="tag tag-default">New</span></h1>
<h2>Example heading <span class="tag tag-default">New</span></h2>
<h3>Example heading <span class="tag tag-default">New</span></h3>
<h4>Example heading <span class="tag tag-default">New</span></h4>
<h5>Example heading <span class="tag tag-default">New</span></h5>
<h6>Example heading <span class="tag tag-default">New</span></h6>
{% endexample %}

## Contextual variations

Add any of the below mentioned modifier classes to change the appearance of a tag.

{% example html %}
<span class="tag tag-default">Default</span>
<span class="tag tag-primary">Primary</span>
<span class="tag tag-success">Success</span>
<span class="tag tag-info">Info</span>
<span class="tag tag-warning">Warning</span>
<span class="tag tag-danger">Danger</span>
{% endexample %}

## Pill tags

Use the `.tag-pill` modifier class to make tags more rounded (with a larger `border-radius` and additional horizontal `padding`). Useful if you miss the badges from v3.

{% example html %}
<span class="tag tag-pill tag-default">Default</span>
<span class="tag tag-pill tag-primary">Primary</span>
<span class="tag tag-pill tag-success">Success</span>
<span class="tag tag-pill tag-info">Info</span>
<span class="tag tag-pill tag-warning">Warning</span>
<span class="tag tag-pill tag-danger">Danger</span>
{% endexample %}
2 changes: 1 addition & 1 deletion docs/migration.md
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ New to Bootstrap 4 is the Reboot, a new stylesheet that builds on Normalize with

### Badges

- Dropped the badge component. Use the `.label-pill` modifier together with the label component instead.
- Dropped the badge component. Use the `.tag-pill` modifier together with the tag component instead.

### Panels, thumbnails, and wells

Expand Down
2 changes: 1 addition & 1 deletion scss/_mixins.scss
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
@import "mixins/breakpoints";
@import "mixins/hover";
@import "mixins/image";
@import "mixins/label";
@import "mixins/tag";
@import "mixins/reset-filter";
@import "mixins/resize";
@import "mixins/screen-reader";
Expand Down
2 changes: 1 addition & 1 deletion scss/_print.scss
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
border-top-color: #000 !important;
}
}
.label {
.tag {
border: $border-width solid #000;
}

Expand Down
38 changes: 19 additions & 19 deletions scss/_labels.scss → scss/_tags.scss
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,13 @@
// Requires one of the contextual, color modifier classes for `color` and
// `background-color`.

.label {
.tag {
display: inline-block;
padding: .25em .4em;
font-size: 75%;
font-weight: $label-font-weight;
font-weight: $tag-font-weight;
line-height: 1;
color: $label-color;
color: $tag-color;
text-align: center;
white-space: nowrap;
vertical-align: baseline;
Expand All @@ -22,16 +22,16 @@
}

// Quick fix for labels in buttons
.btn .label {
.btn .tag {
position: relative;
top: -1px;
}

// scss-lint:disable QualifyingElement
// Add hover effects, but only for links
a.label {
a.tag {
@include hover-focus {
color: $label-link-hover-color;
color: $tag-link-hover-color;
text-decoration: none;
cursor: pointer;
}
Expand All @@ -42,7 +42,7 @@ a.label {
//
// Make them extra rounded with a modifier to replace v3's badges.

.label-pill {
.tag-pill {
padding-right: .6em;
padding-left: .6em;
// Use a higher than normal value to ensure completely rounded edges when
Expand All @@ -54,26 +54,26 @@ a.label {
//
// Contextual variations (linked labels get darker on :hover).

.label-default {
@include label-variant($label-default-bg);
.tag-default {
@include tag-variant($tag-default-bg);
}

.label-primary {
@include label-variant($label-primary-bg);
.tag-primary {
@include tag-variant($tag-primary-bg);
}

.label-success {
@include label-variant($label-success-bg);
.tag-success {
@include tag-variant($tag-success-bg);
}

.label-info {
@include label-variant($label-info-bg);
.tag-info {
@include tag-variant($tag-info-bg);
}

.label-warning {
@include label-variant($label-warning-bg);
.tag-warning {
@include tag-variant($tag-warning-bg);
}

.label-danger {
@include label-variant($label-danger-bg);
.tag-danger {
@include tag-variant($tag-danger-bg);
}
24 changes: 12 additions & 12 deletions scss/_variables.scss
Original file line number Diff line number Diff line change
Expand Up @@ -607,18 +607,18 @@ $popover-arrow-outer-width: ($popover-arrow-width + 1px) !default;
$popover-arrow-outer-color: fade-in($popover-border-color, .05) !default;


// Labels

$label-default-bg: $gray-light !default;
$label-primary-bg: $brand-primary !default;
$label-success-bg: $brand-success !default;
$label-info-bg: $brand-info !default;
$label-warning-bg: $brand-warning !default;
$label-danger-bg: $brand-danger !default;

$label-color: #fff !default;
$label-link-hover-color: #fff !default;
$label-font-weight: bold !default;
// Tags

$tag-default-bg: $gray-light !default;
$tag-primary-bg: $brand-primary !default;
$tag-success-bg: $brand-success !default;
$tag-info-bg: $brand-info !default;
$tag-warning-bg: $brand-warning !default;
$tag-danger-bg: $brand-danger !default;

$tag-color: #fff !default;
$tag-link-hover-color: #fff !default;
$tag-font-weight: bold !default;


// Modals
Expand Down
2 changes: 1 addition & 1 deletion scss/bootstrap.scss
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
@import "card";
@import "breadcrumb";
@import "pagination";
@import "labels";
@import "tags";
@import "jumbotron";
@import "alert";
@import "progress";
Expand Down
4 changes: 2 additions & 2 deletions scss/mixins/_label.scss → scss/mixins/_tag.scss
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
// Labels
// Tags

@mixin label-variant($color) {
@mixin tag-variant($color) {
background-color: $color;

&[href] {
Expand Down