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
Copy file name to clipboardExpand all lines: docs/en/components/getting-started.md
+104Lines changed: 104 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -4,3 +4,107 @@ order: 0
4
4
---
5
5
6
6
# Getting Started
7
+
8
+
`tessera-ui-basic-components` is the official component library for `tessera-ui`. It provides a set of common foundational components. It is completely optional and is decoupled from the `tessera-ui` core library.
9
+
10
+
## Installation
11
+
12
+
We assume you have already added and configured `tessera-ui` as a dependency for your project. If not, please refer to [Getting Started](../guide/getting-started.md).
13
+
14
+
Next, add `tessera-ui-basic-components` as a dependency:
15
+
16
+
```bash
17
+
cargo add tessera-ui-basic-components
18
+
```
19
+
20
+
## Registering with the renderer
21
+
22
+
::: warning ⚠
23
+
If you do not register the corresponding pipelines with the renderer, the renderer will crash.
24
+
:::
25
+
26
+
`tessera-ui` uses a decentralized renderer architecture (see ../guide/what-is-tessera.md#pluggable-shaders), so you need to register `tessera-ui-basic-components` with the renderer.
27
+
28
+
Assume your original renderer initialization looks like:
window_title:"Tessera".to_string(), // Window title
55
+
..Default::default()
56
+
};
57
+
Renderer::run_with_config(
58
+
|| {}, // UI entry function
59
+
|app| {
60
+
tessera_ui_basic_components::pipelines::register_pipelines(app); // Register pipelines required by the basic components
61
+
},
62
+
config,
63
+
)
64
+
.unwrap();
65
+
}
66
+
```
67
+
68
+
## Using components
69
+
70
+
Now you can use components provided by `tessera-ui-basic-components` inside `#[tessera]` functions. Here is an example that uses `surface` as a background:
0 commit comments