UI: Helpers
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.
Interfaces
Section titled “Interfaces”UiTexts
Section titled “UiTexts”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.
Properties
Section titled “Properties”password
Section titled “password”password: object;The reveal button of PasswordField.
show: string;Label while the password is hidden.
hide: string;Label while the password is shown.
search
Section titled “search”search: object;The clear button of SearchField.
clear: string;Label of the clear button.
Functions
Section titled “Functions”function cx(...names): string;Joins class names, skipping empty values.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
…names |
(string | false | null | undefined)[] |
Class names; false, null, undefined and empty strings are left out. |
Returns
Section titled “Returns”string
The names joined by spaces.
Example
Section titled “Example”cx(styles.item, isActive && styles.active); // "item active" or "item"uiTexts()
Section titled “uiTexts()”function uiTexts(locale): UiTexts;The texts for a locale such as de-AT, by its language; English for a language without texts.
Parameters
Section titled “Parameters”| Parameter | Type | Description |
|---|---|---|
locale |
string |
A BCP 47 tag. |
Returns
Section titled “Returns”The texts in that language, or in English.