Section Title

Section Title is a section heading component to a Whisper, it helps better separate content on the Whisper.

Props:

PropertiesDescriptionsRequiredDefault

backgroundStyle

Background color of the component.

Color.White(#FFFFFF)

body

The content of SectionTitle that you want to display. Supports markdown.

textAlign

TextAlign.Left

The inline contents are aligned to the left edge of the line box. It's default value.

TextAlign.Right

The inline contents are aligned to the right edge of the line box.

TextAlign.Center

The inline contents are centered within the line box.

TextAlign.Left

Examples

SectionTitles can be aligned in different ways, and have a background color that stretches across the entire width of the Whisper, unlike some other components. In addition, the body attribute also allows you to use markdown for the content of the component. In this example, we'll look at the different alignments, background, and what the component looks like with some content. Here is a screenshot to show you what the code below will look like once you add the content.

import { whisper } from '@oliveai/ldk';
import {
  Color,
  TextAlign,
  WhisperComponentType,
} from '@oliveai/ldk/dist/whisper/types';

export const sectionTitle = async() => {
  await whisper.create({
    label: 'Olive Helps Section title Loop',
    components: [
      {
        body: 'section Title in center with [Some Link 1](# "A Link")',
        type: WhisperComponentType.SectionTitle,
        textAlign: TextAlign.Center,
      },
      {
        body: 'section Title on the left with a link : http://google.com',
        type: WhisperComponentType.SectionTitle,
        textAlign: TextAlign.Left,
      },
      {
        body: '~~Strikethrough section Title on the right(white)~~',
        type: WhisperComponentType.SectionTitle,
        textAlign: TextAlign.Right,
        backgroundStyle: Color.White,
      },
      {
        body: '_Italic section Title in center(grey)_',
        textAlign: TextAlign.Center,
        type: WhisperComponentType.SectionTitle,
        backgroundStyle: Color.Grey,
      },
      {
        type: WhisperComponentType.Markdown,
        body: 'Section Title is a section heading component to a Whisper. It helps better separate content on the Whisper. ',
      },
    ],
  });
}

Last updated