Skip to main content

Paragraph block

Use the paragraph block to show a static block of text without any input controls for respondents.

πŸ“Ί Preview​

πŸ“½οΈ Demo​

Run Try on CodePen

πŸ“¦ Package contents​

πŸ—οΈ Builder part​

The builder part instructs the builder how to manage the block. It defines the configurable properties and settings for the block, which can then be managed with the visual builder. This package contains:

  • Classes:
    • Paragraph: Paragraph visual block;
  • TypeScript typings (should work out-of-the-box);
  • Translations (located in the ./translations folder of the package).

πŸƒ Runner part​

The runner part of the block is responsible for the rendering of the block in a runner (the thing that runs the form). This block package contains all the non-UI-related parts of the block and a base class that is useful for implementing the UI rendering in a runner:

  • Classes:
    • Paragraph: Base class for implementing the paragraph in a runner UI;
  • TypeScript typings (should work out-of-the-box).

πŸ‘©β€πŸ’» Usage​

✨ Installation​

npm install @tripetto/block-paragraph
Typescript support

This package contains type declarations and supports TypeScript out-of-the-box.

πŸ—οΈ Builder part​

ESM/ES5​

Importing the block is all you need to do to self-register the block to the builder (see the builder plain JS implementation for an example or the Block loading guide for more information about loading blocks).

import "@tripetto/block-paragraph";

// The code above imports the ES5 or ESM version based on your project configuration.
// If you want to use the ES5 version, you can do an explicit import:
import "@tripetto/block-paragraph/es5";

CDN​

You can also use the builder part directly in a browser using a CDN (see the builder HTML implementation for more information).

<html>
<body>
<script src="https://cdn.jsdelivr.net/npm/@tripetto/builder"></script>
<script src="https://cdn.jsdelivr.net/npm/@tripetto/block-paragraph"></script>
<script>
Tripetto.Builder.open();
</script>
</body>
</html>

Translations​

The available translation for the block are located in the translations folder of the package.

tip

See the Loading a translation for a stock block guide to learn how to load the block translation into the builder.

πŸƒ Runner part​

The runner part contains a base class for implementing the paragraph in a runner UI (read the visual block tutorial to learn how to implement a runner UI for a block):

import { Paragraph } from "@tripetto/block-paragraph/runner";

// The code above imports the ES5 or ESM version based on your project configuration.
// If you want to use the ES5 version, you can do an explicit import:
import { Paragraph } from "@tripetto/block-paragraph/runner/es5";

// Now you can extend the paragraph with your UI rendering
class ParagraphBlock extends Paragraph {
// UI rendering implementation depending on the runner used
}

🎭 Stock runners​

This block is included in the following stock runners:

tip

If you are integrating the builder together with one of the stock runners, you can use the builder block bundle that is included in the stock runner packages to load the builder part of all the blocks with a single import. See the Import block bundles guide for more information.

🚒 Distribution ​

This block is distributed through npm:

▢️ https://www.npmjs.com/package/@tripetto/block-paragraph

πŸ“ Source code ​

This block is open-source and the code is on GitLab:

▢️ https://gitlab.com/tripetto/blocks/paragraph