uiControl

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: Oct 1, 2026 License: MIT Imports: 7 Imported by: 0

README

Control

Control layer of Infinite UI. It triggers actions and picks values. Components here do not collect form data. Part of Infinite UI.

Button

Button with optional label, icons, tooltip, ring, and shape variants.

@uiControl.Button(uiControl.ButtonSettings{
    Label:       "Click me",
    IconLeft:    "ph-info",
    OnClickFunc: "alert('Button clicked!')",
})
  • Size accepts the uiControl.ButtonSize* constants.
  • Shape accepts ButtonShapeCircular, ButtonShapeRounded, or ButtonShapeSquare.
  • Icons use the ph-bold weight. Pass the icon name alone, for example "ph-floppy-disk".
  • IsDisabled sets a static disabled state. IsDisabledOneWayStatePath disables the button while the path is truthy and dims it.
  • IsVisibleOneWayStatePath hides the button while the path is falsy.
  • IsSubmit renders type="submit" so the button submits its form. Every button renders a type; the default is button, so a button inside a form does not submit it.
  • TooltipContent renders a text tooltip. TooltipContentHtml accepts a component, and TooltipContentOneWayStatePath binds live text. TooltipPosition accepts the ButtonTooltipPosition* constants. The tooltip renders in a fixed layer on the document body. A scroll container cannot clip it or gain a scrollbar from it.
  • BackgroundColor, TextColor, and RingColor accept Tailwind color tokens, for example "red-500/20". The *Hover fields set the hover state.
  • TextCase accepts a uiToolset.TextCase* value and transforms the label. The default, TextCaseNone, leaves it as typed.

RangeSlider

Slider with one or two thumbs, value bubbles, tick marks, and gradient tracks.

@uiControl.RangeSlider(uiControl.RangeSliderSettings{
    ThumbValueTwoWayStatePath: "sliderValue",
    TrackStartValue:           "0",
    TrackEndValue:             "100",
    TrackSteps:                "1",
})
  • The track is configured with TrackStartValue, TrackEndValue, TrackSteps, and the optional TrackStartValueLabel* and TrackEndValueLabel* fields.
  • TrackTooltipEnabled previews the value under the pointer while it moves along the track. The preview snaps to TrackSteps and clamps to the track bounds. TrackTooltipPosition accepts RangeSliderTrackTooltipPositionTop or RangeSliderTrackTooltipPositionBottom; the TrackTooltipBackgroundColor, TrackTooltipTextColor, TrackTooltipRingColor, and TrackTooltipRingThickness fields style it.
  • Single-thumb mode binds ThumbValueTwoWayStatePath. ThumbValueBubbleEnabled shows the current value above the thumb. ThumbValueBubbleDisplayMode accepts RangeSliderThumbValueBubbleDisplayModeAlways (the default) or RangeSliderThumbValueBubbleDisplayModeHover, which shows the bubble only while the slider is hovered or dragged.
  • ThumbDualValueModeEnabled adds a second thumb. Bind it with ThumbUpperValueTwoWayStatePath. The upper thumb mirrors the lower thumb settings through the ThumbUpper* fields.
  • ThumbAriaLabel and ThumbUpperAriaLabel name the thumbs for screen readers. A thumb falls back to its visible label, then to a default name.
  • Thumb corrections run at init and on change: an out-of-bounds value is clamped, and in dual mode the thumbs keep one step of separation.

Documentation

Overview

templ: version: v0.3.1020

templ: version: v0.3.1020

Index

Constants

View Source
const (
	ButtonSizeXs string = "xs"
	ButtonSizeSm string = "sm"
	ButtonSizeMd string = "md"
	ButtonSizeLg string = "lg"
	ButtonSizeXl string = "xl"

	ButtonShapeCircular string = "circular"
	ButtonShapeRounded  string = "rounded"
	ButtonShapeSquare   string = "square"

	ButtonTooltipPositionTop    string = "top"
	ButtonTooltipPositionBottom string = "bottom"
	ButtonTooltipPositionLeft   string = "left"
	ButtonTooltipPositionRight  string = "right"

	ButtonRingThicknessXs string = "xs"
	ButtonRingThicknessSm string = "sm"
	ButtonRingThicknessMd string = "md"
	ButtonRingThicknessLg string = "lg"
	ButtonRingThicknessXl string = "xl"
)
View Source
const (
	RangeSliderSizeXs string = "xs"
	RangeSliderSizeSm string = "sm"
	RangeSliderSizeMd string = "md"
	RangeSliderSizeLg string = "lg"
	RangeSliderSizeXl string = "xl"

	RangeSliderThumbShapeCircular string = "circular"
	RangeSliderThumbShapeRounded  string = "rounded"
	RangeSliderThumbShapeSquare   string = "square"
	RangeSliderThumbShapePipe     string = "pipe"

	RangeSliderThumbValueBubblePositionTop    string = "top"
	RangeSliderThumbValueBubblePositionBottom string = "bottom"

	RangeSliderThumbValueBubbleDisplayModeAlways string = "always"
	RangeSliderThumbValueBubbleDisplayModeHover  string = "hover"

	RangeSliderThumbValueBubbleSizeXs string = "xs"
	RangeSliderThumbValueBubbleSizeSm string = "sm"
	RangeSliderThumbValueBubbleSizeMd string = "md"
	RangeSliderThumbValueBubbleSizeLg string = "lg"
	RangeSliderThumbValueBubbleSizeXl string = "xl"

	RangeSliderThumbValueBubbleShapeCircular string = "circular"
	RangeSliderThumbValueBubbleShapeRounded  string = "rounded"
	RangeSliderThumbValueBubbleShapeSquare   string = "square"

	RangeSliderThumbValueBubbleRingThicknessXs string = "xs"
	RangeSliderThumbValueBubbleRingThicknessSm string = "sm"
	RangeSliderThumbValueBubbleRingThicknessMd string = "md"
	RangeSliderThumbValueBubbleRingThicknessLg string = "lg"
	RangeSliderThumbValueBubbleRingThicknessXl string = "xl"

	RangeSliderTrackValueLabelPositionTop    string = "top"
	RangeSliderTrackValueLabelPositionBottom string = "bottom"

	RangeSliderTrackTooltipPositionTop    string = "top"
	RangeSliderTrackTooltipPositionBottom string = "bottom"

	RangeSliderTrackTooltipRingThicknessXs string = "xs"
	RangeSliderTrackTooltipRingThicknessSm string = "sm"
	RangeSliderTrackTooltipRingThicknessMd string = "md"
	RangeSliderTrackTooltipRingThicknessLg string = "lg"
	RangeSliderTrackTooltipRingThicknessXl string = "xl"
)

Variables

This section is empty.

Functions

func Button

func Button(componentSettings ButtonSettings) templ.Component

func RangeSlider

func RangeSlider(componentSettings RangeSliderSettings) templ.Component

func Thumb

func Thumb(componentSettings RangeSliderSettings, isUpper bool) templ.Component

Types

type ButtonSettings

type ButtonSettings struct {
	// OptionalFields
	Label                         string
	AriaLabel                     string
	BackgroundColor               string
	BackgroundColorHover          string
	IconLeft                      string
	IconLeftOneWayStatePath       string
	IconRight                     string
	IconRightOneWayStatePath      string
	Id                            string
	IsDisabled                    bool
	IsDisabledOneWayStatePath     string
	IsVisibleOneWayStatePath      string
	IsFullWidth                   bool
	IsSubmit                      bool
	OnClickFunc                   string
	OnClickPreventDefault         bool
	Shape                         string
	Size                          string
	TextCase                      string
	TextColor                     string
	TextColorHover                string
	TooltipContent                string
	TooltipContentHtml            templ.Component
	TooltipContentOneWayStatePath string
	TooltipBackgroundColor        string
	TooltipPosition               string
	TooltipRingColor              string
	TooltipRingThickness          string
	TooltipTextColor              string
	RingColor                     string
	RingColorHover                string
	RingThickness                 string
}

type RangeSliderSettings

type RangeSliderSettings struct {
	// OptionalFields
	Size                                 string
	ThumbLabel                           string
	ThumbLabelOneWayStatePath            string
	ThumbLabelIcon                       string
	ThumbAriaLabel                       string
	ThumbBackgroundColor                 string
	ThumbTextColor                       string
	ThumbShape                           string
	ThumbValue                           string
	ThumbValueTwoWayStatePath            string
	ThumbValueBubbleEnabled              bool
	ThumbValueBubbleDisplayMode          string
	ThumbValueBubbleBackgroundColor      string
	ThumbValueBubbleTextColor            string
	ThumbValueBubbleRingColor            string
	ThumbValueBubbleRingThickness        string
	ThumbValueBubbleSize                 string
	ThumbValueBubbleShape                string
	ThumbValueBubblePosition             string
	ThumbDualValueModeEnabled            bool
	ThumbUpperValue                      string
	ThumbUpperValueTwoWayStatePath       string
	ThumbUpperBackgroundColor            string
	ThumbUpperTextColor                  string
	ThumbUpperLabel                      string
	ThumbUpperLabelOneWayStatePath       string
	ThumbUpperLabelIcon                  string
	ThumbUpperAriaLabel                  string
	ThumbUpperValueBubbleEnabled         bool
	ThumbUpperValueBubbleDisplayMode     string
	ThumbUpperValueBubbleBackgroundColor string
	ThumbUpperValueBubbleTextColor       string
	ThumbUpperValueBubbleRingColor       string
	ThumbUpperValueBubbleRingThickness   string
	ThumbUpperValueBubbleSize            string
	ThumbUpperValueBubbleShape           string
	ThumbUpperValueBubblePosition        string
	TrackBackgroundColor                 string
	TrackBackgroundColorFrom             string
	TrackBackgroundColorVia              string
	TrackBackgroundColorTo               string
	TrackSteps                           string
	TrackTicksEnabled                    bool
	TrackTickStep                        string
	TrackTooltipEnabled                  bool
	TrackTooltipPosition                 string
	TrackTooltipBackgroundColor          string
	TrackTooltipTextColor                string
	TrackTooltipRingColor                string
	TrackTooltipRingThickness            string
	TrackFillColor                       string
	TrackFillColorFrom                   string
	TrackFillColorVia                    string
	TrackFillColorTo                     string
	TrackStartValue                      string
	TrackStartValueOneWayStatePath       string
	TrackStartValueLabelEnabled          bool
	TrackStartValueLabelTextColor        string
	TrackStartValueLabelPosition         string
	TrackStartValueLabelIcon             string
	TrackEndValue                        string
	TrackEndValueOneWayStatePath         string
	TrackEndValueLabelEnabled            bool
	TrackEndValueLabelTextColor          string
	TrackEndValueLabelPosition           string
	TrackEndValueLabelIcon               string
	ShouldNormalizeInitialState          bool
}

Jump to

Keyboard shortcuts

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