Documentation
¶
Index ¶
- Constants
- Variables
- func CSSPath(path string) []gomponents.Node
- func FA(style faStyle, name string, children ...any) *b.Element
- func Icon(style faStyle, name string, children ...any) *b.Element
- func OList(lines ...Li) *b.Element
- func Stack(children ...any) *b.Element
- func UList(lines ...Li) *b.Element
- type Animation
- type AnimationBase
- type AnimationDirection
- type AnimationTiming
- type Beat
- type BeatFade
- type Bounce
- type FaClass
- type Fade
- type Flip
- type Li
- type Rotate
- type Shake
- type Spin
- type SpinPulse
- type SpinPulseReverse
- type SpinReverse
Constants ¶
const ( Brand = faStyle("fa-brands") Duotone = faStyle("fa-duotone") Light = faStyle("fa-light") SharpLight = faStyle("fa-sharp fa-light") Regular = faStyle("fa-regular") SharpRegular = faStyle("fa-sharp fa-regular") Solid = faStyle("fa-solid") SharpSolid = faStyle("fa-sharp fa-solid") Thin = faStyle("fa-thin") SharpThin = faStyle("fa-sharp fa-thin") )
Styles
const ( Border = FaClass("fa-border") FixedWidth = FaClass("fa-fw") Inverse = FaClass("fa-inverse") Pulse = FaClass("fa-pulse") )
Variations
const ( Rotate90 = FaClass("fa-rotate-90") Rotate180 = FaClass("fa-rotate-180") Rotate270 = FaClass("fa-rotate-270") FlipHorizontal = FaClass("fa-flip-horizontal") FlipVertical = FaClass("fa-flip-vertical") FlipBoth = FaClass("fa-flip-both") )
Rotation (see https://fontawesome.com/docs/web/style/rotate)
const ( Stack1x = FaClass("fa-stack-1x") Stack2x = FaClass("fa-stack-2x") )
Variables ¶
var ( Size2Xs = FaClass("fa-2xs") SizeXs = FaClass("fa-xs") SizeSm = FaClass("fa-sm") SizeLg = FaClass("fa-lg") SizeXl = FaClass("fa-xl") Size2Xl = FaClass("fa-2xl") Size1x = FaClass("fa-1x") Size2x = FaClass("fa-2x") Size3x = FaClass("fa-3x") Size4x = FaClass("fa-4x") Size5x = FaClass("fa-5x") Size6x = FaClass("fa-6x") Size7x = FaClass("fa-7x") Size8x = FaClass("fa-8x") Size9x = FaClass("fa-9x") Size10x = FaClass("fa-10x") )
Font-Awesome icons sizes
var Assets embed.FS
var CSSHandler = http.FileServer(http.FS(Assets))
CSSHandler is a http handler function for Font Awesome assets
Functions ¶
func CSSPath ¶
func CSSPath(path string) []gomponents.Node
func FA ¶
FA returns a Font-Awesome icon, in an i element, with the provided style and name (without the "fa-" prefix).
- when a child id a FaClass, it is added as a class to the i element
- when a child is a b.ColorClass, its Text() variant is added as a class to the i element
- when a child is a Rotate, the provided rotation (in degree) is applied to the icon
- all other children types are added as-is to the i element
The rotating+flipping combination is supported and the needed span element is automatically created when needed.
func Icon ¶
Icon returns a Font-Awesome icon, in an i element within a b.Icon element, with the provided style and name (without the "fa-" prefix).
- when a child id a FaClass, it is added to the i element
- when a child is a b.ColorClass, its Text() variant is added as a class to the b.Icon
- all other children types are added as-is to the b.Icon
See the FA documentation for more information.
func OList ¶
OList replaces numbers with icons in ol lists. When the Icon attribute is nil, the fa-minus icon is used. When not nil, the Icon attribute should be a return value of FA.
If the Child element is of type []any, all its elements are added as children to the li element.
func Stack ¶
Stack stacks Font-Awesome children icons.
- when a child is a FaClass, it is added as a b.Class to the stack element
- other children types are added as-is to the stack element
Stacked icons must be created with the FA function.
Types ¶
type AnimationBase ¶
type AnimationBase struct { Delay float64 // seconds Direction AnimationDirection Duration float64 // seconds IterationCount float64 Timing AnimationTiming }
type AnimationDirection ¶
type AnimationDirection string
const ( AnimationDirectionNormal AnimationDirection = "normal" AnimationDirectionReverse AnimationDirection = "reverse" AnimationDirectionAlternate AnimationDirection = "alternate" AnimationDirectionAlternateReverse AnimationDirection = "alternate-reverse" )
type AnimationTiming ¶
type AnimationTiming string
const ( AnimationTimingEase AnimationTiming = "ease" AnimationTimingLinear AnimationTiming = "linear" AnimationTimingEaseIn AnimationTiming = "ease-in" AnimationTimingEaseOut AnimationTiming = "ease-out" AnimationTimingEaseInOut AnimationTiming = "ease-in-out" AnimationTimingStepStart AnimationTiming = "step-start" AnimationTimingStepEnd AnimationTiming = "step-end" )
type Beat ¶
type Beat struct { AnimationBase MaxScale float64 }
Beat adds a beat animation to a FA icon.
type BeatFade ¶
type BeatFade struct { AnimationBase MaxScale float64 MinOpacity float64 }
BeatFade adds a beat and a fade animations to a FA icon.
type Bounce ¶
type Bounce struct { AnimationBase Rebound float64 Height float64 StartScaleX float64 StartScaleY float64 JumpScaleX float64 JumpScaleY float64 LandScaleX float64 LandScaleY float64 }
Bounce adds a bounce animation to a FA icon.
type Fade ¶
type Fade struct { AnimationBase MinOpacity float64 }
Fade adds a fade animation to a FA icon.
type Flip ¶
type Flip struct { AnimationBase X float64 Y float64 Z float64 Angle float64 }
Flip adds a flip animation to a FA icon.
type SpinPulse ¶
type SpinPulse struct {
AnimationBase
}
SpinPulse adds a 8-steps spin animation to a FA icon.
type SpinPulseReverse ¶
type SpinPulseReverse struct {
AnimationBase
}
SpinPulseReverse adds a 8-steps reverse spin animation to a FA icon.
type SpinReverse ¶
type SpinReverse struct {
AnimationBase
}
SpinReverse adds a reverse spin animation to a FA icon.