accordion

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Nov 12, 2024 License: MIT Imports: 5 Imported by: 0

Documentation

Overview

templ: version: v0.2.778

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func C

func C(def D) templ.Component
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.

Directories

Path Synopsis
templ: version: v0.2.778
templ: version: v0.2.778

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL