Skip to main content

Typography

Description

The typography components provide a set of styled text elements for your application, including various heading levels (H1 to H6), Text, bold, underline, and italic elements. These components support customization options such as type, number of lines, text case, and editable content.

Use Case

These components are ideal for:

  • Structuring content with appropriate heading levels.
  • Styling text with different formats like bold, underline, and italic.
  • Displaying body text, captions, and error messages.
  • Providing editable text elements for user-generated content.

Props Table

HeaderProps

Prop NameTypeDescriptionDefault ValueRequired
type"sans" | "serif"The font type for the heading."sans"No
numberOfLinesnumberThe maximum number of lines to display.undefinedNo
editablebooleanWhether the heading is editable.falseNo
onUpdate(value: string) => voidCallback function when the heading content is updated.undefinedNo

TextProps

Prop NameTypeDescriptionDefault ValueRequired
type"error" | "body" | "caption"The type of text to display."body"No
textCase"none" | "capitalize" | "uppercase" | "lowercase" | "initial" | "inherit"The case transformation for the text."none"No
editablebooleanWhether the text is editable.falseNo
codeClassNamestringAdditional class name for code blocks within the text.undefinedNo
numberOfLinesnumberThe maximum number of lines to display.undefinedNo
onUpdate(value: string) => voidCallback function when the text content is updated.undefinedNo

Example Use Case

Example 1: Using Headings

Using different heading levels and types.

import React from 'react';
import { H1, H2, H3, H4, H5, H6 } from './typography';

const TypographyExample = () => (
<div>
<H1 type="serif">Heading 1</H1>
<H2 type="sans">Heading 2</H2>
<H3>Heading 3</H3>
<H4>Heading 4</H4>
<H5>Heading 5</H5>
<H6>Heading 6</H6>
</div>
);

export default TypographyExample;

Utils

Utils

Description

This set of utility functions provides helpful methods for handling class names and converting color formats. These functions streamline common operations, making it easier to manage class names and color formats in your application.

Use Case

These utility functions are ideal for:

  • Concatenating class names conditionally.
  • Converting hexadecimal color codes to RGBA format.
  • Rendering assets conditionally based on visibility.

Utility Functions

LMAsset

Renders an asset conditionally based on the visibility prop.

LMAssetProps

Prop NameTypeDescriptionDefault ValueRequired
AssetReact.FC<AssetProps>The asset to be rendered.N/AYes
sizenumberThe size of the asset.N/ANo
colorstringThe color of the asset.N/ANo
visiblebooleanWhether the asset is visible.trueNo

cx

A method to extract classNames on a React Component.

hexToRgba

take two arguments hex: string, opacity: number and returns a rgba value with opacity.

Form

Validations