You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The outputs produced by `teal` modules, like graphs or tables, are created by the module developer and look a certain way.
22
-
It is impossible to design an output that will satisfy every possible user, so the form of the output should be considered a default value that can be customized.
23
-
Here we describe the concept of _decoration_, enabling you to tailor outputs to your specific requirements without rewriting the original module code.
22
+
It is hard to design an output that will satisfy every possible user, so the form of the output should be considered a default value that can be customized.
23
+
Here we describe the concept of _decoration_, enabling the app developer to tailor outputs to their specific requirements without rewriting the original module code.
24
24
25
-
The decoration process is build upon transformation procedures, introduced in `teal`. While transformators are meant to edit module's input, decorators are meant to adjust the module's output. To distinguish the difference, modules in
26
-
`teal.modules.general` have 2 separate parameters: `transformators` and `decorators`.
25
+
The decoration process is build upon transformation procedures, introduced in `teal`.
26
+
While transformators are meant to edit module's input, decorators are meant to adjust the module's output.
27
+
To distinguish the difference, modules in `teal.modules.general` have 2 separate parameters:
28
+
`transformators` and `decorators`.
27
29
28
-
To get a fuller understanding, read more about:
30
+
To get a complete understanding refer the following vignettes:
29
31
30
-
-changing the input data
31
-
[in this vignette](https://insightsengineering.github.io/teal/latest-tag/articles/transform-input-data.html),
32
-
-the concept of changing module output in [this vignette](https://insightsengineering.github.io/teal/latest-tag/articles/transform-input-data.html).
-Transforming module output in [this vignette](https://insightsengineering.github.io/teal/latest-tag/articles/transform-module-output.html).
33
35
34
36
## Decorators
35
37
36
38
Decorators are created with `teal_transform_module` and thus they are `shiny` modules.
37
39
In `teal.modules.general`, they are passed to `teal` modules through `decorators` argument (see below).
38
40
Their server logic will be used to modify objects such as plots or tables that exist in the server function of a module.
39
-
An`ui` function can provide interactivity but that is optional. An app developer is free to use decorator modules that do not require user input.
41
+
A`ui` function can provide interactivity but that is optional. An app developer is free to use decorator modules that do not require user input.
40
42
41
-
### Requirements and Limitations
43
+
##Decorating a Module
42
44
43
-
Using decorators requires the following:
45
+
In order to decorate/modify the output from a module from `teal.modules.general` you need to refer to the
46
+
"Decorating Module" section of the function documentation that tells about the objects that can be decorated.
44
47
45
-
1.**Matching Object Names**:<br>
46
-
Decorators will reference variables that exist in the `teal` module server function and therefore must use the appropriate variable names. The relevant object names available in each module are included in modules' documentations.
47
-
2.**Maintaining Object Classes**:<br>
48
-
A decorator must not alter the class of the object that it modifies.
49
-
This is because a different class may require a different rendering function and that is part of the module structure, which beyond the control of decorators.
48
+
In this vignette we will decorate the outputs from the `tm_g_distribution` module.
49
+
The [function definition](../reference/tm_g_distribution.html#decorating-module) shows us that there are four output objects that can be decorated:
50
+
`histogram_plot` (`ggplot2`), `qq_plot` (`ggplot2`), `summary_table` (`listing_df`) and `test_table` (`listing_df`).
50
51
51
-
## Building Decorators
52
+
### Static Decoration
53
+
Here we create a simple decorator that does not provide user.
54
+
We will use this to change the title to a static title that we want.
0 commit comments