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.
Name | Type | Description | Default |
---|---|---|---|
theme | OpinionatedTheme | Object with a given structure, specified below, for defining the opinionated theme. | - |
advancedTheme | AdvancedTheme | Object with a given structure, specified below, for defining the advanced theme. | - |
labels | TranslatedLabels | Object with a given structure, specified below, for defining translations. | - |
As explained on the Themes page, you can apply the opinionated theming strategy to customize the components.
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 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.
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.
Halstack Provider can be used to translate all the labels that cannot be changed by the component properties.
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.
DxcFileInput
).