@@ -4,17 +4,16 @@ Integrating Feliz.Shadcn into your SAFE Stack application is straightforward. Th
4
4
5
5
We will be using the [ Feliz.Shadcn] ( https://github.com/reaptor/feliz.shadcn ) wrapper written by [ reaptor] ( https://github.com/reaptor )
6
6
7
- 1 . Setup Tailwind
7
+ #### 1. Setup Tailwind
8
+ > Note: When you use the SAFE template you will already have Tailwind installed by default. You can skip this step.
8
9
9
- > Note: When you use the SAFE template you will already have Tailwind installed by default. You can skip this step.
10
+ Check out the following recipe here to install Tailwind: [ Add Tailwind ] ( https://safe-stack.github.io/docs/recipes/ui/add-tailwind/ )
10
11
11
- Check out the following recipe here to install tailwind: [ Add Tailwind ] ( https://safe-stack.github.io/docs/recipes/ui/add-tailwind/ )
12
+ #### 2. Move ` package.json ` & ` package-lock.json ` to ` /src/Client `
12
13
13
- 1 . Move ` package.json ` & ` package-lock.json ` to /src/Client
14
+ #### 3. Configure import alias in tsconfig:
14
15
15
- 1 . Configure import alias in tsconfig:
16
-
17
- Create a file named tsconfig.json in ` /src/Client ` and add the following:
16
+ Create a file named ` tsconfig.json ` in ` /src/Client ` and add the following:
18
17
19
18
``` json
20
19
{
@@ -30,7 +29,23 @@ Create a file named tsconfig.json in `/src/Client` and add the following:
30
29
}
31
30
```
32
31
33
- 1 . Install shadcn/ui
32
+ #### 4. Update the ` vite.config.mts ` within ` /src/Client `
33
+
34
+ Add the ` resolve ` property below under the ` defineConfig `
35
+
36
+ ```
37
+ export default defineConfig({
38
+ ...
39
+ resolve: {
40
+ alias: {
41
+ "@": path.resolve(__dirname),
42
+ },
43
+ },
44
+ ...
45
+ });
46
+ ```
47
+
48
+ #### 5. Install shadcn/ui
34
49
35
50
> Note: ensure your node version is > 20.5.0
36
51
@@ -40,34 +55,34 @@ npx shadcn@latest init
40
55
41
56
You will be asked a few questions to configure components.json
42
57
43
- 1 . Add Feliz.Shadcn
58
+ #### 6. Add Feliz.Shadcn
44
59
45
60
Inside the ` /src/Client ` directory run:
46
61
47
62
```
48
63
dotnet add package Feliz.Shadcn
49
64
```
50
65
51
- 1 . Start adding any shadcn component
66
+ #### 7 . Start adding any shadcn component
52
67
53
68
Specify first which components you want to use.
54
69
You can find the list of available components [ here] ( https://reaptor.github.io/Feliz.Shadcn/ ) :
55
70
56
71
```
57
- npx shadcn@latest add button
72
+ npx shadcn@latest add button
58
73
```
59
74
60
- 1 . Then use it in Feliz:
75
+ #### 8. Use it in Feliz:
61
76
62
77
``` fsharp
63
78
open Feliz.Shadcn
64
79
65
80
66
- let view =
81
+ let view =
67
82
Shadcn.button [
68
83
prop.text "Button" ]
69
84
70
85
```
71
86
72
87
Congratulations, now you can use shadcn components!
73
- Documentation can be found at [ https://reaptor.github.io/Feliz.Shadcn/ ] ( https://reaptor.github.io/Feliz.Shadcn/ )
88
+ Further documentation can be found at [ https://reaptor.github.io/Feliz.Shadcn/ ] ( https://reaptor.github.io/Feliz.Shadcn/ )
0 commit comments