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
vdom.UseSetAppTitle(ctx, "My Tsunami App") // Only works in top-level App component
33
+
34
+
return vdom.H("div", nil,
35
+
// app content
36
+
)
37
+
},
38
+
)
35
39
```
36
40
37
41
## Building Elements with vdom.H()
@@ -183,7 +187,7 @@ Helper functions:
183
187
184
188
## Style Handling
185
189
186
-
Tsunami applications use Tailwind v4 CSS by default for styling. You can also define inline styles using a map[string]any in the props:
190
+
Tsunami applications use Tailwind v4 CSS by default for styling (className prop). You can also define inline styles using a map[string]any in the props:
if event.EventType != "onKeyDown" || event.KeyData == nil {
600
598
return
601
599
}
@@ -645,10 +643,9 @@ type WaveKeyboardEvent struct {
645
643
}
646
644
```
647
645
648
-
When using global keyboard events, remember to:
646
+
When using global keyboard events:
649
647
650
-
1. Enable GlobalKeyboardEvents in AppOpts
651
-
2. Set up the handler in a place where you have access to necessary state updates
648
+
Global keyboard events are automatically enabled when you set a global event handler. Set up the handler in a place where you have access to necessary state updates.
652
649
653
650
## File Handling
654
651
@@ -712,12 +709,8 @@ import (
712
709
"github.com/wavetermdev/waveterm/tsunami/vdom"
713
710
)
714
711
715
-
funcinit() {
716
-
// Set up the default client with Tailwind styles
717
-
app.SetAppOpts(app.AppOpts{
718
-
Title: "My Tsunami App",
719
-
})
720
-
}
712
+
// Tsunami applications automatically include Tailwind v4 CSS
713
+
// No setup required - just use Tailwind classes in your components
721
714
722
715
// Basic domain types with json tags for props
723
716
type Todo struct {
@@ -843,17 +836,10 @@ var App = app.DefineComponent("App",
843
836
Key points:
844
837
845
838
1. Root component must be named "App"
846
-
2. Use `init()`function to configure app options
847
-
3.No main() function is needed - the framework handles app lifecycle
839
+
2. Use `vdom.UseSetAppTitle()` in the main App component to set the window title
840
+
3. Do NOT write a main() function - the framework handles app lifecycle
848
841
4. File handlers can be registered in init() if needed
849
842
850
-
```
851
-
type AppOpts struct {
852
-
Title string // window title
853
-
GlobalKeyboardEvents bool
854
-
}
855
-
```
856
-
857
843
## Important Technical Details
858
844
859
845
- Props must be defined as Go structs with json tags
@@ -863,7 +849,7 @@ type AppOpts struct {
863
849
- Provide keys when using ForEach() with lists (using WithKey() method)
864
850
- Use Classes() with If() for combining static and conditional class names
865
851
- Consider cleanup functions in UseEffect() for async operations
866
-
- <script> tags are not supported
852
+
- <script> tags are NOT supported
867
853
- Applications consist of a single file: app.go containing all Go code and component definitions
868
854
- Styling is handled through Tailwind v4 CSS classes
869
855
- No main() function is needed - use init() for configuration
0 commit comments