all repos — gomponents @ 4904eaacb6cd50fb18d0db4cb6e1a568b104ab86

HTML components in pure Go

Merge remote-tracking branch 'upstream/main'

Alan Pearce
commit

4904eaacb6cd50fb18d0db4cb6e1a568b104ab86

parent

b9d3c0f0ff17145c373c7bed0f923037f85c40a6

1 file changed, 27 insertions(+), 0 deletions(-)

changed files
M README.mdREADME.md
@@ -138,3 +138,30 @@ - `form` (`Form`/`FormAttr`, `FormEl` also exists)
- `label` (`Label`/`LabelAttr`, `LabelEl` also exists) - `style` (`StyleEl`/`Style`, `StyleAttr` also exists) - `title` (`TitleEl`/`Title`, `TitleAttr` also exists) + +<details> + <summary>Example with `Style` and `StyleEl`</summary> + +```go +package html + +import ( + . "maragu.dev/gomponents" + . "maragu.dev/gomponents/components" + . "maragu.dev/gomponents/html" +) + +func MyPage() Node { + return HTML5(HTML5Props{ + Title: "My Page", + Head: []Node{ + StyleEl(g.Raw("body {background-color: #fff; }")), + }, + Body: []Node{ + H1(Style("color: #000"), Text("My Page")), + }, + }) +} +``` + +</details>