Home
Author Manual
Builder Manual
Development
About Builder Manual
Best Practices
Package Interface
Theme Config
Responsive Themes
Dark Mode
FPM Typography
FPM Color
FPM Space

Best practices for FTD

We at FifthTry suggest below practices to be followed while writing your .ftd files.

Following below practices will help you reduce, build errors and aviod code mess .ftd files.

Judiciously Use caption

When creating a new component, see if you can use caption as the type of one of the arguments.

  • caption must be a summary like field, eg the heading of a section is a good caption.
  • caption should generally be human readable text, instead of say integers, or boolean.
  • If a component takes only one parameter, other types can also be passed as caption as passing caption means the caller of such component will only have to write one line of text.

Judiciously Use body

When creating a component see if one of the parameters can be of type body.

body should be used for free form texts, possibly spanning multiple paragraphs.

Space after colon :
Always keep space after : in each declaration. e.g. -- ftd.text:

10 lines space between 2 components
Always keep 10 lines space between two ftd components.

ftd variables first
Always declare ftd variables first while creating new component. e.g. below

-- ftd.column my-ftd-component:
boolean show-bar: false
string marktext:
string blah:
integer number:
width: fill
background-color: $fpm.color.main.background.base