Typography

The Typography component use inherited css variables from a parent Color component for text color. Variants that contain text properties, such as font-size, font-weight, line-height and some other settings - can be set in the theme.

Props

NameTypeDefaultDescription
children or labelnodeThe content of the component.
variantstring - body, h1, h2, ... theme variantsbodyThe variant to use.
disabledboolfalseIf true, the component use disabled color.
variantMappingobject{h1: 'h1', h2: 'h2', h3: 'h3', h4: 'h4', h5: 'h5', h6: 'h6', subtitle1: 'h6', subtitle2: 'h6', body: 'p', 'button-large': 'div', 'button-default': 'div', 'button-small': 'div', 'button-inline': 'span', 'label1': 'div', 'label2': 'div',}The component maps the variant prop to a range of different HTML element types. If you wish to change that mapping, you can provide your own. Alternatively, you can use the Component prop.
Componentelement typevariant && variantMapping[variant] ? variantMapping[variant] : 'div'The component used for the root node. Either a string to use a HTML element or a component.
gutterBottomboolfalseIf true, the text will have a bottom margin.
bolderboolBolder font weight.
lighterboolLighter font weight.
weightnumberCustom font weight 100, 200, 300, 400, 500, 600, 700, 800, and 900.
fontSizestringCan custom font size with this property. It sets the --digby-typography-font-size css variable.
The ref is forwarded to the root element.

Example

label 2
label 1
button small
button default
button large

body

subtitle 2
subtitle 1
h6
h5

h4

h3

h2

h1