Skip to content

Machine-translated – improvements welcome. Suggest an improvement

Tag

Etikett is a plain label: kind, link kind, state such as “Warning”, “Note”, “from package” (#1289). Small text, at most a light background, no border, squarer than a button and not clickable. It follows principle 8: a border means “button”. Whatever can be clicked is a button or a KnopfLink, never a tag.

What it is for

For a short feature of an entry: kind (“Required”), state (“active now”, “earlier key”) or a chosen entry with ✕ (pattern catalogue A1). The package chip shows the origin from a package; it looks like a tag. Numbers in the navigation are shown by the Number.

Matching patterns in the pattern catalogue: A1 · Choosing folders, people, organisations = like a reference field, C14 · Kinds of buttons: fixed, the same everywhere, D4 · Show state without changing data.

How to use it

With How it works
Mouse A tag cannot be clicked. A tooltip (title) appears on hover. For a chosen entry only the ✕ is a button: a click takes the entry out.
Keyboard A tag is not a Tab stop. The ✕ of a chosen entry can be reached and is triggered with Enter or Space.
Touch Only the ✕ is a touch target.

What it means

The colour tells the person how to read the feature – the background is light, the text carries the colour:

Kind Colour Meaning
leise (default) grey a neutral feature (“Required”, a link kind)
info accent (blue) a note
gut green something is fine or active
warn yellow attention, but not an error
schlecht red something is broken or expired

A coloured dot (punkt) in front shows a state like a traffic light. No border, no click – so nobody mistakes a tag for a button.

Rules:

  • No border, no click. A label that leads to a page is a KnopfLink art="link" (“You are away” in the user menu); one that does something is a Knopf.
  • The package chip shows the origin from a package; it looks like a tag.
  • Surroundings adjust a tag via [data-etikett] (.eintrag [data-etikett] { margin-left: 6px; }), never via a class of the component.
  • The former global class .chip (border and pill shape like a secondary button, about 167 places) no longer exists.

States

State How it comes about How it looks
kinds art text in the colour of the kind on a light background (--senke, --akzent-zart, --gruen-zart, --warn-zart, --schlecht-zart), at least 4.5:1 in light and dark
with a dot punkt coloured dot in the text colour in front
small klein a little smaller, for dense rows and tables
chosen entry entfernen ✕ as a button at the end; with a surface under the mouse, ring in --akzent on keyboard focus

“Tag” section of the pattern page: all kinds, with dot and small, a chosen entry with ✕

“Tag” section dark

Accessibility

A tag is plain text and is read together with its entry. Colour is never the only statement: the word in the tag says the same. The ✕ of a chosen entry is an icon-only button; its name for screen readers is entfernenText (such as “Remove holder”). axe checks the contrast of the tags in light and dark on the pattern page.

Checked in the smoke test: the button guard (web/rauchtest/hilfen.mjs) reports rand-ohne-knopf on every visited page – a small element with a border all round and rounded corners that is neither button nor link nor field and contains none.

Code

import { Etikett, etikettArt } from '../bausteine';

<Etikett>{t('mappentypen.editor.chip.pflicht')}</Etikett>                // quiet (grey)
<Etikett art="warn">{t('werkbank.sicherung.frueherer-schluessel')}</Etikett>
<Etikett art="gut" punkt>{t('werkbank.benutzer.gerade-aktiv')}</Etikett>  // with a coloured dot
<Etikett art={etikettArt(ZUSTAND_ART[z.zustand])}>{name}</Etikett>       // kind from a table, unknown is quiet

// Chosen entry (pattern catalogue A1): a tag with a ✕ button in it.
<Etikett entfernen={() => setze(gewaehlt.filter((y) => y !== x))} entfernenText={t('werkbank.sichten.entfernen-2')}>
  {titel[x]}
</Etikett>
Property Meaning
art leise (grey, default), info (accent), gut (green), warn (yellow), schlecht (red) – text on a light background, at least 4.5:1 in light and dark
punkt coloured dot before the text (state of a traffic light, “active now”)
klein a little smaller, for dense rows and tables
title tooltip (e.g. until when an archive applies)
entfernen, entfernenText chosen entry: only the ✕ is a button (icon only, entfernenText is its name for screen readers)
className only for spacing and wrapping in the surroundings, never for colour or border

Files and tests

  • Component: web/src/bausteine/etikett/Etikett.tsx, look: Etikett.module.css
  • Pattern page: web/src/bausteine/etikett/muster.tsx
  • Test: web/test/baustein-etikett.test.ts