mittwald Flow Logo

Components

Label

Labels werden in Formularen (z.B. TextField, NumberField) oder beim LabeledValue verwendet. Dort erläutern sie die Eingabeanforderungen oder setzen Informationen in einen Kontext.GitHub

Playground

Verwende <Label />, um ein Label anzuzeigen. Labels werden häufig innerhalb von anderen Komponenten eingesetzt.

import { Label } from "@mittwald/flow-react-components";

<Label>Label</Label>

States

Das Label hat 2 verschiedene States: Default und Disabled.

import { Label } from "@mittwald/flow-react-components";

<Row>
  <Label>Default</Label>
  <Label isDisabled>Disabled</Label>
</Row>

Disabled: Das Label wird häufig zur Beschreibung komplexerer Komponenten verwendet. Daher übernimmt es automatisch den State, den die höhere Komponente hat. Ist zum Beispiel ein TextField oder NumberField gerade disabled, nimmt das Label den gleichen State an.

Properties

PropertyTypeDefaultDescription
optionalboolean-

Whether the label should show an "optional" indicator.

isDisabledboolean-

Whether the label should be displayed as disabled.

unstyledboolean-
dangerouslySetInnerHTML{ __html: string | TrustedHTML; }-
suppressHydrationWarningboolean-
classNamestring-
colorstring-
idstring-
langstring-
styleCSSProperties-
roleAriaRole-
tabIndexnumber-
autoFocusboolean-
defaultValuestring | number | readonly string[]-
slotstring-
elementTypestring-
defaultCheckedboolean-
suppressContentEditableWarningboolean-
accessKeystring-
autoCapitalize"none" | "off" | (string & {}) | "on" | "sentences" | "words" | "characters"-
contentEditableBooleanish | "inherit" | "plaintext-only"-
contextMenustring-
dirstring-
draggableBooleanish-
enterKeyHint"search" | "enter" | "done" | "go" | "next" | "previous" | "send"-
hiddenboolean-
noncestring-
spellCheckBooleanish-
titlestring-
translate"yes" | "no"-
radioGroupstring-
aboutstring-
contentstring-
datatypestring-
inlistany-
prefixstring-
propertystring-
relstring-
resourcestring-
revstring-
typeofstring-
vocabstring-
autoCorrectstring-
autoSavestring-
itemPropstring-
itemScopeboolean-
itemTypestring-
itemIDstring-
itemRefstring-
resultsnumber-
securitystring-
unselectable"off" | "on"-
popover"" | "auto" | "manual"-
popoverTargetAction"hide" | "toggle" | "show"-
popoverTargetstring-
inertboolean-

@see https://developer.mozilla.org/en-US/docs/Web/API/HTMLElement/inert

inputMode"none" | "text" | "search" | "url" | "tel" | "email" | "numeric" | "decimal"-

Hints at the type of data that might be entered by the user while editing the element or its contents @see https://html.spec.whatwg.org/multipage/interaction.html#input-modalities:-the-inputmode-attribute

isstring-

Specify that a standard HTML element should behave like a defined custom built-in element @see https://html.spec.whatwg.org/multipage/custom-elements.html#attr-is

formstring-
htmlForstring-
childrenReactNode-
wrapWithReactElement<unknown, string | JSXElementConstructor<any>>-
refRef<HTMLLabelElement>-

Allows getting a ref to the component instance. Once the component unmounts, React will set ref.current to null (or call the ref with null if you passed a callback ref). @see React Docs

keyKey-

Grundlagen

Best Practices

  • Halte Labels kurz (1-3 Wörter) und prägnant.
  • Stelle sicher, dass das Label jederzeit vollständig sichtbar ist.
  • Verwende eine einfache Sprache.

Verwendung

Verwende ein Label, um ...


Writing Guidelines

Das Label sollte ...

  • kurz (1-3 Wörter), prägnant und leicht verständlich sein.
  • jederzeit vollständig sichtbar und einzeilig sein. Bei sehr schmalen Bildschirmen kann es passieren, dass es zweizeilig wird.
  • keine Verben wie „eingeben“, „hinzufügen“ oder „wählen” enthalten.
  • keine Formatierungshinweise geben. Nutze dafür z.B. die FieldDescription im TextField.
  • keinen Doppelpunkt am Ende haben.

Do

Do

Don't

Dont

Feedback geben