|
1 | | -# The Embeddable API V2 |
| 1 | +# Embeddables |
2 | 2 |
|
3 | | -The Embeddable API's main goal is to have documented and standardized ways to share and exchange information and functionality across applications and plugins. |
| 3 | +Embeddables are re-usable widgets that can be rendered in any environment or plugin. Developers can embed them directly in their plugin. End users can dynamically add them to any embeddable _containers_. |
4 | 4 |
|
5 | | -There are three main pieces of this infrastructure: |
6 | | - - Embeddables & Containers |
7 | | - - Actions |
8 | | - - Triggers |
| 5 | +## Embeddable containers |
9 | 6 |
|
10 | | -## Embeddables & Containers |
| 7 | +Containers are a special type of embeddable that can contain nested embeddables. Embeddables can be dynamically added to embeddable _containers_. Currently only dashboard uses this interface. |
11 | 8 |
|
12 | | -Embeddables are isolated, serializable, renderable widgets. A developer can hard code an embeddable inside their |
13 | | -application, or they can use some built in actions to allow users to dynamically add them to *containers*. |
14 | | - |
15 | | -Containers are a special type of embeddable that can contain nested embeddables. |
16 | | - |
17 | | -## Actions |
18 | | - |
19 | | -Actions are pluggable pieces of functionality exposed to the user that take an embeddable as context, plus an optional action context. |
20 | | - |
21 | | -## Triggers |
22 | | - |
23 | | -Triggers are the way actions are connected to a user action. We ship with two default triggers, `CONTEXT_MENU_TRIGGER` and `APPLY_FILTER`. |
24 | | - |
25 | | -Actions attached to the `CONTEXT_MENU_TRIGGER` will be displayed in supported embeddables context menu to the user. Actions attached to the `APPLY_FILTER` trigger will show up when any embeddable emits this trigger. |
| 9 | +## Examples |
26 | 10 |
|
27 | | -A developer can register new triggers that their embeddables, or external components, can emit (as long as they have an embeddable to pass along as context). |
| 11 | +Many example embeddables are implemented and registered [here](https://github.com/elastic/kibana/tree/master/examples/embeddable_examples). They can be played around with and explored [in the Embeddable Explorer example plugin](https://github.com/elastic/kibana/tree/master/examples/embeddable_explorer). Just run kibana with |
28 | 12 |
|
29 | | -## Examples |
| 13 | +``` |
| 14 | +yarn start --run-examples |
| 15 | +``` |
30 | 16 |
|
31 | | -Many examples can be viewed in the functionally tested `kbn_tp_embeddable_explorer` plugin, as well as the jest tested classes inside the `embeddable_api/public/test_samples` folder. |
| 17 | +and navigate to the Embeddable explorer app. |
32 | 18 |
|
33 | 19 | ## Testing |
34 | 20 |
|
35 | 21 | Run unit tests |
36 | 22 |
|
37 | 23 | ```shell |
38 | | -node scripts/jest embeddable_api |
| 24 | +node scripts/jest embeddable |
39 | 25 | ``` |
0 commit comments