radio

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Nov 14, 2024 License: MIT Imports: 4 Imported by: 0

Documentation

Overview

Package radio implements radio fields.

templ: version: v0.2.793

Index

Examples

Constants

This section is empty.

Variables

This section is empty.

Functions

func C

func C(def D) templ.Component

Types

type D

type D struct {
	// ID is the input id (Name if not set).
	ID string
	// Name is the input name.
	Name string
	// Label is the input label (either a string, a label.D or a templ.Component).
	Label any
	// Value is the input value.
	Value   string
	Checked bool
	// Disabled disables the input.
	Disabled bool
	// CustomStyle defines a custom style.
	// 	style.Custom{
	// 		"radio":       style.D{style.Add("...")},
	// 		"radio/input": style.D{style.Add("...")},
	// 		"radio/label": style.D{style.Add("...")},
	//	}
	CustomStyle style.Custom
	// Attributes stores additional attributes (e.g. HTMX attributes).
	Attributes templ.Attributes
}

D is the definition for radio fields.

Example
package main

import (
	"context"
	"os"

	"github.com/jfbus/templui/components/radio"
)

func main() {
	c := radio.C(radio.D{
		Name:  "accept",
		Label: "Title",
	})
	_ = c.Render(context.TODO(), os.Stdout)
}
Output:

Jump to

Keyboard shortcuts

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