The Format tag takes given content and applies various types of formatting to it.


<Format length=60>
  <Field description />

The above will trim the field value to maximum length of 60 characters.


Use the case attribute to convert to the following cases.

  • camel - Example: camelCase
  • kebab - Example: kebab-case
  • snake - Example: snake_case
  • pascal - Example: PascalCase

For example, this:

<Format case=kebab>Hello, world</Format>

..will output: hello-world.


Use the code attribute to escape text for inline <code>, or <pre> block.

<Format code>this & that</Format>

..will output: this &amp; that.

It uses PHP's htmlspecialchars function.


Use the date attribute to apply date formatting.

It uses the excellent Carbon date/time library.

See the Date tag for details on formatting and additionally supported attributes.


<Format date="Y-m-d">today</Format>

..will output: 2022-01-17.

Use date=default to use the site setting from Settings -> General -> Date Format.

<Format date="l j F Y" locale=fr>today</Format>

..will output: lundi 17 janvier 2022.


Use the length attribute to limit to a maximum length of characters.

<Format length=60>
  <Field description />

It uses PHP's mb_substr function, which supports UTF-8 multibyte characters.


Use the number attribute to format numbers.

<Format number decimals="2" point="," thousands=".">1000000</Format>

..will output: 1.000.000,00

It uses PHP's number_format function.

Optional attributes are:

  • decimals - Number of decimal places to display
  • point - Character for decimal point
  • thousands - Character for separating thousands


Use the replace and with attributes to replace pieces of text.

<Format replace=" " with="-">555 555 5555</Format>

The above example results in 555-555-5555.

The same attributes are supported in Field tag.

<Field phone_number replace=" " with="-" />