Typography

Typography can be used to set themes for react components, learn more at https://mui.com/material-ui/api/typography/

Examples

Basic Whisper to show how to use the Typography component.

import { whisper } from "@oliveai/ldk"
import { 
  WhisperComponentType,
  Align,
  Variant,
 } from "@oliveai/ldk/src/whisper/types"

(async () => {
  try {
    await whisper.create({
      label: 'Typography Example',
      onClose: () => {
        console.debug('closed');
      },
      components: [
        {
          type: WhisperComponentType.Typography,
          body: 'default = align: "inherit", paragraph: false, variant: "body1"',
        },
        {
          type: WhisperComponentType.Typography,
          paragraph: true,
          body: 'Paragraph: true',
        },
        {
          type: WhisperComponentType.Typography,
          align: Align.Center,
          body: 'Align: Center',
        },
        {
          type: WhisperComponentType.Typography,
          align: Align.Justify,
          body: 'Align: Justify',
        },
        {
          type: WhisperComponentType.Typography,
          align: Align.Left,
          body: 'Align: Left',
        },
        {
          type: WhisperComponentType.Typography,
          align: Align.Right,
          body: 'Align: Right',
        },
        {
          type: WhisperComponentType.Typography,
          tooltip: 'tooltip test',
          body: 'Tooltip',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Body1,
          body: 'body1',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Body2,
          body: 'body2',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Button,
          body: 'button',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Caption,
          body: 'caption',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.H1,
          body: 'h1',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.H2,
          body: 'h2',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.H3,
          body: 'h3',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.H4,
          body: 'h4',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.H5,
          body: 'h5',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.H6,
          body: 'h6',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Inherit,
          body: 'inherit',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Overline,
          body: 'overline',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Subtitle1,
          body: 'subtitle1',
        },
        {
          type: WhisperComponentType.Typography,
          variant: Variant.Subtitle2,
          body: 'subtitle2',
        },
      ],
    });
  } catch (e) {
    console.debug(e)
  }
})

Last updated