Components
Sections or areas of your app that are reactive to user input.
Last updated
Sections or areas of your app that are reactive to user input.
Last updated
Components are sections or areas of your site that you want to be reactive to user input. They can be as big or small as you like. For example, you may have a Signup form component that covers multiple steps or a button component that you reuse throughout your app.
Components are generally made up of , , , and an HTML template.
You can place the above code in separate files to separate your component and template definitions. CFC components must extend 'cbwire.models.Component'.
./wires/MyComponent.cfc
./wires/MyComponent.cfm
You can render a CBWIRE 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 create a Button component that you use throughout your app.
Parameters are passed into your component's onMount() method. This is an optional method you can add.
As of CBWIRE 3.2, properties that you pass into your component will be automatically populated if onMount() IS NOT defined and a matching data property is found.
Increase the performance of component rendering in your production environments with the 'cacheSingleFileComponents' setting.
Within your templates, you can access your , , and , and utilize any of the powerful template features listed under Template Features in the left-hand menu. Details on how to use these