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
{{ message }}
Repository navigation
Commit 4e395d7
Browse filesBrowse the repository at this point in the historyBrowse files
Copy file name to clipboardExpand all lines: docs/components/create-a-component/index.md
+9Lines changed: 9 additions & 0 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -40,3 +40,12 @@ This method automatically:
40
40
::: warning
41
41
If the extracted elements depend on variables or formulas from the original component or page, these connections will break after extraction. You will need to rearrange these dependencies.
42
42
:::
43
+
44
+
::: tip
45
+
For a video walkthrough of creating a component, check out the following lesson from the [Nordcraft Fundamentals](https://nordcraft.com/learn/fundamentals) video course.
Copy file name to clipboardExpand all lines: docs/components/overview/index.md
+13-21Lines changed: 13 additions & 21 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,11 +1,11 @@
1
1
---
2
2
title: Component fundamentals
3
-
description: Learn how components work in Nordcraft, and how using components can help you build maintanable, organized, and powerful websites.
3
+
description: Learn how components work in Nordcraft, and how using components can help you build maintanableand organized websites.
4
4
---
5
5
6
6
# Components in Nordcraft
7
7
8
-
Components are the fundamental building blocks of websites in Nordcraft. Using components, you can create reusable parts of your website and break large projects down into smaller, more manageable pieces.
8
+
You can use components in Nordcraft to break down large projects into smaller reusable building blocks for your websites in Nordcraft.
9
9
10
10
Components in Nordcraft are self-contained, reusable elements that encapsulate structure, styles and behavior. Components can:
11
11
@@ -18,14 +18,14 @@ Components in Nordcraft are self-contained, reusable elements that encapsulate s
18
18
- Implement functionality in isolation
19
19
- Maintain their own internal state
20
20
21
-
Each component has its own structure, data model, and behavior. This makes components neatly reusable across your project. The encapsulation of both UI and logic creates building blocks that can be combined to create increasingly sophisticated websites.
21
+
Each component has its own structure, data model, and behavior.
22
22
23
23
::: info
24
24
Components combine HTML structure, CSS styles, and interactive JavaScript behavior into reusable parts.
25
25
:::
26
26
27
27
::: dev
28
-
Nordcraft components work in very similar ways to other JavaScript frameworks like React, Vue, and Svelte.
28
+
Nordcraft components work in very similar ways to how components work in other JavaScript frameworks like React, Vue, and Svelte.
29
29
:::
30
30
31
31
## Benefits of using components
@@ -59,26 +59,12 @@ A component in Nordcraft can consist of:
59
59
60
60
### Data encapsulation
61
61
62
-
Components in Nordcraft encapsulate their data, meaning that variables, APIs, and other internal aspects of one component are not accessible by other components. At first, this isolation may seem limiting, but it's an essential design principle that helps maintain order as your project grows in complexity.
63
-
64
-
This encapsulation ensures that components:
62
+
Components in Nordcraft encapsulate their data, meaning that variables, APIs, and other internal aspects of one component are not accessible by other components. This ensures that components:
65
63
66
64
- Have clear boundaries and responsibilities
67
65
- Can be modified internally without affecting other parts of the project
68
66
- Are easier to understand, as their behavior depends only on their own code and inputs
69
67
70
-
::: info
71
-
Each component is like a `black box` that hides its implementation details while exposing a clear interface.
72
-
:::
73
-
74
-
### Component composition
75
-
76
-
Components are composable, meaning they can be combined together to form more complex components. This composition model allows you to:
77
-
78
-
- Create a hierarchy of increasingly complex UI elements
79
-
- Build websites with reusable parts
80
-
- Share functionality between different areas of your website
81
-
82
68
Components can send data to other components and pages through:
83
69
84
70
-**Attributes**: Pass data down to child components
@@ -87,12 +73,18 @@ Components can send data to other components and pages through:
87
73
88
74
This communication pattern enables components to work together while maintaining their independence and encapsulation.
89
75
76
+
### Component composition
77
+
78
+
Components are composable, meaning they can be combined together to form more complex components. This allows you to:
79
+
80
+
- Create a hierarchy of increasingly complex UI elements
81
+
- Build large websites with reusable parts
82
+
- Share functionality between different areas of your website
83
+
90
84
## Working with component instances
91
85
92
86
When you add a component to a page or another component, you're creating an instance of that component. Each instance:
93
87
94
88
- Has its own set of attribute values
95
89
- Can be styled independently (affecting only the root element, see [component style overrides](/styling/conditional-styles#component-style-overrides))
96
90
- Works independently of other instances of the same component
97
-
98
-
Understanding how components work and how they fit into the overall structure of your project is the foundation for creating maintainable, scalable websites in Nordcraft.
0 commit comments