Skip to content

Block

Create an indented block of source text. The block has opener text which is added prior to the block, which defaults to "{", and closer text which is added after the block, which defaults to "}".

import { Block } from "@alloy-js/core";
<Block closer="string" inline newline opener="string">
{children}
</Block>

Props

childrenoptionalChildren

The block’s contents

closeroptionalstring

The closing punctuation of the block. Defaults to ”}“.

inlineoptionalboolean

If true the block will not indent the content into new lines

newlineoptionalboolean

Whether the block starts on a new line. When true, a hardline is added prior to the block. If inline is true, this will only apply if the block is also split due to breaking.

openeroptionalstring

The opening punctuation of the block. Defaults to ”{”.