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/components.md
+53-21Lines changed: 53 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,6 +40,14 @@ These are the basic terms related to components and their functions:
40
40
41
41
***Component page**. A dedicated document page used for storing main components. Lunacy adds it automatically when you create a component.
42
42
43
+
<divclass="callout callout--info">
44
+
<p><strong>Note:</strong> Starting from v.12, the Component page appears only in two cases and only in local files:</p>
45
+
<ul>
46
+
<li>When you copy a component from another file to a local file</li>
47
+
<li>When you drop on the canvas an element from the GUI tool (button, checkbox, etc.)</li>
48
+
</ul>
49
+
</div>
50
+
43
51
***Component state**. Components from the same category or subcategory are called **component states**. They define the different styles for one component.
44
52
45
53
***Nested components**. You can nest several components in a more complex component. This gives you the most freedom and flexibility in editing your designs, and it’s an even more powerful feature when coupled with <ahref="https://lunacy.docs.icons8.com/autolayout/#nested-auto-layouts"target="_blank">nested auto layouts</a>.
@@ -48,12 +56,12 @@ These are the basic terms related to components and their functions:
48
56
49
57
To **create a component**:
50
58
51
-
1. Select the layer you want to convert into a component.
52
-
2. Click `+`in the **Component** section of the right panel or press `Ctrl + Alt + K` / `⌘ + ⌥ + K`.
59
+
1. Select the element you want to convert into a component.
60
+
2. Click <embedtype="image/svg+xml"alt="go_to_main"src="https://cdn-eu.icons8.com/docs/M9n6bSgrBEaWHOHZwLkY3A/0yVpQqG2_kmdN0fYegHJ4g.svg"width="16" /> in the context toolbar at the top of the canvas or press `Ctrl + Alt + K` / `⌘ + ⌥ + K`.
You can also select a layer and click <embedtype="image/svg+xml"alt="go_to_main"src="https://cdn-eu.icons8.com/docs/M9n6bSgrBEaWHOHZwLkY3A/0yVpQqG2_kmdN0fYegHJ4g.svg"width="16" /> in the context toolbar at the top of the canvas or select the **Create component** option on the context menu.
64
+
<!--
57
65
58
66
#### Layers vs. Frames
59
67
@@ -67,23 +75,31 @@ The difference is shown here:
67
75
68
76
Find out more about [component pages](#components-page).
Main components are bold and colored pink in the <ahref="https://lunacy.docs.icons8.com/interface/#layer-list"target="_blank">Layer list</a>, and there’s a component symbol (<embedtype="image/svg+xml"alt="main_component"src="https://cdn-eu.icons8.com/docs/M9n6bSgrBEaWHOHZwLkY3A/JApz_Mo2XE6YIoPMoYA3ow.svg"width="16" />) in front of their name.
73
86
74
-
Main components are bold and colored pink (<embedtype="image/svg+xml"alt="color_code_F15085"src="https://cdn-eu.icons8.com/docs/M9n6bSgrBEaWHOHZwLkY3A/b6VBjbQ0FEaLpb01JY4uEw.svg"width="12" />) in the <ahref="https://lunacy.docs.icons8.com/interface/#layer-list"target="_blank">Layer list</a>, and there’s a component symbol (<embedtype="image/svg+xml"alt="main_component"src="https://cdn-eu.icons8.com/docs/M9n6bSgrBEaWHOHZwLkY3A/JApz_Mo2XE6YIoPMoYA3ow.svg"width="16" />) in front of their name.
87
+
Main components with more than one [state](#component-states) come with a dashed border around the symbol.
75
88
76
89
Component instance names aren’t bold but have the instance symbol (<embedtype="image/svg+xml"alt="instance_icon"src="https://cdn-eu.icons8.com/docs/M9n6bSgrBEaWHOHZwLkY3A/7zBFwNg0JEKWT8fAiIVn9A.svg"width="16" />) and the same pink color. When they’re selected, their properties and options appear in the **Component** section of the right panel.
77
90
78
91
## [Reusing components](reusing-components)
79
92
80
93
All the components in your document appear in the **Components tab** in the left panel.
81
94
82
-
To **add a component instance** to the canvas, drag it from the left panel to where you want to place it:
95
+
To **add a component instance** to the canvas, you can:
Right-click a component in the **Components tab** to bring up the context menu with these options:
87
103
88
104
- Rename component
89
105
- Edit component
@@ -93,7 +109,13 @@ Right-click a component in the left panel to bring up the context menu with thes
93
109
- Expand all
94
110
- Collapse all
95
111
96
-
<divclass="callout callout--info"> <p><strong>Note:</strong> If you used any components from built-in or manually created <ahref="https://lunacy.docs.icons8.com/libraries/#ui-kits"target="_blank">UI kits</a>, they will also appear in the Components tab.</p> </div>
<divclass="callout callout--info"> <p><strong>Note:</strong> If you created any elements using the <ahref="https://lunacy.docs.icons8.com/tools/#gui-tool"target="_blank">GUI tool</a>, they will also appear in the <b>Components tab</b> in the group named <b>Web</b>.</p> </div>
116
+
117
+
118
+
<!--
97
119
98
120
## [Managing components](managing-components)
99
121
@@ -134,39 +156,49 @@ You can use **Components page** that Lunacy generates automatically to store all
134
156
135
157
<div class="callout callout--info"> <p><strong>Note:</strong> If you set one of your pages as a Components page, make sure its primary purpose is to store components. You’ll avoid confusion, and it will be easier to organize all of your design elements.</p> </div>
136
158
159
+
-->
160
+
137
161
## [Component states](#component-states)
138
162
139
-
You can create several **states** for a component and switch between them as needed in the **right panel**.
163
+
You can create multiple states for a component and switch between them as needed. States let you define variations like *Default*, *Hover*, or *Pressed*.
140
164
141
165
To **create a component state**:
142
166
143
-
1. Select a component instance.
144
-
2. Click `+` in the **Component** section of the **right panel** or press `Ctrl + Alt + P` / `⌘ + ⌥ + P`.
145
-
3. Adjust your component for the new state and name it.
146
-
4. Click on any empty area on the canvas.
167
+
1. Select a component.
168
+
2. Click <embedtype="image/svg+xml"alt="Add New"src="https://cdn-eu.icons8.com/docs/Dko8QE6mZ06fz2gAGGUBbA/xeqQWIYNtUePMxnmkm1vMA.svg" /> in the context tool bar or press `Ctrl + Alt + P` / `⌘ + ⌥ + P`. A dashed frame will appear around the component, and the new state will be added below the original.
169
+
3. Make the required changes to the new state.
170
+
4. To create additional states, select the original component or any existing state and click `+` again.
171
+
172
+
173
+
Lunacy automatically assigns names to states (Default, Hover, Pressed, etc.).
174
+
175
+
To **rename a state**:
176
+
177
+
1. Select the state.
178
+
2. Press F2 and the new state name after the slash (for example, `Button / Hover` > `Button / Disabled`).
A new component will appear near the default main component, defining the new component state.
182
+
You can also create a new component state from any instance on the canvas.
151
183
152
-
Lunacy also changes the name of components when you create new states, automatically placing them into [categories](#organizing-components). You can edit categories anytime in the **Components tab**.
184
+
See both methods in the video below.
153
185
154
-
New component states for a distinct component will be displayed in the right panel as you select the component’s instances.
<divclass="callout callout--info"> <p><strong>Note:</strong> Switching component states doesn’t affect overrides. This means that if you change the component state for an instance with overrides, the overrides you created will stay unchanged.</p> </div>
164
196
165
197
## Organizing components
166
198
167
199
As your document grows along with the number of components in it, you'll probably want to organize them so you can quickly find the necessary component when you need it.
168
200
169
-
This is how componenet categories and subcategories appear in the **Components tab**:
201
+
This is how component categories and subcategories appear in the **Components tab**:
0 commit comments