Documentation ¶
Index ¶
- Variables
- func Build(view HTMLView) *html.Node
- func Render(w io.Writer, views ...HTMLView)
- func SpecialButton(options ...func(input ButtonView) ButtonView) func(children ...HTMLView) ButtonView
- type ButtonView
- type ClassNames
- func (classNames ClassNames) Class(additions ...string) ClassNames
- func (classNames ClassNames) Concat(additions ClassNames) ClassNames
- func (classNames ClassNames) Md(additions ...TailwindClassName) ClassNames
- func (classNames ClassNames) String() string
- func (classNames ClassNames) Tailwind(additions ...TailwindClassName) ClassNames
- type ClassNamesChanger
- type FieldFileInputOption
- type FieldHTMLView
- type FieldInputProps
- type FieldNumberInputOption
- type FieldOption
- type FieldTextInputOption
- type FormHTMLView
- type HTMLAttrView
- type HTMLClassNameView
- type HTMLElementCore
- type HTMLElementView
- func Article(children ...HTMLView) HTMLElementView
- func Aside(children ...HTMLView) HTMLElementView
- func Button(children ...HTMLView) HTMLElementView
- func Div(children ...HTMLView) HTMLElementView
- func DivWithClasses(classNames ClassNames, children ...HTMLView) HTMLElementView
- func Footer(children ...HTMLView) HTMLElementView
- func HTMLElementViewOf(tagName string, tagAtom atom.Atom, children []HTMLView) HTMLElementView
- func Header(children ...HTMLView) HTMLElementView
- func Img(srcURL string, alt string, enhancers ...HTMLEnhancer) HTMLElementView
- func Li(children ...HTMLView) HTMLElementView
- func Link(url string, children ...HTMLView) HTMLElementView
- func List(children ...HTMLView) HTMLElementView
- func Main(children ...HTMLView) HTMLElementView
- func Nav(children ...HTMLView) HTMLElementView
- func Noscript(children ...HTMLView) HTMLElementView
- func P(children ...HTMLView) HTMLElementView
- func Section(children ...HTMLView) HTMLElementView
- func SubmitButton(children ...HTMLView) HTMLElementView
- func TextWith(text string, enhancers ...HTMLEnhancer) HTMLElementView
- func Ul(children ...HTMLView) HTMLElementView
- func (el HTMLElementView) AddClasses(additions ClassNames) HTMLElementView
- func (el HTMLElementView) ChangeClasses(changer func(classNames ClassNames) ClassNames) HTMLElementView
- func (el HTMLElementView) Class(classNames ...string) HTMLElementView
- func (basic HTMLElementView) Md(classNames ...TailwindClassName) HTMLElementView
- func (basic HTMLElementView) Tailwind(additions ...TailwindClassName) HTMLElementView
- func (el HTMLElementView) Use(enhancers ...HTMLEnhancer) HTMLElementView
- func (el HTMLElementView) UseWhen(when bool, enhancers ...HTMLEnhancer) HTMLElementView
- type HTMLEnhancer
- type HTMLText
- type HTMLView
- type Heading
- type TailwindClassName
Constants ¶
This section is empty.
Variables ¶
var AriaCurrentPage = HTMLAttrView{Key: "aria-current", Value: "page"}
var FocusViaScript = HTMLAttrView{Key: "tabindex", Value: "-1"}
FocusViaScript allows a script to focus this element. It sets the tabindex to -1
var FocusViaTab = HTMLAttrView{Key: "tabindex", Value: "0"}
FocusViaTab allows the user to focus this element with the tab key. It sets the tabindex to 0
Functions ¶
func SpecialButton ¶
func SpecialButton(options ...func(input ButtonView) ButtonView) func(children ...HTMLView) ButtonView
Types ¶
type ButtonView ¶
type ButtonView struct {
// contains filtered or unexported fields
}
ButtonView makes <button>
func ButtonOld ¶
func ButtonOld(children ...HTMLView) ButtonView
func ButtonSubmit ¶
func ButtonSubmit(input ButtonView) ButtonView
func (ButtonView) Submit ¶
func (button ButtonView) Submit() ButtonView
type ClassNames ¶
type ClassNames []string
ClassNames is a slice of class names
func TailwindToClass ¶
func TailwindToClass(additions ...TailwindClassName) ClassNames
func (ClassNames) Class ¶
func (classNames ClassNames) Class(additions ...string) ClassNames
Class adds the passed class names
func (ClassNames) Concat ¶
func (classNames ClassNames) Concat(additions ClassNames) ClassNames
Concat adds all the class names from another instance
func (ClassNames) Md ¶
func (classNames ClassNames) Md(additions ...TailwindClassName) ClassNames
func (ClassNames) String ¶
func (classNames ClassNames) String() string
Strings converts the class names to a single, space-separated string
func (ClassNames) Tailwind ¶
func (classNames ClassNames) Tailwind(additions ...TailwindClassName) ClassNames
type ClassNamesChanger ¶
type ClassNamesChanger func(classNames ClassNames) ClassNames
func TailwindChanger ¶
func TailwindChanger(additions ...TailwindClassName) ClassNamesChanger
func (ClassNamesChanger) Md ¶
func (changer ClassNamesChanger) Md(additions ...TailwindClassName) ClassNamesChanger
func (ClassNamesChanger) Tailwind ¶
func (changer ClassNamesChanger) Tailwind(additions ...TailwindClassName) ClassNamesChanger
type FieldFileInputOption ¶
type FieldFileInputOption func(FieldHTMLView) FieldHTMLView
func FileInput ¶
func FileInput(inputName string, options ...FieldFileInputOption) FieldFileInputOption
func (FieldFileInputOption) Use ¶
func (option FieldFileInputOption) Use(enhancers ...HTMLEnhancer) FieldFileInputOption
type FieldHTMLView ¶
type FieldHTMLView struct {
// contains filtered or unexported fields
}
func FieldLabelled ¶
func FieldLabelled(labelText string, option FieldOption, children ...HTMLEnhancer) FieldHTMLView
func (FieldHTMLView) Class ¶
func (field FieldHTMLView) Class(className string) FieldHTMLView
type FieldInputProps ¶
type FieldInputProps struct {
// contains filtered or unexported fields
}
type FieldNumberInputOption ¶
type FieldNumberInputOption func(FieldHTMLView) FieldHTMLView
func NumberInput ¶
func NumberInput(inputName string, options ...FieldNumberInputOption) FieldNumberInputOption
func (FieldNumberInputOption) Use ¶
func (option FieldNumberInputOption) Use(enhancers ...HTMLEnhancer) FieldNumberInputOption
type FieldOption ¶
type FieldOption interface {
// contains filtered or unexported methods
}
type FieldTextInputOption ¶
type FieldTextInputOption func(FieldHTMLView) FieldHTMLView
func Textbox ¶
func Textbox(inputName string, options ...FieldTextInputOption) FieldTextInputOption
func (FieldTextInputOption) DefaultValue ¶
func (option FieldTextInputOption) DefaultValue(value string) FieldTextInputOption
func (FieldTextInputOption) Rows ¶
func (option FieldTextInputOption) Rows(rows int) FieldTextInputOption
func (FieldTextInputOption) Use ¶
func (option FieldTextInputOption) Use(enhancers ...HTMLEnhancer) FieldTextInputOption
type FormHTMLView ¶
FormHTMLView makes <form> with the provided Method and Action <form method="post" action="/pictures" enctype="multipart/form-data" class="mb-4 flex flex-row items-end">
func FormTo ¶
func FormTo(action string, options ...func(form FormHTMLView) FormHTMLView) FormHTMLView
FormTo an action URL
func Multipart ¶
func Multipart(form FormHTMLView) FormHTMLView
func (FormHTMLView) Multipart ¶
func (form FormHTMLView) Multipart() FormHTMLView
Multipart sets the `enctype` attribute to "multipart/form-data"
func (FormHTMLView) With ¶
func (form FormHTMLView) With(view ...HTMLView) FormHTMLView
With adds the provided views as children
type HTMLAttrView ¶
HTMLAttrView allows setting HTML attributes
func AriaAttr ¶
func AriaAttr(key string, value string) HTMLAttrView
AriaAttr is for aria attributes such as aria-label or aria-current
func AriaHidden ¶
func AriaHidden() HTMLAttrView
AriaHidden removes the element from the accessibility tree, hiding from screen readers
func CustomAttr ¶
func CustomAttr(key string, value string) HTMLAttrView
CustomAttr is for data attributes such as href or src
func DataAttr ¶
func DataAttr(key string, value string) HTMLAttrView
DataAttr is for data attributes such as data-testid or data-anything
type HTMLClassNameView ¶
type HTMLClassNameView struct {
// contains filtered or unexported fields
}
HTMLClassNameView allows adding to the class attribute
func Tailwind ¶
func Tailwind(additions ...TailwindClassName) HTMLClassNameView
Tailwind adds TailwindCSS class names
func (HTMLClassNameView) Concat ¶
func (view HTMLClassNameView) Concat(other HTMLClassNameView) HTMLClassNameView
Concat appends the classes from the HTMLClassNameView specified
func (HTMLClassNameView) ConcatClassNames ¶
func (view HTMLClassNameView) ConcatClassNames(additions ClassNames) HTMLClassNameView
ConcatClassNames appends the ClassNames specified
type HTMLElementCore ¶
type HTMLElementCore struct {
// contains filtered or unexported fields
}
HTMLElementCore is shared by various components to perform much of the work of creating an HTML element node
func (HTMLElementCore) Use ¶
func (core HTMLElementCore) Use(enhancers ...HTMLEnhancer) HTMLElementCore
Use the provided enhancers
type HTMLElementView ¶
type HTMLElementView struct {
// contains filtered or unexported fields
}
HTMLElementView can be adapted to many types of HTML elements
func Article ¶
func Article(children ...HTMLView) HTMLElementView
func Aside ¶
func Aside(children ...HTMLView) HTMLElementView
func Button ¶
func Button(children ...HTMLView) HTMLElementView
func Div ¶
func Div(children ...HTMLView) HTMLElementView
func DivWithClasses ¶
func DivWithClasses(classNames ClassNames, children ...HTMLView) HTMLElementView
func Footer ¶
func Footer(children ...HTMLView) HTMLElementView
func HTMLElementViewOf ¶
func HTMLElementViewOf(tagName string, tagAtom atom.Atom, children []HTMLView) HTMLElementView
func Header ¶
func Header(children ...HTMLView) HTMLElementView
func Img ¶
func Img(srcURL string, alt string, enhancers ...HTMLEnhancer) HTMLElementView
func Li ¶
func Li(children ...HTMLView) HTMLElementView
func Link ¶
func Link(url string, children ...HTMLView) HTMLElementView
func List ¶
func List(children ...HTMLView) HTMLElementView
func Main ¶
func Main(children ...HTMLView) HTMLElementView
func Nav ¶
func Nav(children ...HTMLView) HTMLElementView
func Noscript ¶
func Noscript(children ...HTMLView) HTMLElementView
func P ¶
func P(children ...HTMLView) HTMLElementView
func Section ¶
func Section(children ...HTMLView) HTMLElementView
func SubmitButton ¶
func SubmitButton(children ...HTMLView) HTMLElementView
func TextWith ¶
func TextWith(text string, enhancers ...HTMLEnhancer) HTMLElementView
func Ul ¶
func Ul(children ...HTMLView) HTMLElementView
func (HTMLElementView) AddClasses ¶
func (el HTMLElementView) AddClasses(additions ClassNames) HTMLElementView
func (HTMLElementView) ChangeClasses ¶
func (el HTMLElementView) ChangeClasses(changer func(classNames ClassNames) ClassNames) HTMLElementView
func (HTMLElementView) Class ¶
func (el HTMLElementView) Class(classNames ...string) HTMLElementView
func (HTMLElementView) Md ¶
func (basic HTMLElementView) Md(classNames ...TailwindClassName) HTMLElementView
func (HTMLElementView) Tailwind ¶
func (basic HTMLElementView) Tailwind(additions ...TailwindClassName) HTMLElementView
func (HTMLElementView) Use ¶
func (el HTMLElementView) Use(enhancers ...HTMLEnhancer) HTMLElementView
func (HTMLElementView) UseWhen ¶
func (el HTMLElementView) UseWhen(when bool, enhancers ...HTMLEnhancer) HTMLElementView
type HTMLEnhancer ¶
type HTMLEnhancer interface { HTMLView // contains filtered or unexported methods }
HTMLEnhancer adds attributes but doesn’t add children
type HTMLView ¶
type HTMLView interface {
// contains filtered or unexported methods
}
HTMLView applies changes to an html.Node, such as making it into an element or text node, or adding attributes
type Heading ¶
type Heading struct {
// contains filtered or unexported fields
}
Heading lets you render h1, h2, h3, etc
type TailwindClassName ¶
type TailwindClassName string
TailwindClassName is a subset of strings allowed as Tailwind class names
const ( // MaxWLG max width to lg breakpoint MaxWLG TailwindClassName = "max-w-lg" // Pt1 padding top of 1 Pt1 TailwindClassName = "pt-1" // Pt2 padding top of 2 Pt2 TailwindClassName = "pt-2" // Pt4 padding top of 4 Pt4 TailwindClassName = "pt-4" // Pt8 padding top of 8 Pt8 TailwindClassName = "pt-8" // Pb1 padding bottom of 1 Pb1 TailwindClassName = "pb-1" // Pb2 padding bottom of 2 Pb2 TailwindClassName = "pb-2" // Pb4 padding bottom of 4 Pb4 TailwindClassName = "pb-4" // Pb8 padding bottom of 8 Pb8 TailwindClassName = "pb-8" // Pl1 padding left of 1 Pl1 TailwindClassName = "pl-1" // Pl2 padding left of 2 Pl2 TailwindClassName = "pl-2" // Pl3 padding left of 3 Pl3 TailwindClassName = "pl-3" // Pr1 padding right of 1 Pr1 TailwindClassName = "pr-1" // Pr2 padding right of 2 Pr2 TailwindClassName = "pr-2" // Pr3 padding right of 3 Pr3 TailwindClassName = "pr-3" // Px3 padding left and right of 3 Px3 TailwindClassName = "px-3" // Py1 padding top and bottom of 1 Py1 TailwindClassName = "py-1" // MxAuto margin left and right of auto MxAuto TailwindClassName = "mx-auto" // Mb8 margin bottom of 8 Mb8 TailwindClassName = "mb-8" // TextXS text of small size TextXS TailwindClassName = "text-xs" // TextSM text of small size TextSM TailwindClassName = "text-sm" // TextBase text of size 1rem TextBase TailwindClassName = "text-base" // TextXL text of XL size TextXL TailwindClassName = "text-xl" // Text2XL text of 2XL size Text2XL TailwindClassName = "text-2xl" // TextBlue300 blue text light 300 TextBlue300 TailwindClassName = "text-blue-300" // BgBlue700 blue background dark 700 BgBlue700 TailwindClassName = "bg-blue-700" // BgBlue800 blue background dark 800 BgBlue800 TailwindClassName = "bg-blue-800" // FontBold bold font weight FontBold TailwindClassName = "font-bold" // Italic font style Italic TailwindClassName = "italic" // NotItalic back to roman font style NotItalic TailwindClassName = "not-italic" // RoundedFull rounded corners in a pill shape RoundedFull TailwindClassName = "rounded-full" )
func Hover ¶
func Hover(baseName TailwindClassName) TailwindClassName