Files
iris/ui/text.go
Hugo Nijhuis 2b2b8978d8
All checks were successful
CI / build (pull_request) Successful in 28s
Remove internal package import from todo example
Replace direct internal/element usage with public ui package
components to ensure examples only use the public API:

- Add ui.RawCheckbox for plain checkbox without label wrapper
- Add ui.Span for span elements with text content
- Add View.TextDecoration modifier for strikethrough styling
- Update todo example to use these public components

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-01-09 17:24:11 +01:00

31 lines
614 B
Go

package ui
import (
"git.flowmade.one/flowmade-one/iris/internal/element"
"git.flowmade.one/flowmade-one/iris/reactive"
)
func TextFromString(text string) View {
v := View{element.NewElement("p")}
v.e.Set("textContent", text)
return v
}
func TextFromFunction(fn func() string) View {
textNode := element.NewElement("p")
reactive.NewEffect(func() {
value := fn()
textNode.Set("textContent", value)
})
return View{textNode}
}
// Span creates a span element with the given text content.
func Span(text string) View {
v := View{element.NewElement("span")}
v.e.Set("textContent", text)
return v
}