package components
import "maragu.dev/gomponents/components"
Package components provides high-level components and helpers that are composed of low-level elements and attributes.
Index ¶
- func HTML5(p HTML5Props) g.Node
- type Classes
- func (c Classes) Render(w io.Writer) error
- func (c Classes) String() string
- func (c Classes) Type() g.NodeType
- type HTML5Props
Examples ¶
Functions ¶
func HTML5 ¶
func HTML5(p HTML5Props) g.Node
HTML5 document template.
Types ¶
type Classes ¶
Classes is a map of strings to booleans, which Renders to an attribute with name "class".
The attribute value is a sorted, space-separated string of all the map keys,
for which the corresponding map value is true.
Code:
Output:Example¶
{
e := g.El("div", Classes{"party-hat": true, "boring-hat": false})
_ = e.Render(os.Stdout)
// Output: <div class="party-hat"></div>
}
<div class="party-hat"></div>
func (Classes) Render ¶
Render satisfies g.Node.
func (Classes) String ¶
String satisfies fmt.Stringer.
func (Classes) Type ¶
type HTML5Props ¶
type HTML5Props struct { Title string Description string Language string Head []g.Node Body []g.Node }
HTML5Props for HTML5. Title is set no matter what, Description and Language elements only if the strings are non-empty.
Source Files ¶
components.go
- Version
- v1.0.0 (latest)
- Published
- Oct 11, 2024
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 1 month ago –
Tools for package owners.