Skip to content

List

Create a list of children with text between each child. The text to join with is specified by providing either joiner children, or providing boolean props for the punctuation and line breaks. The default joiner is no punctuation and a hard break. The ender prop can provide text to place at the end of the list when there is at least one child.

import { List } from "@alloy-js/core";
<List
comma
doubleHardline
ender={Children}
enderPunctuation
hardline
joiner={Children}
line
literalline
semicolon
softline
space
>
{children}
</List>

Props

childrenoptionalChildren
commaoptionalboolean

Place a comma between each element

doubleHardlineoptionalboolean

Place two hardlines between each element

enderoptionalChildren

Text to place at the end of the list when there is at least one item. If set to true, the joiner is used.

enderPunctuationoptionalboolean

Place the join punctuation at the end, but without a line break.

hardlineoptionalboolean

Place a hardline (<hbr />) between each element

joineroptionalChildren

Text to place between each element

lineoptionalboolean

Place a regular line (<br />) between each element

literallineoptionalboolean

Place a literal line (<lbr />) between each element

semicolonoptionalboolean

Place a semicolon between each element

softlineoptionalboolean

Place a softline (<sbr />) between each element

spaceoptionalboolean

Place a space between each element