Labels for content classification, to emphasise a value, or highlight a status.
Check out how to include Origami components in your project to get started with o-labels
.
There are three types of label:
The standard label is used for content classification or to emphasise a value. For example to highlight commercial or premium content for the core brand, or to highlight a service tier in internal products. Custom labels may be created.
This table outlines the possible standard label sizes.
This table outlines the possible standard label states. Custom states may also be created.
The indicator label is used to show story status with new, updated, and live variants. The indicator label only supports the core brand but internal brand support is under consideration.
This table outlines the possible indicator label statuses:
E.g. for a live label:
<span class="o-labels-indicator o-labels-indicator--live">
<span class="o-labels-indicator__status">live</span>
</span>
The live and closed labels also support a more prominent badge variant:
<span
class="o-labels-indicator o-labels-indicator--live o-labels-indicator--inverse o-labels-indicator--badge"
>
<span class="o-labels-indicator__status">live</span>
</span>
The timestamp label is used to show article status in place of an indicator label when the article is not new, updated, or live. The timestamp label only supports the core brand.
The most minimal markup for a standard label is as follows:
<span class="o-labels">Label</span>
Standard labels are displayed inline so including the above markup in a paragraph, for example, will make it sit alongside the text.
There are several size modifier classes which can be used to change the general appearance of a standard label:
<span class="o-labels o-labels--big">Big Label</span>
<span class="o-labels o-labels--small">Small Label</span>
Labels can also have one of several states. The available states depend on which brand you are using (there are no states for whitelabel branded components):
The following core brand states are used to categorise content, mostly on FT.com:
<span class="o-labels o-labels--content-commercial">Paid Post</span> (used for paid post and promoted content)
<span class="o-labels o-labels--content-premium">Premium</span> (used for premium-only content)
The following state is used to indicate that a feature is in a beta state:
<span class="o-labels o-labels--lifecycle-beta">Beta</span>
The following internal brand states are used to represent the different support levels of Origami components:
<span class="o-labels o-labels--support-active">Active</span>
<span class="o-labels o-labels--support-maintained">Maintained</span>
<span class="o-labels o-labels--support-experimental">Experimental</span>
<span class="o-labels o-labels--support-deprecated">Deprecated</span>
<span class="o-labels o-labels--support-dead">Dead</span>
The following internal brand states are used to represent the FT's service tiers:
<span class="o-labels o-labels--support-platinum">Platinum</span>
<span class="o-labels o-labels--support-gold">Gold</span>
<span class="o-labels o-labels--support-silver">Silver</span>
<span class="o-labels o-labels--support-bronze">Bronze</span>
The internal brand may also use colour palette based states, these do not specify a particular usecase for flexibility:
<span class="o-labels o-labels--oxford">oxford</span>
<span class="o-labels o-labels--teal">teal</span>
<span class="o-labels o-labels--lemon">lemon</span>
<span class="o-labels o-labels--slate">slate</span>
<span class="o-labels o-labels--jade">jade</span>
<span class="o-labels o-labels--crimson">crimson</span>
<span class="o-labels o-labels--mandarin">mandarin</span>
Indicator labels have one of three statuses:
live
closed
updated
new
Use the following markup for a live label:
<span class="o-labels-indicator o-labels-indicator--live">
<span class="o-labels-indicator__status">
live
</span>
</span>
Use the modifier class o-labels-indicator--closed
for a closed label:
<span class="o-labels-indicator o-labels-indicator--closed">
<span class="o-labels-indicator__status">
closed
</span>
</span>
For an updated or new label use the associated modifier class, e.g. o-labels-indicator--updated
, and add a child element o-labels-indicator__timestamp
to show the new/updated time. We recommend using o-date to format the timestamp element.
<span class="o-labels-indicator o-labels-indicator--new">
<span class="o-labels-indicator__status">
new
</span>
<span class="o-labels-indicator__timestamp">
<!-- demo `time` element only (the datetime is not 1 hour ago) -->
<time datetime="2020-07-09T12:52:33+0000" title="July 9 2020 1:52 pm">1 hour ago</time>
</span>
</span>
Indicator labels also support an inverse theme for use on dark backgrounds. To use an inverse theme add the o-labels-indicator--inverse
class to your markup.
-<span class="o-labels-indicator o-labels-indicator--live">
+<span class="o-labels-indicator o-labels-indicator--live o-labels-indicator--inverse">
<span class="o-labels-indicator__status">
live
</span>
</span>
To include a timestamp label use the following markup. Note the timestamp label also supports an optional inverse variant for dark background with the o-labels-timestamp--inverse
class:
<span class="o-labels-timestamp o-labels-timestamp--inverse">
<!-- demo `time` element only -->
<time datetime="2016-02-29T12:35:48Z" title="February 29 2016 12:35 pm">February 29 2016</time>
</span>
As with the indicator label, we recommend using o-date to format the timestamp element.
Output all label styles with the oLabels
mixin:
@include oLabels();
Or pass an options map $opts
argument to output just the label styles you need. Options include:
@include oLabels($opts: (
// standard label sizes to output
// e.g. .o-labels--big
'sizes': ('big'),
// standard label states to output
// e.g. .o-labels--content-commercial
'states': (
'content-commercial',
'content-premium'
),
// indicator label labels to output
// .o-labels-indicator
'indicators': (
// indicator label statuses to output
// .o-labels-indicator--live
'status': ('live'),
// whether to output the indicator label inverse style
// .o-labels-indicator--inverse
'inverse': true,
),
// output the timestamp label label
// .o-labels-timestamp
'timestamp': (
// whether to output the timestamp label inverse style
// .o-labels-timestamp--inverse
'inverse': true
)
));
Use oLabelsAddState
mixin to add a custom label state for the standard label. See the oLabelsAddState
SassDoc for more details.
// outputs a class .o-labels--citrus-fruit
@include oLabelsAddState('citrus-fruit', (
background-color: oColorsByName('lemon')
));
When it's not possible to use an o-labels
CSS class, for example within another Origami component, use:
oLabelsContent
to output a standard label with a custom class.oLabelsIndicatorContent
to output an indicator label with a custom class.oLabelsTimestampContent
to output a timestamp label with a custom class.If it is possible to use o-labels
classes we recommend oLabels and oLabelsAddStates instead. Using these will help reduce the size of your CSS bundle where multiple labels are used.
oLabelsContent
accepts an $opts
argument which is a map of options. To output styles required by all labels set "base" to "true". Then set the labels "sizes" and its "state". Any of these options may be output independently.
To output an existing label:
.o-example-my-label {
@include oLabelsContent($opts: (
'base': true,
'size': 'big',
'state': 'tier-gold'
));
}
To output a custom label:
.o-example-my-custom-label {
@include oLabelsContent($opts: (
'base': true,
'size': 'big',
'state': (
'background-color': oColorsByName('lemon')
)
));
}
As styles for the indicator label apply to multiple html elements, the oLabelsIndicatorContent
accepts an $opts
argument to output styles for each element separately.
// equivalent to .o-labels-indicator
.my-indicator-label {
@include oLabelsIndicatorContent($opts: ('block': true));
}
// equivalent to .o-labels-indicator--live
.my-indicator-label--live {
@include oLabelsIndicatorContent($opts: ('block': true, 'modifier': 'live'));
}
// equivalent to .o-labels-indicator__status
.my-indicator-label__status {
@include oLabelsIndicatorContent($opts: ('element': 'status'));
}
// equivalent to .o-labels-indicator__timestamp
.my-indicator-label__timestamp {
@include oLabelsIndicatorContent($opts: ('element': 'timestamp'));
}
If you have any questions or comments about this component, or need help using it, please either raise an issue, visit #origami-support or email Origami Support.
This software is published by the Financial Times under the MIT licence.