Toggle theme
We provide a Volvo Cars type scale for use across Volvo Cars digital ecosystem. It contains several distinct styles, some of which have sub-styles to portray more specific intentions
The variant prop defines the type style used, with Columbus being the default:
Hello world!
Nice to meet you :)Each variant comes with its own sensible default HTML element, which can be overridden using the as
prop to fit your needs:
The Hillary variant is a <p> by default,
Some variants have their own sub-styles. These are for use cases where you may need to render a link, or emphasise a portion of text. You can set them with the subStyle
prop, for example:
The above examples use the default Columbus variant, but sub-styles are available for Hillary and Bates too:
Sub-styles can also be set without needing to explicitly set their parent variant too, this can be useful for cases where you are dynamically rendering text:
There may be occasions where you would like to use values from the existing type scale, or perhaps even make minor adjustments to the existing styles. For these cases, we provide two options:
As with many core components in VCC-UI, we have left the extend prop open on the Text component. Styles can be passed in as you would with a <Block>
element or similar:
Big Navy Columbus.
The styles for all of the type scales are written in a notation that can be directly applied to any extend property. These styles are packaged as part of the theme, and can be loaded in like so:
Name | Description | Type | Default Value |
---|---|---|---|
as | Any valid React element, function, or a string specifying a name for an HTML element | union(string,element,elementType,func) | n/a |
children | A JSX node | node | n/a |
className | Add an additional custom className to element. Warning: make sure it doesn't collide with the classNames being generated for the atomic CSS | string | n/a |
extend | An object containing valid CSS style declarations | union(object,func,array) | n/a |
fg | A custom font color | custom | n/a |
foreground | A custom font color | custom | fg |
subStyle | One of the available sub-styles for a given type scale | union(object,array,string) | n/a |
variant | One of the available type scale styles | union(object,array,string) | n/a |