Halstack Provider

Halstack Provider is the context provider used for a whole application or an isolated group of components, which defines the custom theme and/or translation labels.

Props

NameTypeDescriptionDefault
themeOpinionatedThemeObject with a given structure, specified below, for defining the opinionated theme.-
advancedThemeAdvancedThemeObject with a given structure, specified below, for defining the advanced theme.-
labelsTranslatedLabelsObject with a given structure, specified below, for defining translations.-

Opinionated theme

As explained on the Themes page, you can apply the opinionated theming strategy to customize the components.

information
Remember that you can use the opinionated theme generator to help you create themes.

Below is an example of customizing the colours of a DxcAccordion and a DxcTextInput:

We create a customTheme object with as many components as we want and their respective values. Then we pass this object to the Halstack Provider, which wraps our components, through its theme property.

Advanced theme

Advanced theming is the option to choose when further customization is required. To find out which use cases are valid for this strategy, you can refer to the Themes page.

information
Remember that you can use the advanced theme generator to help you create themes.

In the example above we have customized some of the DxcAccordion tokens. As you can see, it is not necessary to pass all the tokens of the component, only those that you want to change their value with respect to the default theme.

Localization

Halstack Provider can be used to translate all the labels that cannot be changed by the component properties.

information
To find out the list of labels that are translatable we should refer to the documentation in the Localization section.

Let's imagine that we want to translate the '(Optional)' label of a DxcTextInput, as well as the error messages of our DxcFileInput component. To do so, we need to create an object with the translations. In this object, you will have as many objects as components you want to translate with the respective translation for their labels.

*(to see the translated error message you should try to add any file on the DxcFileInput).