Skip to content

UI: Helpers

View as Markdown

cx and the texts the components show on their own. Import the token file once (@pithyx/ui/tokens.css) and wrap the app in UiProvider; see @pithyx/ui.

Generated from the TSDoc comments of @pithyx/ui 1.0.0-rc.9 at build time; the text below the headings is the comment in the source.

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 Type Description
…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 Type Description
locale string A BCP 47 tag.

UiTexts

The texts in that language, or in English.