K
Docs
API ReferencePiecesText Length
📏

Text Length

base.text.lengthBase SetUtility

Returns how many characters are in a piece of text. Useful for validating message length, word-count style games, or limits before sending.

On the canvas

This is what Text Length looks like when you place it on your flow. Each field below is something you configure in the inspector panel.

📏
Text Length
base.text.length
Utility
textrequired
{{message.content}}
asrequired
length

Config fields

FieldTypeReqWhat it does
text
{{message.content}}
textyesText 📝
as
length
textyesSave count as ✨

Sparks this piece adds

After this piece runs, these values are available as sparks in every node downstream.

{{length}}numberCharacter count

Output ports

outputNumber spark with the length
📐

In TypeScript, this would be…

Not something you need to write — just a look at what Kitcord does for you.

TypeScript
const length = text.length;
// {{length}} — character count