Components
Last updated
Was this helpful?
Last updated
Was this helpful?
Components are sections of your application that you want to be reactive to user input.
Components are made up of , , , and a
You can render a component using the wire() method.
You can render wires from folders and subfolders outside of the default ./wires folder.
You can also reference components within another ColdBox module by using the @module syntax.
You can pass data into a component as an additional argument using wire().
By passing in parameters, you can create reusable UI components that are unique but similar in functionality. For example, you could make a button component that you reuse throughout your app.
Passed-in properties must have a data type of string, boolean, numeric, date, array, or struct.
There may be areas of your application where you need to use wire() but don't have access to it. You can use the CBWIREController object to insert wires anywhere you need.
By default, components are placed in the ./wires folder in the project root. You can change this location using the wiresLocation .
Parameters are passed into your component's method. This is an optional method you can add.
Properties you pass into your component as params will be automatically populated if onMount() is not defined and a matching is found.
You can nest components as much as you need by simply calling wire() from within a ( See ).