Skip to content

Commit e7129a0

Browse files
committed
First Roots docs
1 parent 8ece346 commit e7129a0

32 files changed

Lines changed: 480 additions & 51 deletions

_auto_docs/rish/00-quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,4 @@ Rish is a UI library, not a rigid or opinionated framework. We're trying not to
161161

162162
However, if you want a head start, we have created **Roots**, a collection of ready-to-use elements built with Rish.
163163

164-
[Check out the Roots documentantion](/docs/roots/1.0.0/quick-start)
164+
[Check out the Roots documentantion](/docs/roots/quick-start)

_auto_docs/rish/01-installation.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -113,4 +113,4 @@ public partial class App : IApp
113113
{% endhighlight %}
114114

115115
## Next Steps
116-
Now that you have the library installed, we recommend installing [**Roots**](/docs/roots/1.0.0/quick-start) and importing its samples to see working code in action.
116+
Now that you have the library installed, we recommend installing [**Roots**](/docs/roots/quick-start) and importing its samples to see working code in action.

_auto_docs/rish/03-visualelements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected override Element Render() => Div.Create(
6868
<div class="callout-block callout-block-warning">
6969
<div class="content">
7070
<h4 class="callout-title"><i class="fa-solid fa-circle-info"></i>Best Practice</h4>
71-
<p>Favor <strong>USS stylesheets</strong> (via <code>className</code>) over inline styles. Unity optimizes stylesheets better (and supports live reloading of USS assets) and it keeps your style and layout logic separate from your code.</p>
71+
<p>Favor <strong>USS style sheets</strong> (via <code>className</code>) over inline styles. Unity optimizes style sheets better (and supports live reloading of USS assets) and it keeps your style and layout logic separate from your code.</p>
7272
<p>Use <strong>Inline Styles</strong> only when the style depends on dynamic data from Props or State.</p>
7373
</div>
7474
</div>

_docs/rish/3.0.0/00-quick-start.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -161,4 +161,4 @@ Rish is a UI library, not a rigid or opinionated framework. We're trying not to
161161

162162
However, if you want a head start, we have created **Roots**, a collection of ready-to-use elements built with Rish.
163163

164-
[Check out the Roots documentantion](/docs/roots/1.0.0/quick-start)
164+
[Check out the Roots documentantion](/docs/roots/quick-start)

_docs/rish/3.0.0/01-installation.md

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,9 @@ sections:
77
icon: download
88
---
99

10-
Installing Rish is simple. You can add the package via the Unity Package Manager using the Git URL, or by modifying your manifest.json file directly.
10+
Installing Rish is simple. You can add the package via the Unity Package Manager using the Git URL, or by modifying your `manifest.json` file directly.
1111

12-
Add the following package URL: `https://github.com/clockworklabs/rish#[target-version]`
12+
Add the following package URL: `https://github.com/clockworklabs/rish#[target-version]`.
1313

1414
#### Dependencies
1515
Rish requires the following dependencies to function correctly:
@@ -52,6 +52,7 @@ To set up a Rish App in your scene:
5252
2. Add the `RishRoot` component to it. This will automatically add a `UIDocument` component if one is missing.
5353
3. Assign your **Panel Settings** to the `UIDocument`.
5454
4. Create a class that implements `IApp` and assign it to the `RishRoot`.
55+
5. Assign all the USS style sheets your app will need to the `RishRoot`.
5556

5657
### Defining an App
5758
A Rish App is the entry point for your UI. It is not an Element itself; rather, it defines the root element for the entire tree.
@@ -113,4 +114,4 @@ public partial class App : IApp
113114
{% endhighlight %}
114115

115116
## Next Steps
116-
Now that you have the library installed, we recommend installing [**Roots**](/docs/roots/1.0.0/quick-start) and importing its samples to see working code in action.
117+
Now that you have the library installed, we recommend installing [**Roots**](/docs/roots/quick-start) and importing its samples to see working code in action.

_docs/rish/3.0.0/03-visualelements.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ protected override Element Render() => Div.Create(
6868
<div class="callout-block callout-block-warning">
6969
<div class="content">
7070
<h4 class="callout-title"><i class="fa-solid fa-circle-info"></i>Best Practice</h4>
71-
<p>Favor <strong>USS stylesheets</strong> (via <code>className</code>) over inline styles. Unity optimizes stylesheets better (and supports live reloading of USS assets) and it keeps your style and layout logic separate from your code.</p>
71+
<p>Favor <strong>USS style sheets</strong> (via <code>className</code>) over inline styles. Unity optimizes style sheets better (and supports live reloading of USS assets) and it keeps your style and layout logic separate from your code.</p>
7272
<p>Use <strong>Inline Styles</strong> only when the style depends on dynamic data from Props or State.</p>
7373
</div>
7474
</div>

_docs/rish/3.0.0/09-best-practices.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -438,7 +438,7 @@ public partial class NestedElementsExample : RishElement
438438
More complex Elements are defined in separate files.
439439

440440
<figure>
441-
<figcaption>File 1</figcaption>
441+
<figcaption>NestedElementsExample.cs</figcaption>
442442
{% highlight csharp %}
443443
public partial class NestedElementsExample : RishElement<NestedElementsExampleProps>
444444
{
@@ -458,7 +458,7 @@ public struct NestedElementsExampleProps {
458458
</figure>
459459

460460
<figure>
461-
<figcaption>File 2</figcaption>
461+
<figcaption>Nested.cs</figcaption>
462462
{% highlight csharp %}
463463
public partial class NestedElementsExample
464464
{

_docs/rish/3.0.0/10-labels.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
title: Labels
3+
slug: labels
4+
sections:
5+
- Inputs
6+
icon: align-left
7+
---
8+
9+
`Label` is the _only_ element shipped with Rish. It's a foundational VisualElement. It inherits from `UnityEngine.UIElements.Label`.
10+
11+
A `string` or `RishString` can be implicitly converted into an `Element`. So, similarly to HTML, you can treat text as a UI Element.
12+
13+
<figure>
14+
<figcaption>HTML</figcaption>
15+
{% highlight html %}
16+
<div class="container">Hello, world.</div>
17+
{% endhighlight %}
18+
</figure>
19+
20+
<figure>
21+
<figcaption>C# Rish</figcaption>
22+
{% highlight csharp %}
23+
Div.Create(className: "container", children: "Hello, world.");
24+
{% endhighlight %}
25+
</figure>
26+
27+
We recommend creating wrappers for different label styles (like `Body`, `H1`, `H2`...).
28+
29+
## Inputs
30+
- `RishString text`: The text to render.
31+
- `LengthRange? widthRange`: Optional width size range. If set, UI Toolkit will use for the reported preferred size in the layouting phase.
32+
- `LengthRange? heightRange`: Optional height size range. If set, UI Toolkit will use for the reported preferred size in the layouting phase.
33+
- `bool? enableRichText`: Whether or not rich text tags get parsed or not.
34+
- `bool? parseEscapeSequences`: Wheter or not escape sequences get parsed or not.
35+
- `Action<bool> onElided`: Callback that reports when the text is ellided or not.

_docs/roots/1.0.0/00-quick-start.md

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,19 @@
22
title: Quick Start
33
slug: quick-start
44
sections:
5+
- Why Roots?
56
icon: handshake
67
---
78

8-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque finibus condimentum nisl id vulputate. Praesent aliquet varius eros interdum suscipit. Donec eu purus sed nibh convallis bibendum quis vitae turpis. Duis vestibulum diam lorem, vitae dapibus nibh facilisis a. Fusce in malesuada odio.
9+
Roots is a UI toolkit built on top of [Rish](/docs/rish/quick-start). Rish is very thin and provides no elements out of the box. Roots is a great foundation for your UI app.
10+
11+
## Setup
12+
13+
14+
15+
16+
It provides
17+
- Unity Components to structure and setup your Rish App.
18+
- Low-level abstract elements.
19+
- High-level reference or starting-point elements.
20+

_docs/roots/1.0.0/01-installation.md

Lines changed: 28 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,4 +8,31 @@ sections:
88
icon: download
99
---
1010

11-
Lorem ipsum dolor sit amet, consectetur adipiscing elit. Quisque finibus condimentum nisl id vulputate. Praesent aliquet varius eros interdum suscipit. Donec eu purus sed nibh convallis bibendum quis vitae turpis. Duis vestibulum diam lorem, vitae dapibus nibh facilisis a. Fusce in malesuada odio.
11+
Installing Roots is simple. You can add the package via the Unity Package Manager using the Git URL, or by modifying your `manifest.json` file directly.
12+
13+
Add the following package URL: `https://github.com/clockworklabs/roots#[target-version]`.
14+
15+
#### Dependencies
16+
Roots requires the following dependencies to function correctly:
17+
- [Rish](/docs/rish/quick-start): `io.clockworklabs.rish` (version `3.0.0+`).
18+
- [Motion](https://github.com/clockworklabs/motion): `io.clockworklabs.motion` (version `1.7.9+`).
19+
20+
## Setup
21+
Roots requires minimal setup for all of its moving parts to work:
22+
1. Add `RootsSetup` component to the GameObject that contains your App's `RishRoot`.
23+
- This component is only needed to use the more advanced `ResponsiveStyleSheets`.
24+
2. Add an `AssetsLoader` component to bridge between your app's assets pipeline and your UI app.
25+
- `AssetsLoader` is an abstract class. Roots provides a `ResourcesLoader` implementation that loads assets from Resources. You can implement your own loader that works for your app.
26+
3. Animated elements use [Motion](https://github.com/clockworklabs/motion). For your motions to be stepped, add a `MotionAutoUpdate` component (in more advanced scenarios, you may want to manually call `DoMotion.Step`).
27+
28+
## Samples
29+
Roots comes with samples showing a wide range of UI Elements (from simple buttons to complex scroll views or responsive layouts).
30+
31+
1. Open the **Package Manager**.
32+
2. Select the **Roots** package.
33+
3. Go to the **Samples** tab and import **Rootstrap** and **Samples**.
34+
4. Open the newly imported `Samples` scene and enter Play Mode.
35+
36+
The Samples scene supports changing the dimensions of the samples container to interact with responsive elements. It also has a button to see the relevant code for each sample.
37+
38+
We encourage you to play around.

0 commit comments

Comments
 (0)