Fig Docs
  • 🏠Welcome to Fig
  • 👋Get Started
    • Download and Install
    • `fig home`
      • My Apps
      • The Sidebar
      • Settings
    • The Fig App Store
    • Hotkeys
  • 💪Autocomplete
  • 😀The Fig CLI
    • 1. Fig Overrides
    • 2. Fig Aliases
    • 3. $FIGPATH
    • 4. Fig Apps
  • 📖Interactive Runbooks
    • Form Elements
      • Input
      • Textarea
      • Dropdown
      • Checkboxes
      • Buttons
    • Templating & Interpolation
    • Scripting Language (Psilo)
      • Full List of Functions
    • Running Runbooks
    • Full Examples
  • ⚒️ Build your own CLI
    • `fig build`
    • .fig Files
  • 🧰Build your own App
    • Get Started
    • App Lifecycle
    • Key Concepts
      • Running Shell Commands
      • Reading Environment Variables
      • Accessing Files & Saving Data
      • Loading Local Resources
    • Window Managment
      • Setting Window Properties
      • Repositioning the Window
      • Focusing & Blurring the Window
    • Advanced
      • Creating a Pseudo-Terminal Session
  • Other
    • Fig for Teams
    • Security & Privacy
    • FAQ
    • Contact Us
  • Interactive Runbooks
Powered by GitBook
On this page
  • Interpolation
  • Using JavaScript Expressions
  • Embedding Additional Data
  1. Interactive Runbooks

Templating & Interpolation

PreviousButtonsNextScripting Language (Psilo)

Last updated 4 years ago

Don't be scared by these big words. This section helps you use the values a user has selected in your form elements. It is based on .

Interpolation

Fig uses Mustache Syntax to access the currently selected value of a form element. You identify a form element by its identifier. The identifier is the first string in the square brackets.

:[name: What is your name?]{}
My name is: {{ name }}

:[age: How old are you?]{ 21 }
I am {{ age }} years old

```
echo "Your name is {{name}}"
echo "You are {{age}}"
```

How does Fig Render this?

Using JavaScript Expressions

{{ flag ? "On" : "Off" }}
​
{{ file.split('/').slice(-1).pop() }}
​
{{ number_one + 1}}

{{ number_one + number_two}}

Embedding Additional Data

To include additional information add a code block with the language set as data. The contents of this tag will be interpreted as a JSON object and will be accessible in template tags.

```data
{
  plans: {
    "free" : {
      price: 0
    },
    "medium": {
      price: 7
    },
    "large" : {
      price: 50
    }
  }
}
```

The Large Plan costs: ${{ plans["large"]["price"] }}

Mustache braces allow you to access your element's output and use simple javascript expressions. .

📖
Here is a list of some more expressions you can use
Vue.js