@element-public/react-typography
v5.68.10-alpha.1
Published
Typography components for Element React
Keywords
Readme
Typography
Description
The Typography component is meant for use in styling type, so the underlying markup is made from a to produce valid markup in the largest number of situations. See TypoBody, TypoButton, TypoHeadline, TypoOverline, and TypoSubtitle.
See live demos on storybook
Install from Artifactory
- Verify that you have access to (https://docs.int.bayer.com/cloud/devops/artifactory/)[Bayer Artifactory]
- Verify your token is correctly set up in your .npmrc as per the link above
- Verify you have the @element scope configured in your .npmrc
@element:registry=https://artifactory.bayer.com/artifactory/api/npm/npm-platforms-engineering/
- Install the component and themes bundles
npm i @element/react-components @element/themes- alternatively install the component individually along with the themes bundle
npm i @element/react-typography @element/themes
- alternatively install the component individually along with the themes bundle
Notes
The Typography components are meant for use in styling type. The underlying markup is made from a <span> to work in the largest number of situations. Using the 'tag' prop, will allow the user to override the HTML tag if needed.
Usage
Typography is mainly to be used to style characters. Typography is used to ensure all text is styled according to the chosen theme and remain brand compliant.
The 'themeColor' prop allows users to change colors of the text, excluding links. Some accepted values are; primary, secondary, error, textHintOnBackgroud, and many more.
Body, Subtitle, Display have a 'level' props that can be used to adjust the font size and spacing. Display has 'level' values ranging from 1 to 6, while Body and Subtitle have levels 1-2.
Typography Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | bold | boolean | false | false | If true the typography will be bold. Applies to 1body, body2, caption, subtitle1, subtitle2 | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography. Does not apply to Link.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight | | type | string | 'body1' | false | Sets typography class for the element.Accepted Values: body1, body1-bold, body2, body2-bold, button, caption, caption-bold, display1, display2, display3, display4, display5, display6, link, overline, subtitle1, subtitle1-bold, subtitle2, subtitle2-boldDeprecated Values: headline1, headline2, headline3, headline4, headline5, headline6 |
Typography Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Body Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | bold | boolean | false | false | If true the typography will be bold. | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | level | number | 1 | false | Sets font properties for body. Acceptable values range from 1 - 2. Higher levels produce smaller type.Accepted Values: 1, 2 | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Body Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Button Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Button Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Caption Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | bold | boolean | false | false | If true the typography will be bold. | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Caption Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Display Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | level | number|string | 1 | false | Sets font properties for body. Acceptable values range from 1 to 6. Higher levels produce smaller type.Accepted Values: 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Display Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Headline Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | level | number|string | 1 | false | Sets font properties for body. Acceptable values range from 1 to 6. Higher levels produce smaller type.Accepted Values: 1, 2, 3, 4, 5, 6, 1, 2, 3, 4, 5, 6 | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Headline Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Link Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ---------------------------------------------------------------- | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | tag | string|React.ElementType|React.Component | 'a' | false | The DOM element to display the typography. |
Typo Link Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Overline Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Overline Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
Typo Subtitle Props
| Name | Type | Default | Required | Description | | ------------ | ------------------------------------------ | --------- | -------- | ----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | | bold | boolean | false | false | If true the typography will be bold. | | className | string | undefined | false | The css class name to be passed through to the component markup. | | fixedPadding | boolean | false | false | Forces consistent padding when using different html tags. | | level | number | 1 | false | Sets font properties for body.Accepted Values: 1, 2 | | tag | string|React.ElementType|React.Component | 'span' | false | The DOM element to display the typography. | | themeColor | string | undefined | false | Sets theme color for the typography.Accepted Values: primary, secondary, error, text-primary-on-background, text-secondary-on-background, text-hint-on-background, text-disabled-on-background, text-icon-on-background, text-primary-on-light, text-secondary-on-light, text-hint-on-light, text-disabled-on-light, text-icon-on-lightDeprecated Values: textPrimaryOnBackground, textSecondaryOnBackground, textHintOnBackground, textDisabledOnBackground, textIconOnBackground, textPrimaryOnLight, textSecondaryOnLight, textHintOnLight, textDisabledOnLight, textIconOnLight |
Typo Subtitle Render Props
| Name | Type | Default | Required | Description | | -------- | --------------- | ------- | -------- | ------------------------------------------- | | children | React.ReactNode | null | false | Expects a string, accepts any valid markup. |
