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
To get started with **gluestack-ui v2**, check out this quick installation guide. It provides simple steps to help you install and use the library in your projects.
21
21
22
-
23
-
### Step 1: Setup your project.
24
-
25
-
Setup your project with [Next.js](https://nextjs.org/docs/getting-started/installation) or [Expo](https://docs.expo.dev/get-started/create-a-project/).
26
-
27
-
28
-
### Step 2: Initialize
29
-
30
22
<br />
31
23
32
24
<Tabsvalue="cli"type="section">
@@ -44,18 +36,33 @@ Setup your project with [Next.js](https://nextjs.org/docs/getting-started/instal
44
36
45
37
<br />
46
38
39
+
### Step 1: Initialize
40
+
47
41
Use `init` command to add `GluestackUIProvider` and `gluestack-ui-provider/config.ts` file into your project.
48
42
49
43
```bash
50
44
npx gluestack-ui init
51
45
```
52
46
47
+
Your project is now ready to use **gluestack-ui** components. To add gluestack-ui components to your project using the CLI, refer to the above command or use the [CLI guide](/ui/docs/home/getting-started/cli).
48
+
49
+
```bash
50
+
npx gluestack-ui add box
51
+
```
52
+
53
+
If you encounter issues during the CLI installation, refer to the manual installation guide available.
54
+
53
55
</>
54
56
</Tabs.TabPanel>
55
57
<Tabs.TabPanelvalue="manual">
56
58
<>
59
+
<br />
57
60
58
-
### Step 2.1: Install dependencies
61
+
### Step 1: Setup your project.
62
+
63
+
Setup nativewind in your project following [NativeWind documentation](https://www.nativewind.dev/v4/getting-started/react-native).
64
+
65
+
### Step 2: Install dependencies
59
66
60
67
Install the dependencies of gluestack-ui in your project. This can be done using the following command:
61
68
@@ -71,15 +78,15 @@ npm i @gluestack-ui/nativewind-utils
71
78
72
79
```
73
80
74
-
### Step 2.2: Update Tailwind configuration
81
+
### Step 2.1: Update Tailwind configuration
75
82
76
83
Update `tailwind.config.js` file with the following code
77
84
78
85
```js
79
86
%%--File:tailwind.config.js--%%
80
87
```
81
88
82
-
### Step 2.3: Configure components path
89
+
### Step 2.2: Configure components path
83
90
84
91
Create a `components/ui` folder inside `src` folder and add path in `tsconfig.json`
85
92
@@ -94,7 +101,7 @@ Create a `components/ui` folder inside `src` folder and add path in `tsconfig.js
94
101
}
95
102
```
96
103
97
-
### Step 2.4: Configure GluestackUIProvider
104
+
### Step 2.3: Configure GluestackUIProvider
98
105
99
106
To add config, create a `gluestack-ui-provider/config.ts` file in your `components/ui` folder and paste the following code.
100
107
@@ -128,11 +135,6 @@ To add `GluestackUIProvider`, create a `gluestack-ui-provider/index.web.tsx` fil
128
135
129
136
</CollapsibleCode>
130
137
131
-
</>
132
-
</Tabs.TabPanel>
133
-
</Tabs.TabPanels>
134
-
</Tabs>
135
-
136
138
### Step 3: Configure GluestackUIProvider in project
137
139
138
140
Wrap your app with `GluestackUIProvider` in `App.tsx`.
@@ -162,6 +164,7 @@ It's also recommended to set up your server-side rendering (SSR) correctly. To d
162
164
<Tabs.TabPanels>
163
165
<Tabs.TabPanelvalue="App Router">
164
166
<>
167
+
<br/>
165
168
166
169
For Next.js App Routers we will create a new `registry.tsx` file in the root of your project and use the flush function from `@gluestack-ui/nativewind-utils`
167
170
@@ -239,6 +242,7 @@ export default function RootLayout({
239
242
</Tabs.TabPanel>
240
243
<Tabs.TabPanelvalue="Page Router">
241
244
<>
245
+
<br/>
242
246
243
247
244
248
For Next.js we will add this code in `_document.tsx` file.
@@ -277,6 +281,11 @@ export default Document;
277
281
</Tabs.TabPanels>
278
282
</Tabs>
279
283
284
+
</>
285
+
</Tabs.TabPanel>
286
+
</Tabs.TabPanels>
287
+
</Tabs>
288
+
280
289
## Common issues
281
290
**Expo app stuck in `tailwindcss(ios) rebuilding...` while running `expo start` command**
0 commit comments