Documentation ¶
Overview ¶
templ: version: v0.2.778
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func C ¶
Example ¶
package main import ( "github.com/a-h/templ" "github.com/jfbus/templ-components/components/accordion" "github.com/jfbus/templ-components/components/accordion/element" ) var yourcomponent = func() templ.Component { return templ.Raw("Content") } func main() { accordion.C(accordion.D{ ID: "accordion", Children: []element.D{{ Open: true, Title: "First", Content: yourcomponent(), }, { Title: "Second", Content: yourcomponent(), }}, }) }
Output:
Types ¶
type D ¶
type D struct { // ID is the accordion ID (mandatory). ID string // Children defines the list of elements in the accordion. //templplayground:import:github.com/jfbus/templ-components/components/helper //templplayground:default:[]element.D{{Title: "Section 1", Content:helpers.S("Content 1")},{Title: "Section 2", Content:helpers.S("Content 2")}) Children []element.D // CustomStyle defines a custom style for children elements. // style.Custom{ // "accordion/element/title": style.D{style.Add("text-xl")}, // "accordion/element/content": style.D{style.Add("text-sm")}, // } CustomStyle style.Custom }
D defines an accordion.
Click to show internal directories.
Click to hide internal directories.