Skip to the page

MCSS-Lite 0.4.1

GitHub

Label c-label

DeprecatedComponent · since 0.1.0

Warning: This part was replaced

Use c-form-field__label in new code. c-label keeps working until 1.0.

Pick this part

Existing markup only

  • Never in new code. Existing c-label markup keeps working until 1.0.

Pick another part for

  • Labelling any form control: use c-form-field with c-form-field__label.

Build it

  1. Build c-form-field__label instead: this part only exists so older pages keep working.
  2. Replace class="c-label" in existing markup when you next touch it. mcss-lite validate flags every use with [deprecated].
Show markup 4 lines
<div class="c-form-field">
  <label class="c-form-field__label" for="name">Name</label>
  <input class="c-input" id="name">
</div>

Check your build

Each piece that doesn't fit was run through mcss-lite validate when this page was built. The output below is real.

Fits

Use the form-field label.

Show markup 4 lines
<div class="c-form-field">
  <label class="c-form-field__label" for="name">Name</label>
  <input class="c-input" id="name">
</div>

validate: 0 issues

Doesn't fit

Don't use the deprecated block.

<label class="c-label" for="name2">Name</label>

validate

  • warning "c-label" is deprecated. Use "c-form-field__label". [deprecated]

Spec sheet

Apply to <label>

Tokens
TokenValue (light / dark)
--color-text-muted#343a40 / #cfdae5

Fits with