Zum Inhalt springen

UI: Helpers

Als Markdown ansehen

cx und die Texte, die die Komponenten selbst zeigen. Importiere die Token-Datei einmal (@pithyx/ui/tokens.css) und umschließe die App mit UiProvider; siehe @pithyx/ui.

Beim Build aus den TSDoc-Kommentaren von @pithyx/ui 1.0.0-rc.9 erzeugt; der Text unter den Überschriften ist der Kommentar im Quelltext und bleibt Englisch.

The texts the components show or announce on their own. They live with every other translation, in i18n/<lang>/ui.json of the repository, and the build bundles them, so the package needs no i18n library.

password: object;

The reveal button of PasswordField.

show: string;

Label while the password is hidden.

hide: string;

Label while the password is shown.

search: object;

The clear button of SearchField.

clear: string;

Label of the clear button.

function cx(...names): string;

Joins class names, skipping empty values.

Parameter Typ Beschreibung
…names (string | false | null | undefined)[] Class names; false, null, undefined and empty strings are left out.

string

The names joined by spaces.

cx(styles.item, isActive && styles.active); // "item active" or "item"

function uiTexts(locale): UiTexts;

The texts for a locale such as de-AT, by its language; English for a language without texts.

Parameter Typ Beschreibung
locale string A BCP 47 tag.

UiTexts

The texts in that language, or in English.