2.0.0-rc.4 • Published 2 months ago

@asphalt-react/typography v2.0.0-rc.4

Weekly downloads
-
License
UNLICENSED
Repository
-
Last release
2 months ago

Typography

npm

Typography helps establish hierarchy and communicate text content clearly. Typography components abstracts over semantic and visuals. Some Typography components can have semantics meaning attached to it.

Typography components control the font property, other applicable styles are inherited by the global or user agent styles. In order to have more control apply the styles in parent container. The purpose of the typography components is to enable adding text content that is themeable.

You can use HTML Text content elements and Content sectioning elements to organize blocks or sections of content.

Use HTML Inline text semantics define the meaning, structure, or style of a word, line, or any arbitrary piece of text.

Usage

import {Heading, Display, Code, Text} from '@asphalt-react/typography'

<Heading>The quick brown fox jumps</Heading>

<Display>The quick brown fox jumps</Display>

<Code>npm install @asphalt-react/typography</Code>

<Text>The quick brown fox jumps</Text>

<Text bold>I have a higher font weight than Text</Text>

Intents

The Heading, Display & Text components have 5 intents to represent different content heirarchy and usages:

  • primary: This is the default intent and has the highest hierarchy.
  • secondary: This intent signifies copy with a lesser hierarchy than "primary".
  • muted: This intent has the lowest hierarchy and is usefult to show copy that should catch least user attention.
  • brand: This intent highlights the copy that closely represents the brand.
  • onBrand: This intent is useful to render a copy on brand colored surfaces. This intent ensures appropriate contrast ratio with the brand color.

Heading

Use Heading to represent the section heading contents, it supports all six levels of section headings from h1 till h6.

Props

children

React node for heading content.

typerequireddefault
nodetrueN/A

h1

Render the content as h1 section heading.

typerequireddefault
boolfalsefalse

h2

Render the content as h2 section heading.

typerequireddefault
boolfalsefalse

h3

Render the content as h3 section heading.

typerequireddefault
boolfalsefalse

h4

Render the content as h4 section heading.

typerequireddefault
boolfalsefalse

h5

Render the content as h5 section heading.

typerequireddefault
boolfalsefalse

h6

Render the content as h6 section heading.

typerequireddefault
boolfalsefalse

primary

Renders the text with primary intent. This is the default intent.

typerequireddefault
boolfalsefalse

secondary

Renders the text with secondary intent.

typerequireddefault
boolfalsefalse

brand

Renders the text with brand intent.

typerequireddefault
boolfalsefalse

onBrand

Renders the text with appropriate contrast ration to backgrounds with brand color.

typerequireddefault
boolfalsefalse

muted

Renders the text with muted intent.

typerequireddefault
boolfalsefalse

Display

Use Display to put more emphasis on a text. Use it to display a hero or marketing text.

Display by default renders the content in p tag, you can also choose to render in a div or span instead.

Props

children

React node for display content.

typerequireddefault
nodetrueN/A

size

Controls the size of display.

typerequireddefault
enumfalse"m"

p

render the display content in a p tag.

typerequireddefault
boolfalsefalse

span

render the display content in a span tag.

typerequireddefault
boolfalsefalse

div

render the display content in a div tag.

typerequireddefault
boolfalsefalse

primary

Renders the text with primary intent. This is the default intent.

typerequireddefault
boolfalsefalse

secondary

Renders the text with secondary intent.

typerequireddefault
boolfalsefalse

brand

Renders the text with brand intent.

typerequireddefault
boolfalsefalse

onBrand

Renders the text with appropriate contrast ratio to backgrounds with brand color.

typerequireddefault
boolfalsefalse

muted

Renders the text with muted intent.

typerequireddefault
boolfalsefalse

Code

Code styles text content in a fashion intended to indicate that the text is a short fragment or snippet of computer code.

Props

children

React node for code content.

typerequireddefault
nodetrueN/A

size

Controls the size of code content.

typerequireddefault
enumfalse"m"

Text

Use Text to render generic text contents. Text by default renders the text in p tag, you can also choose to render in a div or span instead.

Props

children

React node for text content.

typerequireddefault
nodetrueN/A

size

Controls the size of text.

typerequireddefault
enumfalse"m"

bold

Render the bold variant.

Bold variant is only supported for "xs", "s", "m" & "l" sizes.

typerequireddefault
boolfalseN/A

p

render the content in a p tag.

typerequireddefault
boolfalsefalse

span

render the content in a span tag.

typerequireddefault
boolfalsefalse

div

render the content in a div tag.

typerequireddefault
boolfalsefalse

primary

Renders the text with primary intent. This is the default intent.

typerequireddefault
boolfalsefalse

secondary

Renders the text with secondary intent.

typerequireddefault
boolfalsefalse

brand

Renders the text with brand intent.

typerequireddefault
boolfalsefalse

onBrand

Renders the text with appropriate contrast ratio to backgrounds with brand color.

typerequireddefault
boolfalsefalse

muted

Renders the text with muted intent.

typerequireddefault
boolfalsefalse