Creating custom components (Alpha)

File Location

In a Jigx project all custom components are created in the components folder with the .jigx extension, for example, custom-card.jigx. You can create subfolders inside the component folder if required. Ensure you use a unique naming convention for each file in each folder. If files have the same name Jigx Builder uses the first file found in the components folder with that name and shows it in the IntelliSense code snippet in a jig file. If you have a components folder under jigs or elsewhere in your project, Jigx Builder sees it as components and validates the jigs against the rules of components.

Component folder
Component folder

File structure

All custom component files start with:

type: component.default children:

Under children: you add the components you want to customize. Invoke IntelliSense to see the list of available components.

Between options: and children: you can add predefined styling elements depending on the component selected. The components that allow customization are Card (Alpha), View (Alpha), Text (Alpha), Icon (Alpha), and Button (Alpha). Use IntelliSense to view the available list.

Card Styling options
Card Styling options

For component.view the options: followed by style: are required before children:. All available styling elements are listed under the style: property using IntelliSense.

View styling options
View styling options

Using custom component files in jigs

You can use the custom component files in multiple jig files by referencing component.custom-component and using the componentId: property to reference the name of the custom component file. Adding an instanceId allows the same custom component to be used in different instances and enables the use of outputs.

# jigs/use-custom-component.jigx
title: Card with view
# custom components can only be used in a default jig
type: jig.default

children:
  # to reference custom components use the component.custom-component property
  - type: component.custom-component
    # Reference the name of the custom component file in the componentId property
    componentId: custom-card
    # Give the component an instanceId allowing it to be used in different 
    # instances.
    instanceId: cardId
  # Multiple custom components can be referenced in a single jig
  - type: component.custom-component
    componentId: custom-view
    # Give the component an instanceId allowing it to be used in different 
    # instances.
    instanceId: viewId

Examples and code snippets

In the Reference & Examples tab, you can see code examples for each custom component.

Last updated

Was this helpful?