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>import { Block } from "@alloy-js/core/stc";
Block({ closer: string, inline: boolean, newline: boolean, opener: string,}).children(children)| children | optional Children | The block’s contents |
| closer | optional string | The closing punctuation of the block. Defaults to ”}“. |
| inline | optional boolean | If true the block will not indent the content into new lines |
| newline | optional boolean | 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. |
| opener | optional string | The opening punctuation of the block. Defaults to ”{”. |
Remarks
Section titled “Remarks”When children is empty, Block renders as {} (opener immediately followed
by closer) with no indented content — no explicit empty check is needed before
passing children.
Example
Section titled “Example”// Safe even when props.members is empty — renders `{}`
<Block>{props.members}</Block>