Typography

The quick brown fox jumps over the lazy dog

Import

import { H1, H2, H3, H4, H5, H6, P, Base } from '@politico/interactive-style/src/components/Typography';
// or
import Typography, { H1, H2, H3, H4, H5, H6, P } from '@politico/interactive-style';

Props

NameTypeDefaultDescription
childrennodeThe content of the component
typestring"p"Set the node type of the root text element (only for Base)
lighterboolfalseUse a lighter weight (only for h3)
bolderboolfalseUse a bolder weight (only for h2 and h5)
sans & sans-serifboolfalseUse a sans-serif font (only for p).
no-marginsboolfalseRemove margins and max widths.
markdownPropsobjectProps to pass to React Markdown (only for Markdown)

CSS

NameGlobal ClassDescription
containerPibTypography-containerStyles applied to container div
textPibTypography-textStyles applied to root textual element

Demos

Weight Variants

Some elements have "lighter" or "bolder" weight elements you can toggle.

The quick brown fox

jumps over the lazy dog


The quick brown fox

jumps over the lazy dog

Markdown Rendering

You can use the "Markdown" component to indicate that the content should be rendered as markdown. You can also use "markdownProps" to pass any custom configuration to the React Markdown component being used.

The quick brown fox jumps over the lazy dog

Custom Margins

If you want custom margins, you may want to remove the built-in margins and max-widths. You can do that by using the "no-margins" prop. Try removing the prop to see the defualt behavior.

Add the "no-margins" prop to break outside the well.

Custom Root Element

Most of the common root elements have their own shorthand (e.g. "H1", "H2", "P"). If you'd like to overwrite that root element you can use the "Base" component and supply a "type" prop. Try changing the root element to something else.

Custom types in Typography