Documentation
¶
Overview ¶
Package ui is the framework's opinionated component layer on top of core-ui.
The split:
core-ui/: unstyled building blocks (elements, widget, runtime) framework/ui/: semantic components that consume framework/ui/theme
Components in this package express *product intent* rather than HTML primitives: PageHeader, FormField, EmptyState, StatusBadge. Every visual decision routes through framework/ui/theme so a single token swap re-skins the whole app.
Consumers import this package directly:
import "github.com/DonaldMurillo/gofastr/framework/ui"
import "github.com/DonaldMurillo/gofastr/framework/ui/theme"
page := ui.PageHeader(ui.PageHeaderConfig{
Title: "Customers",
Subtitle: "1,283 active",
Actions: ui.Button(ui.ButtonConfig{Label: "Delete all", Variant: ui.ButtonDanger}),
})
If a piece of work maps 1:1 to an HTML element or ARIA pattern, it belongs in core-ui. If it composes primitives to express intent, it belongs here.
Component inventory (alphabetical; kept complete by TestDocGoInventoryComplete in inventory_test.go):
AnchoredRail: sticky in-page nav rail with scrollspy wiring
AnimatedCounter: scroll-triggered number tick animation
AspectRatioComponent: CLS-safe aspect-ratio wrapper (alias: AspectRatio)
AuthCard: centered card shell for login/register/reset forms
Avatar: circular image/initials avatar (sm/md/lg/xl)
AvatarGroup: overlapping avatar stack with overflow chip
BackToTop: fixed scroll-to-top affordance after a threshold
Banner: page-level persistent status strip (dismissible)
BarChart: categorical SVG bar chart
Breadcrumbs: labelled nav trail ending at the current page
Box: padded/bordered layout box
Button: primary/secondary/danger/ghost variants, Disabled, Action wiring seam
Callout: inline info/warning/danger/neutral block
Card: labelled <section> with header/body/footer
Carousel: horizontal scroll-snap slider
Center: layout centering wrapper
Checkbox: labelled checkbox with FieldErrors wiring
CheckboxGroup: <fieldset> of checkboxes with shared label + errors
Cluster: horizontal layout that wraps by default (NoWrap opts out)
CodeBlock: styled <pre><code> sample block
Combobox: input owning a listbox of suggestions (static or island-backed)
CodeTabs: one snippet in several languages behind a zero-JS tab strip
Collapsible: styled <details> disclosure with summary
ColorField: colour swatch beside a text input, one control
ColorPicker: styled native <input type=color>
CommandPalette: ⌘K modal + combobox composition
ConditionalField: form region visible until the watched field mismatches (the runtime hides it)
ConfirmAction: trigger + themed alertdialog modal pair
Container: max-width page wrapper with breakpoint padding
ContentRow: nav column + main + optional context aside row
CopyButton: clipboard button with SR-announced confirmation
Counter: signal-driven counter with +/− buttons
DataTable: sortable/paginated table (island-friendly)
DateField: typed labelled native date field with bounds
DetailList: label/value description list for record detail
DiffViewer: unified or split diff renderer
Divider: <hr> for plain horizontal; role="separator" otherwise
EmptyState: title/description/action block for no-data screens
FactBox: labelled tile (label-first OR value-first KPI)
FileDropzone: hero file-drop surface with image previews
FileUpload: drag-drop file picker over <input type="file">
FilterChipBar: role=toolbar of removable filter chips
FilterToolbar: URL-driven filter/sort/search control strip
Form: opinionated <form> wrapper with submit + errors
FormField: labelled input with required + help + error states
FormRepeater: dynamic list of repeating field groups
FormSection: grouped fields with heading + description
Gallery: Grid/Strip/Masonry thumbnail surface
GlobalSearch: inline persistent /-shortcut search bar
Grid: responsive auto-fit grid
Hero: centered landing hero
HeroSplit: two-column hero (copy + media) with mobile collapse
InputGroup: input with prepend/append addons
JSONViewer: collapsible tree of arbitrary values
Lightbox: zoom-overlay modal; pairs with Gallery
LineChart: multi-series SVG time-series chart
Link: typed-variant anchor with unsafe-href sanitizing
LinkButton: anchor styled as Button, for CTAs that navigate
ListDetail: kept scrollable list beside routed detail, stacked on phones
ListDetailPlaceholder: unselected detail for a single-pane phone list/detail view
Markdown: themed wrapper over core/markdown
Menu: <details>-driven dropdown menu (keyboard + ARIA; submenus, radio rows)
MetricBand: compact semantic band of one to six related signals
MultiSelect: checkbox-group disclosure with a chips summary
Muted: subdued inline <span> for secondary text
NetworkRetryBanner: RPC-failure banner with health-probe retry
Notification: toast-styled inline notification (variant + dismiss)
NotificationBell: bell + unread badge + popover dropdown
NumberInput: number field with explicit +/− step buttons
NumberField: typed labelled native number field with bounds
OptimisticAction: instant-flip button with rollback on error
OptimizedImage: responsive <picture> with srcset + lazy + Width/Height
PageHeader: top-of-page header with title/eyebrow/subtitle/actions
Workbench: scrolling rail beside a filling pane (inspector shell)
PaneHost: primary pane + openable secondary/tertiary side panes
PasswordInput: password field with show/hide toggle
Pagination: numeric page pager over a list (typed query props, optional island)
PieChart: SVG ratio chart (donut variant via InnerRadius)
PipelineImage: multi-format <picture> consuming framework/image
VariantSet output (typed sources + a stacked
low-fidelity placeholder from a data: URI)
PollingIndicator: pulsing dot confirming a polling RPC is firing
PricingCard: plan tile with price + feature list + CTA
Progress: native <progress> bar, determinate or indeterminate
ProgressSteps: linear step indicator (horizontal + vertical)
Radio: labelled radio with FieldErrors wiring
RadioGroup: <fieldset> of radios with shared label + errors
RangeSlider: dual-thumb range with cross-clamp
RatingInput: 1-N star/heart rating input
RecordSummary: dominant record/event summary with bounded support rail
Repeater: dynamic add/remove item list with min/max limits
Responsive: viewport-swap pair (desktop / mobile variant)
SearchInput: search field with icon prefix + clear button
Section: labelled content section with heading + description
SegmentedControl: radio-group styled as a sliding pill bar
Select: labelled native <select> with help/error/placeholder
ShortcutHint: OS-aware keyboard chord chips
Sidebar: responsive primary navigation (inline/drawer)
SidebarBody: nav content only, for a mirroring drawer slot
SidebarDrawerTrigger: the drawer hamburger standalone, for host chrome
SignalToggle: role=switch bound to a boolean signal
SignOut: logout form POSTing the auth sign-out endpoint
SkeletonAvatar: circular shimmer placeholder
SkeletonCard: card-shaped shimmer placeholder
SkeletonRow: row-shaped shimmer placeholder
SkeletonLine: one short shimmer bar (a trail, a one-line label)
SkeletonTimeline: event-row shimmer placeholder (dot + lines)
SkipLink: focus-visible bypass link to main content
Slider: <input type=range> with optional live value mirror
Sparkline: pure-SVG inline trend chart
SortableList: drag + keyboard reorderable list with server-authoritative commit
SortableListItems: the rows-only fragment a 409 reconciliation returns
Spinner: inline role="status" loading indicator
Stack: vertical layout with gap
StatCard: metric tile with label/value/trend
StatusBadge: small status pill (success/warning/danger/info/neutral)
StatusPill: compact status pill with optional leading dot
StepRail: sticky numbered nav for multi-step pages
StepWizard: multi-step form with a progress indicator bar
Sticky: theme-token sticky wrapper (top/bottom pinning)
Switch: iOS-style toggle switch with role=switch
TableOfContents: auto-built sticky nav from <h2>/<h3>
Tabs: signal-driven tab strip
Tag: interactive pill (filter link or × dismiss)
TagInput: free-form chips, Enter/comma to commit
TerminalBlock: terminal transcript with a labelled header
TextArea: multi-line input with typed Autogrow
Control: styled native input for a FormField builder
TextField: typed labelled native text field
Themed: wraps a subtree in a registered theme override
ThemeToggle: dark/light/auto toggle persisting color-scheme
Timeline: vertical event rail
TimePicker: styled native <input type=time>
ToggleAction: three-state commit/untoggle button with mutex groups
Toolbar: role=toolbar wrapper for grouped actions
Tooltip: CSS-only hover/focus reveal
Tree: WAI-ARIA treeview (roving tabindex, lazy branches)
ValidationSummary: inline summary of form validation errors
Layout primitives (Stack, Cluster, Grid, Center, Spacer, Box) share one ui-layout stylesheet. See layout.go.
Package ui provides high-level UI components for the GoFastr framework.
The form input components (PasswordInput, SearchInput, InputGroup) are defined in their own files: passwordinput.go, searchinput.go, inputgroup.go. This file was a consolidated version that has been superseded.
Index ¶
- func AddToast(w http.ResponseWriter, t ToastTrigger)
- func AddToastError(w http.ResponseWriter, title, body string)
- func AddToastSuccess(w http.ResponseWriter, title, body string, ttlMs int)
- func AddToastWarning(w http.ResponseWriter, title, body string, ttlMs int)
- func AnchoredRail(cfg AnchoredRailConfig) render.HTML
- func AnimatedCounter(cfg AnimatedCounterConfig) render.HTML
- func AspectRatioComponent(cfg AspectRatioConfig, child render.HTML) render.HTML
- func AuthCard(cfg AuthCardConfig) render.HTML
- func Avatar(cfg AvatarConfig) render.HTML
- func AvatarGroup(cfg AvatarGroupConfig) render.HTML
- func BackToTop(cfg BackToTopConfig) render.HTML
- func Banner(cfg BannerConfig) render.HTML
- func BarChart(cfg BarChartConfig) render.HTML
- func Box(cfg BoxConfig, children ...render.HTML) render.HTML
- func Breadcrumbs(cfg BreadcrumbsConfig, crumbs ...Crumb) render.HTML
- func Button(cfg ButtonConfig) render.HTML
- func Callout(cfg CalloutConfig, body ...render.HTML) render.HTML
- func Card(cfg CardConfig, body ...render.HTML) render.HTML
- func Carousel(cfg CarouselConfig) render.HTML
- func Center(cfg CenterConfig, children ...render.HTML) render.HTML
- func Checkbox(cfg ToggleConfig) render.HTML
- func CheckboxGroup(cfg CheckboxGroupConfig) render.HTML
- func Cluster(cfg ClusterConfig, children ...render.HTML) render.HTML
- func CodeBlock(cfg CodeBlockConfig) render.HTML
- func CodeTabs(cfg CodeTabsConfig, samples ...CodeSample) render.HTML
- func Collapsible(cfg CollapsibleConfig, body ...render.HTML) render.HTML
- func ColorField(cfg ColorFieldConfig) render.HTML
- func ColorPicker(cfg ColorPickerConfig) render.HTML
- func Combobox(cfg ComboboxConfig) render.HTML
- func CommandPalette(cfg CommandPaletteConfig) (render.HTML, *widget.Builder)
- func ConditionalField(cfg ConditionalFieldConfig) render.HTML
- func ConfirmAction(cfg ConfirmActionConfig) (render.HTML, *widget.Builder)
- func Container(cfg ContainerConfig, children ...render.HTML) render.HTML
- func ContentRow(cfg ContentRowConfig, main ...render.HTML) render.HTML
- func Control(cfg ControlConfig) render.HTML
- func CopyButton(cfg CopyButtonConfig) render.HTML
- func Counter(cfg CounterConfig) render.HTML
- func DataTable(cfg DataTableConfig) render.HTML
- func DateField(cfg DateFieldConfig) render.HTML
- func DetailList(cfg DetailListConfig) render.HTML
- func DiffViewer(cfg DiffViewerConfig) render.HTML
- func Divider(cfg DividerConfig) render.HTML
- func EmptyState(cfg EmptyStateConfig) render.HTML
- func EmptyValue() render.HTML
- func FactBox(cfg FactBoxConfig) render.HTML
- func FileDropzone(cfg FileDropzoneConfig) render.HTML
- func FileUpload(cfg FileUploadConfig) render.HTML
- func FilterChipBar(cfg FilterChipBarConfig) render.HTML
- func FilterToolbar(cfg FilterToolbarConfig) render.HTML
- func Form(cfg FormConfig, fields ...render.HTML) render.HTML
- func FormField(cfg FormFieldConfig) render.HTML
- func FormFieldFor(errs FieldErrors, name string, cfg FormFieldConfig) render.HTML
- func FormRepeater(cfg FormRepeaterConfig) render.HTML
- func FormSection(cfg FormSectionConfig, fields ...render.HTML) render.HTML
- func Gallery(cfg GalleryConfig) render.HTML
- func GlobalSearch(cfg GlobalSearchConfig) render.HTML
- func Grid(cfg GridConfig, children ...render.HTML) render.HTML
- func Hero(cfg HeroConfig) render.HTML
- func HeroSplit(cfg HeroSplitConfig) render.HTML
- func HighlightLines(code, lang string) []render.HTML
- func Icon(name string, cfg IconConfig) render.HTML
- func IconRegistered(name string) bool
- func InputGroup(cfg InputGroupConfig) render.HTML
- func InvalidateScreens(w http.ResponseWriter, paths ...string)
- func JSONViewer(cfg JSONViewerConfig) render.HTML
- func Lightbox(cfg LightboxConfig) *widget.Builder
- func LineChart(cfg LineChartConfig) render.HTML
- func Link(cfg LinkConfig) render.HTML
- func LinkButton(cfg LinkButtonConfig) render.HTML
- func ListDetail(cfg ListDetailConfig) render.HTML
- func ListDetailPlaceholder(body render.HTML) render.HTML
- func Markdown(cfg MarkdownConfig) render.HTML
- func Menu(cfg MenuConfig) render.HTML
- func MetricBand(cfg MetricBandConfig) render.HTML
- func MountSidebar(r WidgetMounter, cfg SidebarConfig, pages ...string) widget.Definition
- func MultiSelect(cfg MultiSelectConfig) render.HTML
- func Muted(children ...render.HTML) render.HTML
- func NetworkRetryBanner(cfg NetworkRetryBannerConfig) render.HTML
- func Notification(cfg NotificationConfig) render.HTML
- func NotificationBell(cfg NotificationBellConfig) (render.HTML, *widget.Builder)
- func NumberField(cfg NumberFieldConfig) render.HTML
- func NumberInput(cfg NumberInputConfig) render.HTML
- func OptimisticAction(cfg OptimisticActionConfig) render.HTML
- func OptimizedImage(cfg OptimizedImageConfig) render.HTML
- func PageHeader(cfg PageHeaderConfig) render.HTML
- func Pagination(cfg PaginationConfig) render.HTML
- func PaneDeepLink(q url.Values, param string) (slot, key string, ok bool)
- func PaneHost(cfg PaneHostConfig) render.HTML
- func PasswordInput(cfg PasswordInputConfig) render.HTML
- func PieChart(cfg PieChartConfig) render.HTML
- func PipelineImage(cfg PipelineImageConfig) render.HTML
- func PollingIndicator(cfg PollingIndicatorConfig) render.HTML
- func PricingCard(cfg PricingCardConfig) render.HTML
- func Progress(cfg ProgressConfig) render.HTML
- func ProgressSteps(cfg ProgressStepsConfig) render.HTML
- func Radio(cfg ToggleConfig) render.HTML
- func RadioGroup(cfg RadioGroupConfig) render.HTML
- func RangeSlider(cfg RangeSliderConfig) render.HTML
- func RatingInput(cfg RatingConfig) render.HTML
- func RecordSummary(cfg RecordSummaryConfig) render.HTML
- func RegisterIcon(name, body string)
- func Repeater(cfg RepeaterConfig) render.HTML
- func Responsive(cfg ResponsiveConfig, desktop, mobile render.HTML) render.HTML
- func SearchInput(cfg SearchInputConfig) render.HTML
- func Section(cfg SectionConfig, body ...render.HTML) render.HTML
- func SegmentedControl(cfg SegmentedControlConfig) render.HTML
- func Select(cfg SelectConfig) render.HTML
- func SetRolesExtractor(f func(ctx context.Context) []string)
- func ShortcutHint(cfg ShortcutHintConfig) render.HTML
- func Sidebar(cfg SidebarConfig) component.Component
- func SidebarBody(cfg SidebarConfig) render.HTML
- func SidebarDrawerTrigger(cfg SidebarConfig) render.HTML
- func SignOut(cfg SignOutConfig) render.HTML
- func SignalToggle(cfg SignalToggleConfig) render.HTML
- func SkeletonAvatar(cfg SkeletonAvatarConfig) render.HTML
- func SkeletonCard(cfg SkeletonCardConfig) render.HTML
- func SkeletonLine(cfg SkeletonLineConfig) render.HTML
- func SkeletonRow(cfg SkeletonRowConfig) render.HTML
- func SkeletonTimeline(cfg SkeletonTimelineConfig) render.HTML
- func SkipLink(cfg SkipLinkConfig) render.HTML
- func Slider(cfg SliderConfig) render.HTML
- func SortableList(cfg SortableListConfig) render.HTML
- func SortableListItems(cfg SortableListConfig) render.HTML
- func Spacer() render.HTML
- func Sparkline(cfg SparklineConfig) render.HTML
- func Spinner(cfg SpinnerConfig) render.HTML
- func Stack(cfg StackConfig, children ...render.HTML) render.HTML
- func StatCard(cfg StatCardConfig) render.HTML
- func StatusBadge(cfg StatusBadgeConfig) render.HTML
- func StatusPill(cfg StatusPillConfig) render.HTML
- func StepRail(cfg StepRailConfig) render.HTML
- func StepWizard(cfg StepWizardConfig) render.HTML
- func Sticky(cfg StickyConfig, children ...render.HTML) render.HTML
- func StringsFor(ctx context.Context) *headless.Strings
- func Switch(cfg ToggleConfig) render.HTML
- func TableOfContents(cfg TOCConfig) render.HTML
- func Tabs(cfg TabsConfig) render.HTML
- func Tag(cfg TagConfig) render.HTML
- func TagInput(cfg TagInputConfig) render.HTML
- func TerminalBlock(cfg TerminalBlockConfig, lines ...render.HTML) render.HTML
- func TerminalOK(s string) render.HTML
- func TerminalOut(s string) render.HTML
- func TextArea(cfg TextAreaConfig) render.HTML
- func TextField(cfg TextFieldConfig) render.HTML
- func ThemeToggle(cfg ThemeToggleConfig) render.HTML
- func Themed(ref style.ThemeRef, children ...render.HTML) render.HTML
- func TimePicker(cfg TimePickerConfig) render.HTML
- func Timeline(cfg TimelineConfig) render.HTML
- func ToastSlot(name string) component.Component
- func ToggleAction(cfg ToggleActionConfig) render.HTML
- func Toolbar(cfg ToolbarConfig) render.HTML
- func Tooltip(cfg TooltipConfig, trigger render.HTML) render.HTML
- func Tree(cfg TreeConfig) render.HTML
- func ValidationSummary(cfg ValidationSummaryConfig) render.HTML
- func Workbench(cfg WorkbenchConfig) render.HTML
- type Align
- type AnchoredRailConfig
- type AnimatedCounterConfig
- type AspectRatio
- type AspectRatioConfig
- type AuthCardConfig
- type AvatarConfig
- type AvatarGroupConfig
- type AvatarSize
- type AvatarStatus
- type BackToTopConfig
- type BackToTopOffset
- type BackToTopPosition
- type BackToTopScrollBehavior
- type BackToTopSize
- type BackToTopVariant
- type BannerConfig
- type BannerVariant
- type BarChartBar
- type BarChartConfig
- type BoxConfig
- type BoxPad
- type BreadcrumbsConfig
- type ButtonConfig
- type ButtonSize
- type ButtonVariant
- type CalloutConfig
- type CardConfig
- type CardVariant
- type CarouselConfig
- type CarouselSlide
- type CenterConfig
- type CheckboxGroupConfig
- type CheckboxGroupOption
- type ClusterConfig
- type CodeBlockConfig
- type CodeSample
- type CodeTabsConfig
- type CollapsibleConfig
- type ColorFieldConfig
- type ColorPickerConfig
- type Column
- type ComboboxConfig
- type CommandPaletteConfig
- type ConditionalFieldConfig
- type ConfirmActionConfig
- type ContainerConfig
- type ContainerPad
- type ContainerWidth
- type ContentRowConfig
- type ControlConfig
- type CopyButtonConfig
- type CounterConfig
- type Crumb
- type DataTableConfig
- type DateFieldConfig
- type DetailItem
- type DetailListConfig
- type DiffMode
- type DiffViewerConfig
- type DividerConfig
- type DividerOrientation
- type EmptyStateConfig
- type Facet
- type FacetKind
- type FacetOption
- type FactBoxConfig
- type FactStyle
- type FieldErrors
- type FileDropzoneConfig
- type FileUploadConfig
- type FilterChip
- type FilterChipBarConfig
- type FilterSearch
- type FilterToolbarConfig
- type FormConfig
- type FormFieldConfig
- type FormRepeaterConfig
- type FormSectionConfig
- type GalleryCaptionMode
- type GalleryConfig
- type GalleryItem
- type GalleryVariant
- type Gap
- type GlobalSearchConfig
- type GridConfig
- type HeaderInfo
- type HeroConfig
- type HeroSplitConfig
- type HeroSplitRatio
- type IconConfig
- type ImageAspect
- type ImageFit
- type ImageSource
- type InputGroupConfig
- type JSONViewerConfig
- type Justify
- type LightboxConfig
- type LineChartConfig
- type LineRange
- type LineSeries
- type LinkButtonConfig
- type LinkConfig
- type LinkVariant
- type ListDetailConfig
- type MarkdownConfig
- type MenuAction
- type MenuConfig
- type MenuItem
- type MenuPosition
- type MetricBandConfig
- type MetricBandItem
- type MultiSelectConfig
- type MultiSelectOption
- type NetworkRetryBannerConfig
- type NotificationBellConfig
- type NotificationConfig
- type NotificationItem
- type NotificationPosition
- type NumberFieldConfig
- type NumberInputConfig
- type OptimisticActionConfig
- type OptimizedImageConfig
- type PageHeaderConfig
- type PaginationConfig
- type PaletteCommand
- type PaneHostConfig
- type PasswordInputConfig
- type PieChartConfig
- type PieSlice
- type PipelineImageConfig
- type PipelineSource
- type PollingIndicatorConfig
- type PricingCardConfig
- type ProgressConfig
- type ProgressStep
- type ProgressStepStatus
- type ProgressStepsConfig
- type ProgressStepsOrientation
- type RadioGroupConfig
- type RadioGroupOption
- type RailItem
- type RangeSliderConfig
- type RatingConfig
- type RatingGap
- type RatingShape
- type RatingSize
- type RecordSummaryConfig
- type RecordSummaryTone
- type RepeaterConfig
- type ResponsiveConfig
- type ResponsiveMode
- type Row
- type SearchInputConfig
- type SectionConfig
- type SegmentedControlConfig
- type SegmentedOption
- type SelectConfig
- type SelectOption
- type ShortcutHintConfig
- type SidebarCollapse
- type SidebarConfig
- type SidebarGroupMarkup
- type SidebarItem
- type SidebarVariant
- type SignOutConfig
- type SignalToggleConfig
- type SkeletonAvatarConfig
- type SkeletonCardConfig
- type SkeletonLineConfig
- type SkeletonRowConfig
- type SkeletonTimelineConfig
- type SkipLinkConfig
- type SliderConfig
- type SortDir
- type SortOption
- type SortableItem
- type SortableListConfig
- type SparklineConfig
- type SparklineShape
- type SpinnerConfig
- type SpinnerSize
- type SpinnerVariant
- type StackBreakpoint
- type StackConfig
- type StatCardConfig
- type StatusBadgeConfig
- type StatusPillConfig
- type StatusPillTone
- type StatusVariant
- type StatusVariantCSS
- type StepRailConfig
- type StepRailItem
- type StepWizardConfig
- type StepWizardStep
- type StickyConfig
- type StickyEdge
- type StickyOffset
- type StringsRefusal
- type TOCConfig
- type TOCItem
- type TabItem
- type TabsConfig
- type TagConfig
- type TagInputConfig
- type TerminalBlockConfig
- type TextAreaConfig
- type TextFieldConfig
- type ThemeToggleConfig
- type ThemeToggleVariant
- type TimePickerConfig
- type TimelineConfig
- type TimelineEvent
- type TimelineEventVariant
- type ToastTrigger
- type ToggleActionConfig
- type ToggleConfig
- type ToolbarConfig
- type ToolbarGroup
- type TooltipConfig
- type TooltipPlacement
- type TreeConfig
- type TreeItem
- type TrendDirection
- type ValidationSummaryConfig
- type VariantCSS
- type WidgetMounter
- type WorkbenchConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AddToast ¶
func AddToast(w http.ResponseWriter, t ToastTrigger)
AddToast appends a toast trigger to the X-Gofastr-Toast response header. The runtime fires the toast on the client when the matching data-fui-rpc fetch resolves with 2xx.
Multiple AddToast calls accumulate into a single header whose value is a JSON array, unaffected by fetch's header-value coalescing across browsers. Apps that need to surface several toasts from one handler just call AddToast multiple times.
Apps can call this from any HTTP handler that's reached via data-fui-rpc; the toast travels back on the response that the
func AddToastError ¶
func AddToastError(w http.ResponseWriter, title, body string)
func AddToastSuccess ¶
func AddToastSuccess(w http.ResponseWriter, title, body string, ttlMs int)
AddToastSuccess / AddToastError / AddToastWarning are sugar for the common cases. ttlMs of 0 means persistent (caller must dismiss).
func AddToastWarning ¶
func AddToastWarning(w http.ResponseWriter, title, body string, ttlMs int)
func AnchoredRail ¶
func AnchoredRail(cfg AnchoredRailConfig) render.HTML
AnchoredRail returns the rail HTML. When ObserveSelector is set the root carries the observer hooks the headless-rail module binds.
func AnimatedCounter ¶
func AnimatedCounter(cfg AnimatedCounterConfig) render.HTML
AnimatedCounter renders a number that ticks from From to To on first appearance. The prefix and suffix are slots around the value the primitive owns.
func AspectRatioComponent ¶
func AspectRatioComponent(cfg AspectRatioConfig, child render.HTML) render.HTML
AspectRatio wraps a single child in a container with the given aspect ratio. The child is absolutely positioned to fill the box.
Use for responsive images, video embeds, placeholder skeletons with known proportions, or any content whose intrinsic size is unknown at SSR time.
func AuthCard ¶ added in v0.7.0
func AuthCard(cfg AuthCardConfig) render.HTML
AuthCard renders a centered, constrained auth card.
func Avatar ¶
func Avatar(cfg AvatarConfig) render.HTML
Avatar renders a circular avatar with an image fallback to text initials when no image source is provided.
func AvatarGroup ¶
func AvatarGroup(cfg AvatarGroupConfig) render.HTML
AvatarGroup renders an overlapping stack of avatars. When len(Avatars) > Max, only the first Max render and a trailing "+N" pill announces the remainder via aria-label.
func BackToTop ¶
func BackToTop(cfg BackToTopConfig) render.HTML
BackToTop renders a smooth-scroll "back to top" button that appears after the user scrolls past the configured threshold.
The button is hidden on initial render (aria-hidden until visible). A small runtime module uses an IntersectionObserver on a sentinel to toggle visibility. No scroll-event listener is needed.
Usage:
ui.BackToTop(ui.BackToTopConfig{})
ui.BackToTop(ui.BackToTopConfig{ThresholdPx: 800})
ui.BackToTop(ui.BackToTopConfig{
Position: ui.BackToTopBottomLeft,
Size: ui.BackToTopLG,
Variant: ui.BackToTopGhost,
Icon: render.Raw(`<svg>...</svg>`),
})
func Banner ¶
func Banner(cfg BannerConfig) render.HTML
Banner renders a persistent page-status strip.
SR semantics: every tone is a polite status — role="status" — so a banner never interrupts; the offline banner (NetworkRetryBanner) is the one that alerts, because everything the reader does next fails until the connection is back.
func BarChart ¶
func BarChart(cfg BarChartConfig) render.HTML
BarChart renders a categorical bar chart.
func Box ¶
Box is a wrapper that applies token-scaled padding and optional surface chrome. A layout fact with no accessibility contract: it stays a styled div. Use as the visible shell of any "content card" that doesn't need the full Card primitive's header/body/footer slots.
func Breadcrumbs ¶ added in v0.86.0
func Breadcrumbs(cfg BreadcrumbsConfig, crumbs ...Crumb) render.HTML
Breadcrumbs renders the trail. Crumbs may be passed variably or through Items; both land in the same ordered list.
func Button ¶
func Button(cfg ButtonConfig) render.HTML
Button renders a semantic button with a typed variant, through the headless structure dressed with this package's class map: Variant maps to .fui-button--<variant> in the registered ui-button CSS.
Authors never reach for raw class strings. Pick a variant. Unknown variants panic at render time so typos surface immediately rather than silently rendering an unstyled button. Custom brand variants/sizes join the set via RegisterButtonVariant / RegisterButtonSize (shared with LinkButton).
func Callout ¶
func Callout(cfg CalloutConfig, body ...render.HTML) render.HTML
Callout renders a persistent info/warning/error block on headless.Alert. Distinct from Toast / Notification (ephemeral); callouts live inline with content.
Danger and warning callouts interrupt (role=alert); the rest are standing messages the page rendered, which do not. The old complementary-<aside> shape is gone: a tip is emphasis, not a tangential region, and a nested complementary landmark is the axe finding the Landmark field existed to dodge.
func Card ¶
func Card(cfg CardConfig, body ...render.HTML) render.HTML
Card renders a labelled content card on headless.Card: an optional titled header (or the caller's whole header through the fillable part), the body, an optional footer — and with Href, the whole surface as one focusable link.
func Center ¶
func Center(cfg CenterConfig, children ...render.HTML) render.HTML
Center centers its children both horizontally and vertically. A layout fact with no accessibility contract: it stays a styled div.
func Checkbox ¶
func Checkbox(cfg ToggleConfig) render.HTML
Checkbox renders a single labelled checkbox. Pair with FormField when you need section-level grouping; use the standalone Checkbox for inline toggles ("Remember me", "Send copy to admin").
func CheckboxGroup ¶
func CheckboxGroup(cfg CheckboxGroupConfig) render.HTML
CheckboxGroup renders a <fieldset> of checkboxes with a shared name, group-level legend, and optional help/error text.
func Cluster ¶
func Cluster(cfg ClusterConfig, children ...render.HTML) render.HTML
Cluster renders children in a horizontal row that wraps onto multiple lines when narrow, on headless.Cluster. Good for tag lists, action rows, breadcrumb trails.
func CodeBlock ¶
func CodeBlock(cfg CodeBlockConfig) render.HTML
CodeBlock renders a styled code sample. In its simplest form (Code only) it is a bare, horizontally-scrollable <pre>. Set Filename / ShowCopy / LineNumbers (or pass Lines) to get the framed variant: a chrome header with the filename, an optional copy button, and an optional line-number gutter.
The wrapper element carries data-fui-comp="ui-code-block" so the runtime auto-loads the scoped stylesheet on first appearance.
func CodeTabs ¶ added in v0.32.0
func CodeTabs(cfg CodeTabsConfig, samples ...CodeSample) render.HTML
CodeTabs renders the same snippet in several languages behind a tab strip, the "install this SDK in Go / TypeScript / curl" shape docs sites need. It is pure composition: headless.Tabs (the zero-JS fragment contract) one syntax-highlighted CodeBlock (with copy button) per sample.
Selection is per-tabset: the native <details name=> mechanism has no page-wide state, so picking "TypeScript" in one group does not switch sibling groups.
func Collapsible ¶
func Collapsible(cfg CollapsibleConfig, body ...render.HTML) render.HTML
Collapsible renders a <details> element with a clickable summary. The data-hui-disclosure hook wires up keyboard accessibility via the runtime (Escape to close, aria-expanded mirroring).
The body is wrapped in a fui-collapsible__content div so CSS can target the expandable region independently of the summary.
func ColorField ¶ added in v0.49.0
func ColorField(cfg ColorFieldConfig) render.HTML
ColorField renders the swatch + hex-text affix shell.
func ColorPicker ¶
func ColorPicker(cfg ColorPickerConfig) render.HTML
ColorPicker renders a styled native color input with a label.
func Combobox ¶ added in v0.86.0
func Combobox(cfg ComboboxConfig) render.HTML
Combobox renders the suggestion input with its listbox.
func CommandPalette ¶
func CommandPalette(cfg CommandPaletteConfig) (render.HTML, *widget.Builder)
CommandPalette returns the trigger button and a Modal preset for the palette. Mount the preset once at startup; render the trigger in your global chrome (Sidebar, top nav, etc).
func ConditionalField ¶
func ConditionalField(cfg ConditionalFieldConfig) render.HTML
ConditionalField renders a container that is visible on first paint and hidden by the headless runtime module until the watched field matches WhenValue. The watched field is resolved the way the form would submit it: the checked radio's value, a checkbox's value when checked, any other control's value.
func ConfirmAction ¶
func ConfirmAction(cfg ConfirmActionConfig) (render.HTML, *widget.Builder)
ConfirmAction returns the trigger button and a *widget.Builder for the alertdialog. The caller mounts the preset once at startup; the trigger renders inline anywhere on the page.
func Container ¶
func Container(cfg ContainerConfig, children ...render.HTML) render.HTML
Container renders a max-width wrapper.
func ContentRow ¶ added in v0.86.0
func ContentRow(cfg ContentRowConfig, main ...render.HTML) render.HTML
ContentRow renders the content row around the main region. With no Sidebar it still owns the row (the flex row, main's growth) — the leanest page shape. The row is as tall as its content; place it in ui.Stack{Screen: true, Gap: ui.GapNone} between the header and the footer and it grows to fill the page, so a short page keeps its footer at the viewport bottom with no dead scroll.
func Control ¶ added in v0.86.0
func Control(cfg ControlConfig) render.HTML
Control renders a styled native input, dressed with the input class map. The field sheet (ui-form-field) is what styles it, fetched by the field whose builder this control was built in.
func Counter ¶
func Counter(cfg CounterConfig) render.HTML
Counter renders a counter with + and − buttons that mutate a signal locally in the browser. No server round-trip.
The counter displays a `<span data-fui-signal="name">0</span>` that the runtime updates when the signal changes.
func DataTable ¶
func DataTable(cfg DataTableConfig) render.HTML
DataTable renders the table: the headless primitive's structure, roles and sort anchors under this package's class map, the styled EmptyState in the primitive's empty slot, and the typed pager in a footer div of its own outside the scroll region.
func DateField ¶ added in v0.41.0
func DateField(cfg DateFieldConfig) render.HTML
DateField renders a FormField containing an input[type=date].
func DetailList ¶ added in v0.7.0
func DetailList(cfg DetailListConfig) render.HTML
DetailList renders a label/value description list on headless.DetailList. An item with no Value renders the empty-value dash, so an absence reads as deliberate. A list with no items renders nothing: the primitive refuses an empty <dl>, and a record with no fields is data, not a developer's mistake.
func DiffViewer ¶
func DiffViewer(cfg DiffViewerConfig) render.HTML
DiffViewer renders a unified-diff body as a styled view.
func Divider ¶
func Divider(cfg DividerConfig) render.HTML
Divider renders a semantic separator on headless.Divider: plain horizontal dividers are the native <hr>; vertical or labelled dividers carry the orientation / label on the element the contract gives them.
func EmptyState ¶
func EmptyState(cfg EmptyStateConfig) render.HTML
EmptyState renders the nothing-here on headless.EmptyState: a region named by its own heading, so "no results" is a findable place with a way out.
func EmptyValue ¶ added in v0.11.0
EmptyValue is the canonical "no value here" placeholder: a muted em dash. Tables and detail views render it for null/empty fields so emptiness reads as deliberate rather than broken.
func FactBox ¶
func FactBox(cfg FactBoxConfig) render.HTML
FactBox renders one labelled tile. Pair with a CSS grid to lay out multiple. The framework does not provide a grid wrapper, so consumers pick their own column template.
func FileDropzone ¶
func FileDropzone(cfg FileDropzoneConfig) render.HTML
FileDropzone renders a hero file-drop surface.
func FileUpload ¶
func FileUpload(cfg FileUploadConfig) render.HTML
FileUpload renders a drag-drop file picker.
Markup shape:
<div class="fui-upload-field" data-fui-comp="ui-fileupload">
<div class="fui-upload" data-hui-drop …>
<label class="fui-upload__zone" for="…">
<span class="fui-upload__label">…</span>
<span class="fui-upload__cta">Drop a file here, or click to browse</span>
<span class="fui-upload__hint">…</span>
</label>
<input type="file" class="fui-upload__input" …>
<ul class="fui-upload__list" role="list" data-hui-drop-list></ul>
<span class="fui-upload__status" role="status" data-hui-drop-status></span>
</div>
<p class="fui-upload__error" role="alert">…</p> ← only when Error is set
</div>
The list and the status are filled by the headless module after a pick or a drop, so the chosen names are on screen as well as announced.
func FilterChipBar ¶
func FilterChipBar(cfg FilterChipBarConfig) render.HTML
FilterChipBar renders the toolbar.
func FilterToolbar ¶ added in v0.12.0
func FilterToolbar(cfg FilterToolbarConfig) render.HTML
FilterToolbar renders the filter/sort control strip for a list screen.
func Form ¶
func Form(cfg FormConfig, fields ...render.HTML) render.HTML
Form renders a complete <form> with an optional error summary above the fields and a submit button below, through the headless form dressed with this package's class map.
Pass FormFieldFor(errors, ...) inside as fields so the per-field error wiring is automatic.
func FormField ¶
func FormField(cfg FormFieldConfig) render.HTML
FormField renders a labelled form field with optional help and error text. Wire the control through Input's builder; the label's For and the control's id cannot disagree, because the control is built from the field's own wiring.
Help and Error are BOTH rendered when both are set, the error first: the hint is the rule the value must obey and the error is the violation, so dropping the rule exactly when it was broken is dropping it when it is needed most.
func FormFieldFor ¶
func FormFieldFor(errs FieldErrors, name string, cfg FormFieldConfig) render.HTML
FormFieldFor is a convenience wrapper that pre-fills FormFieldConfig.Error from a FieldErrors map. Use it inside Form() so error round-tripping is one line per field.
func FormRepeater ¶
func FormRepeater(cfg FormRepeaterConfig) render.HTML
FormRepeater renders a dynamic list of repeating field groups with add/remove controls.
Server-driven: clicking "Add" submits name="<Name>_add" value="1", and clicking "Remove" submits name="<Name>_remove" value="<index>". The server processes these and re-renders with the updated Items.
func FormSection ¶
func FormSection(cfg FormSectionConfig, fields ...render.HTML) render.HTML
FormSection wraps a group of FormFields with a shared heading, on headless.Fieldset: a heading renders the native fieldset + legend pair, and no heading renders the plain div — an unlabelled fieldset is a landmark that names nothing.
func Gallery ¶
func Gallery(cfg GalleryConfig) render.HTML
Gallery renders the thumbnail surface through headless.Gallery with the fui-gallery class map (the sheet name "ui-gallery" and marker stay). The thumb loads lazily through the parts seam; the default and lightbox anchors open the full image in a new tab through the per-item attrs, so the no-script path keeps the old behaviour.
func GlobalSearch ¶
func GlobalSearch(cfg GlobalSearchConfig) render.HTML
GlobalSearch renders the search bar.
func Grid ¶
func Grid(cfg GridConfig, children ...render.HTML) render.HTML
Grid renders children in an auto-fitting CSS grid, on headless.Grid under this package's class map. The default replacement for hand-rolled `grid-template-columns` declarations.
Min is passed through `--ui-grid-min` (a CSS custom property the component declares on the root), so no inline `style="…"` is emitted, strict-CSP clean.
func Hero ¶ added in v0.7.0
func Hero(cfg HeroConfig) render.HTML
Hero renders a single-column (or copy+media split) hero section.
func HeroSplit ¶
func HeroSplit(cfg HeroSplitConfig) render.HTML
HeroSplit renders a two-column hero. The wrapper is a <section>; callers pass the content for each column as HTML.
func HighlightLines ¶ added in v0.8.0
HighlightLines tokenizes code for the given language and returns one []render.HTML per source line (newline-split AFTER tokenizing, so multi-line strings/comments keep their class across the break). Each entry is the line's concatenated token spans, ready to pass as ui.CodeBlockConfig.Lines. Pass the result as CodeBlockConfig.Lines with ShowCopy/LineNumbers/Scroll as desired.
func Icon ¶
func Icon(name string, cfg IconConfig) render.HTML
Icon renders the registered icon with the given name. Returns empty markup for unknown names. Callers can guard with IconRegistered().
func IconRegistered ¶
IconRegistered reports whether an icon with the given name is in the registry.
func InputGroup ¶
func InputGroup(cfg InputGroupConfig) render.HTML
InputGroup renders an input with optional prepend and append addons. The prepend/append addons share borders with the input for a merged appearance.
func InvalidateScreens ¶ added in v0.51.0
func InvalidateScreens(w http.ResponseWriter, paths ...string)
InvalidateScreens appends paths to the X-Gofastr-Invalidate response header. Call it from any handler reached via data-fui-rpc, a widget RPC, or SPA navigation; multiple calls accumulate into one JSON array, mirroring AddToast.
Paths must be root-relative ("/orders", "/dashboard?range=7d") or the wildcard "*". Anything else: empty strings, absolute URLs, protocol-relative or bare-relative paths, or paths carrying control characters, is dropped silently: the values are only ever cache-map keys on the client, so an invalid one could never match an entry anyway. (Control bytes are rejected outright rather than escaped: DEL survives JSON encoding un-escaped, and an invalid header value is silently dropped by Go's HTTP/2 writer. A path that can't be a real cache key is not worth a malformed header.)
The header is consumed on every 2xx mutation or navigation response the runtime dispatches: data-fui-rpc, widget RPC, SPA navigation, intercepted navigation, toggle/optimistic actions, and sortable-list reorders. Poll replies never consume it.
func JSONViewer ¶
func JSONViewer(cfg JSONViewerConfig) render.HTML
JSONViewer renders a collapsible tree view of any Go value through headless.JSONTree (deterministic sorted keys, native details).
func Lightbox ¶
func Lightbox(cfg LightboxConfig) *widget.Builder
Lightbox returns a *widget.Builder for the zoom-overlay modal. Mount once at app startup; trigger from anywhere via data-fui-open.
func LineChart ¶
func LineChart(cfg LineChartConfig) render.HTML
LineChart renders a multi-series line chart.
func Link ¶
func Link(cfg LinkConfig) render.HTML
Link renders an anchor with a typed variant. The component owns its CSS. The .fui-link class works without any app-level overrides.
Defaults to LinkInline. Picking LinkAction gives the link a 44×44 minimum tap area so it can stand next to a Button in a row action without violating WCAG 2.5.5.
func LinkButton ¶
func LinkButton(cfg LinkButtonConfig) render.HTML
LinkButton renders a button-styled anchor, through the same headless structure and class map as Button. The visual styling is shared via the registered ui-button CSS. The difference is semantic: <a> for navigation, <button> for actions. Screen readers, "open in new tab", and SPA push-state nav all rely on the right tag choice.
func ListDetail ¶ added in v0.86.0
func ListDetail(cfg ListDetailConfig) render.HTML
ListDetail places a scrolling list beside a detail region, stacked on phones. Keeping it in a group layout preserves the list's DOM and scroll while navigation replaces Detail. No pane lifecycle or JavaScript is added.
A list/detail page wants the row's whole content column, and the component cannot take it: it fills 100% of its container, and the width comes from the content row around it. Leave `ContentRowConfig.Aside` unfilled on screens that don't need it (an empty aside outlet releases its column). `ContentRowConfig.Viewport` (the tracker's spelling) makes the panes scroll on their own; it does not change their width. A sidebar plus an aside leaves the detail pane roughly 300px wide at 1280px.
func ListDetailPlaceholder ¶ added in v0.86.0
ListDetailPlaceholder marks an unselected detail screen. A ListDetail using MobileSinglePane shows the list instead on phones; desktop keeps this content beside it. Missing-record screens should not use this marker.
func Markdown ¶
func Markdown(cfg MarkdownConfig) render.HTML
Markdown renders the given Markdown source as themed HTML.
func Menu ¶
func Menu(cfg MenuConfig) render.HTML
Menu renders a dropdown. The trigger toggles the panel; the panel is a `role=menu` list with `role=menuitem` rows — `menuitemradio` rows for items with Radio set, and nested `role=menu` submenus for items with Children. Renders headless.Menu dressed with the fui-menu class map: the disclosure machinery (Escape one level at a time, SPA-nav close, aria-expanded mirroring) is headless-disclosure's, and the keyboard contract (roving focus, type-ahead, RTL-aware submenus, radio arbitration) is headless-menu's. With TriggerElement set there is no framework summary: the caller's element is the controller (see MenuConfig.TriggerElement).
func MetricBand ¶ added in v0.23.0
func MetricBand(cfg MetricBandConfig) render.HTML
MetricBand renders a semantic <dl>. Wide viewports use one row; phones use two columns. When the phone grid has an odd item count, the final signal spans the row instead of leaving an accidental empty quadrant. It is intentionally flatter than a grid of StatCards.
func MountSidebar ¶
func MountSidebar(r WidgetMounter, cfg SidebarConfig, pages ...string) widget.Definition
MountSidebar registers BOTH the sidebar drawer widget (for < md viewports) AND mounts it on r. Returns the widget definition. Call once per app at startup. The same SidebarConfig is passed to `Sidebar(cfg)` when rendering screens so the two views stay in sync.
Generic signature: `r` is anything widget.Mount accepts (the gofastr router). We use a tiny adapter type so this package doesn't need to import the router directly.
func MultiSelect ¶ added in v0.86.0
func MultiSelect(cfg MultiSelectConfig) render.HTML
MultiSelect renders the checkbox-group disclosure.
func NetworkRetryBanner ¶
func NetworkRetryBanner(cfg NetworkRetryBannerConfig) render.HTML
NetworkRetryBanner renders the (initially hidden) banner.
func Notification ¶
func Notification(cfg NotificationConfig) render.HTML
Notification renders the toast row.
func NotificationBell ¶
func NotificationBell(cfg NotificationBellConfig) (render.HTML, *widget.Builder)
NotificationBell returns the bell-button trigger HTML and a *widget.Builder for the paired Popover. Mount the popover once:
trigger, pop := ui.NotificationBell(ui.NotificationBellConfig{...})
widget.Mount(r, pop.Build())
Then render `trigger` in the page header / sidebar / wherever.
func NumberField ¶ added in v0.41.0
func NumberField(cfg NumberFieldConfig) render.HTML
NumberField renders a FormField containing an input[type=number]. For the larger touch-friendly +/- control, use NumberInput instead.
func NumberInput ¶
func NumberInput(cfg NumberInputConfig) render.HTML
NumberInput renders a number field with explicit +/- buttons.
func OptimisticAction ¶
func OptimisticAction(cfg OptimisticActionConfig) render.HTML
OptimisticAction renders the button. The marker fetches this sheet; the clicks are bound through the data-hui-action* hooks the primitive renders.
func OptimizedImage ¶
func OptimizedImage(cfg OptimizedImageConfig) render.HTML
OptimizedImage renders a responsive, lazy-loaded image with width/height reservations to eliminate Cumulative Layout Shift.
Anti-CLS rule: callers MUST provide Width and Height (intrinsic pixel dimensions of Src). Omitting either panics: the framework will not silently emit a layout-shifting image.
func PageHeader ¶
func PageHeader(cfg PageHeaderConfig) render.HTML
PageHeader renders a top-of-page header on headless.PageHeader: the title, the words that qualify it, and the page's own actions. The element is a plain <header> — claiming role=banner is the top-level page header's decision, not the component's.
func Pagination ¶ added in v0.86.0
func Pagination(cfg PaginationConfig) render.HTML
Pagination renders the pager: the headless primitive's structure, roles and page anchors under this package's class map, wrapped for its sheet. A caller's Class lands on the list, where the pattern's Class always landed.
func PaneDeepLink ¶ added in v0.44.0
PaneDeepLink reads a PaneHost deep link out of a request's query.
The value is `<slot>` or `<slot>:<key>`, where slot is "secondary" or "tertiary" and key identifies what the pane is showing. It is the server half of PaneHostConfig.DeepLinkParam, and it parses exactly what the runtime writes. Keep the two in step:
q := appui.QueryFromContext(ctx)
slot, key, ok := ui.PaneDeepLink(q, "pane")
detail := emptyState
if ok && slot == "secondary" {
if t, found := ticketByID(key); found {
detail = renderTicket(t) // first paint already shows it
}
}
ok is false when the parameter is missing or names something that is not an openable side pane, so an edited URL degrades to the ordinary closed-pane render rather than an error. Callers must still treat key as untrusted input and look it up rather than reflecting it.
Only the first colon splits, so keys may contain colons.
func PaneHost ¶ added in v0.19.0
func PaneHost(cfg PaneHostConfig) render.HTML
PaneHost renders a primary pane plus one or two openable side panes through headless.PaneHost with the fui-pane-host class map (the sheet name "ui-pane-host" and marker stay). The root carries the open state as data-hui-pane-open (the list the runtime module maintains and the sheet's column rules key off, so a client-side open changes the columns); the open modifier classes ride along for first paint and any caller that reads them.
func PasswordInput ¶
func PasswordInput(cfg PasswordInputConfig) render.HTML
PasswordInput renders a password field with a show/hide reveal button bound by the headless behaviour module.
func PieChart ¶
func PieChart(cfg PieChartConfig) render.HTML
PieChart renders a pie or donut chart.
func PipelineImage ¶
func PipelineImage(cfg PipelineImageConfig) render.HTML
PipelineImage renders <picture> with one <source> per MIME type, plus a CLS-safe <img> fallback and an optional placeholder. Built to consume framework/image.VariantSet output directly: take the VariantResult.Variants slice, map each entry to a PipelineSource, pass the BlurHash or Placeholder as the placeholder field.
Shares the ui-image visual surface with OptimizedImage; the distinction is multi-Type srcset support, intended for output of the framework's image pipeline where the same source has been encoded as both modern (WebP) and legacy (JPEG/PNG) variants.
func PollingIndicator ¶
func PollingIndicator(cfg PollingIndicatorConfig) render.HTML
PollingIndicator renders the small pulsing-dot + label combination. Uses role="status" + aria-live="polite" so the label text is announced when it changes (e.g. swapping "Live" for "Paused").
func PricingCard ¶ added in v0.7.0
func PricingCard(cfg PricingCardConfig) render.HTML
PricingCard renders a single plan card.
func Progress ¶ added in v0.86.0
func Progress(cfg ProgressConfig) render.HTML
Progress renders the bar.
func ProgressSteps ¶
func ProgressSteps(cfg ProgressStepsConfig) render.HTML
ProgressSteps renders a step indicator on headless.Steps. Every step's Status is passed as an explicit state, so "a later step finished while an earlier one is open" renders as configured; the primitive's derivation from Current is not used.
func Radio ¶
func Radio(cfg ToggleConfig) render.HTML
Radio renders a single radio. Share Name across multiple Radios to form a group; pass distinct Value strings.
func RadioGroup ¶
func RadioGroup(cfg RadioGroupConfig) render.HTML
RadioGroup renders a <fieldset> of radio buttons with a shared name, group-level legend, and optional help/error text.
func RangeSlider ¶
func RangeSlider(cfg RangeSliderConfig) render.HTML
RangeSlider renders a dual-thumb range input.
func RatingInput ¶
func RatingInput(cfg RatingConfig) render.HTML
RatingInput renders a star/heart rating bound to a radio group. Submits as Name=<1..Max> on the surrounding form.
func RecordSummary ¶ added in v0.23.0
func RecordSummary(cfg RecordSummaryConfig) render.HTML
RecordSummary renders a compact semantic <article>. It is the one dominant summary for a page; do not repeat the same state in a separate Banner.
func RegisterIcon ¶
func RegisterIcon(name, body string)
RegisterIcon adds a named icon to the registry. The body should be inner SVG markup (paths, lines, circles, etc.) without the outer <svg> wrapper. Re-registering the same name replaces the existing body. Safe for concurrent use.
func Repeater ¶
func Repeater(cfg RepeaterConfig) render.HTML
Repeater renders a dynamic list of form fields with add/remove controls.
func Responsive ¶
func Responsive(cfg ResponsiveConfig, desktop, mobile render.HTML) render.HTML
Responsive emits both variants wrapped in viewport-toggled divs.
func SearchInput ¶
func SearchInput(cfg SearchInputConfig) render.HTML
SearchInput renders a search field with icon prefix and clear button.
func Section ¶
func Section(cfg SectionConfig, body ...render.HTML) render.HTML
Section renders a content section on headless.Section: a heading names the region through aria-labelledby, a Label names it by aria-label when there is no heading, and neither means the region renders as a plain div rather than an unnamed landmark.
func SegmentedControl ¶
func SegmentedControl(cfg SegmentedControlConfig) render.HTML
SegmentedControl renders the radiogroup with a sliding indicator.
func Select ¶
func Select(cfg SelectConfig) render.HTML
Select renders a labelled native <select> dropdown.
func SetRolesExtractor ¶ added in v0.7.0
SetRolesExtractor installs the function that pulls the current user's roles from a request context, enabling SidebarItem.Roles filtering. Idempotent; pass nil to disable.
func ShortcutHint ¶
func ShortcutHint(cfg ShortcutHintConfig) render.HTML
ShortcutHint renders the visual chord chips.
func Sidebar ¶
func Sidebar(cfg SidebarConfig) component.Component
Sidebar renders the inline nav column + the hamburger trigger that opens the < md drawer. The drawer widget itself is mounted by the caller via MountSidebar (once per app, at startup).
Slot it into a layout as the shell's static chrome: render it inside an app.NewLayout build function, beside l.Primary() — the way examples/tracker's buildShell does. Inline use is also fine. The component is self-contained.
func SidebarBody ¶
func SidebarBody(cfg SidebarConfig) render.HTML
SidebarBody renders the navigation content only: no sidebar shell, no hamburger. Use it as the Slot content of a preset.Drawer widget that mirrors the sidebar at narrow viewports. It has no request context, so a context-aware Prepend renders its Render fallback here; MountSidebar's drawer renders it per request.
The region renders through headless.SidebarRegion (no shell hooks, so the runtime never treats the host's chrome as a sidebar root) with the fui-sidebar class map's body spelling on its root.
func SidebarDrawerTrigger ¶ added in v0.86.0
func SidebarDrawerTrigger(cfg SidebarConfig) render.HTML
SidebarDrawerTrigger renders the sidebar's hamburger button on its own, for hosts that place it in their own chrome — the page header — and pass SidebarConfig.SuppressDrawerTrigger so the sidebar itself draws no second copy. Same button, class, and widget contract as the trigger Sidebar renders (data-fui-open names the MountSidebar drawer), and the same >= md self-hiding from the component's own stylesheet: at widths where the inline column shows, the header trigger disappears on its own. The drawer widget still has to be mounted once via MountSidebar.
func SignOut ¶ added in v0.7.0
func SignOut(cfg SignOutConfig) render.HTML
SignOut renders a logout control: a minimal form that POSTs to the auth logout endpoint. It is a POST (not a link) on purpose: a GET logout is trivially triggerable by a stray <img> or prefetch. The button is a real ui.Button, so it inherits the design system's styling.
func SignalToggle ¶
func SignalToggle(cfg SignalToggleConfig) render.HTML
SignalToggle renders a <button role="switch"> that toggles a boolean signal on click. The signal binding is fully client-side:
- data-fui-signal-toggle flips the signal on click
- data-fui-signal + attr mode keeps aria-checked in sync
- a nested label span shows the signal value via data-fui-signal
The button carries data-fui-comp="fui-toggle" for scoped CSS auto-loading.
func SkeletonAvatar ¶
func SkeletonAvatar(cfg SkeletonAvatarConfig) render.HTML
SkeletonAvatar renders an avatar-with-text loading placeholder on headless.Skeleton: a circle on the left with the text lines on the right, the second line dropped when HideSubline is true. The circle's diameter is the sheet's (2.5rem); a custom size is a stylesheet override on the preset class, never an inline style a strict CSP drops.
func SkeletonCard ¶
func SkeletonCard(cfg SkeletonCardConfig) render.HTML
SkeletonCard renders a card-shaped loading placeholder on headless.Skeleton: a title line, a body line-stack, and an optional footer line — one announcement, bars the stylesheet sizes by position.
func SkeletonLine ¶ added in v0.86.0
func SkeletonLine(cfg SkeletonLineConfig) render.HTML
SkeletonLine renders ONE bar on headless.Skeleton — the loading twin of a short text run (a breadcrumb trail, a one-line label), where Card/Row/Timeline would promise a shape that never arrives. One announcement, one bar, capped at the width a run of text occupies so it never reads as a full-width block.
func SkeletonRow ¶
func SkeletonRow(cfg SkeletonRowConfig) render.HTML
SkeletonRow renders a list-row loading placeholder on headless.Skeleton: a label line on the left, a value line on the right, and a trailing chevron the stylesheet draws.
func SkeletonTimeline ¶ added in v0.86.0
func SkeletonTimeline(cfg SkeletonTimelineConfig) render.HTML
SkeletonTimeline renders a timeline-shaped loading placeholder on headless.Skeleton: one row per event — a dot on the rail, a name line, and two text lines — the shape ui.Timeline arrivals have, so the placeholder promises exactly what lands. One announcement, one hidden set of bars.
func SkipLink ¶
func SkipLink(cfg SkipLinkConfig) render.HTML
SkipLink renders a WCAG 2.4.1 skip-navigation link.
func SortableList ¶ added in v0.86.0
func SortableList(cfg SortableListConfig) render.HTML
SortableList renders the list.
func SortableListItems ¶ added in v0.86.0
func SortableListItems(cfg SortableListConfig) render.HTML
SortableListItems renders just the rows without the <ol> wrapper: the fragment a conflict-recovery endpoint returns to replace a list's contents with the server's own rows.
func Spacer ¶
Spacer renders an empty flexible element that grows to fill available space, on headless.Spacer. Use inside a Stack or Cluster to push a sibling (e.g. an action button) to the far edge. Aria-hidden because it's purely visual.
func Sparkline ¶
func Sparkline(cfg SparklineConfig) render.HTML
Sparkline renders a tiny inline trend chart.
func Spinner ¶
func Spinner(cfg SpinnerConfig) render.HTML
Spinner renders a loading indicator on headless.Spinner.
Pair with data-fui-rpc lifecycle to surface pending state on island-side updates: the runtime adds `aria-busy="true"` to the containing form / button while the RPC is in flight, so a CSS rule can switch a sibling Spinner from `visibility:hidden` to visible without any per-component wiring.
func Stack ¶
func Stack(cfg StackConfig, children ...render.HTML) render.HTML
Stack renders children in a vertical column with consistent gap, on headless.Stack under this package's class map. The default replacement for hand-rolled `<div style="display:flex; flex-direction:column;gap:…">` patterns.
func StatCard ¶
func StatCard(cfg StatCardConfig) render.HTML
StatCard renders a metric card on headless.StatCard: label, value, optional trend — the label first, because the name before the number is what makes the number a fact.
func StatusBadge ¶
func StatusBadge(cfg StatusBadgeConfig) render.HTML
StatusBadge renders a small inline pill conveying state, on headless.Badge: the label is the whole of what a screen reader hears, so the tone a variant paints is decoration for the word.
func StatusPill ¶
func StatusPill(cfg StatusPillConfig) render.HTML
StatusPill renders a presentational status kicker.
func StepRail ¶
func StepRail(cfg StepRailConfig) render.HTML
StepRail renders the sticky numbered nav: headless.Steps under the rail's own class map, wrapped in the complementary <aside> the rail has always been.
func StepWizard ¶
func StepWizard(cfg StepWizardConfig) render.HTML
StepWizard renders a multi-step form with a progress indicator bar.
Server-driven: each step is a full form submission. The server reads the "wizard_action" field (value "back" or "next") to determine direction and re-renders with the updated CurrentStep.
func Sticky ¶
func Sticky(cfg StickyConfig, children ...render.HTML) render.HTML
Sticky wraps children in a position:sticky container. A layout fact with no accessibility contract: it stays a styled div.
func StringsFor ¶ added in v0.86.0
StringsFor resolves a headless.Strings from the request's context: every field from its key, through the translator WithI18n put on the context. No translator on the ctx yields the English defaults for every field, and a translator that misses a key yields English for that field — i18nui's own miss semantics, which is what makes a partial app catalog safe. A nil ctx returns headless.DefaultStrings().
Format fields keep their %s verbs and runtime-substituted fields their {name} tokens: strings travel unformatted and headless applies them at render, so a translation may reorder the words but must keep the placeholders the component formats into. That rule is enforced here, not only documented: a translation whose placeholders differ from the English default's (one dropped, one added, a %s written as {name}) is refused and the field keeps its English, because the alternative is fmt's "%!s(MISSING)" inside an accessible name, where nobody sighted would see it. Reordering is a translator's right where the substitution is by name; see placeholdersMatch for the split.
func Switch ¶
func Switch(cfg ToggleConfig) render.HTML
Switch renders a checkbox styled as an iOS-style toggle switch. Same form-submission semantics as Checkbox: submits Value (or "on") when checked, omits when unchecked.
func TableOfContents ¶
TableOfContents renders the contents navigation.
func Tabs ¶
func Tabs(cfg TabsConfig) render.HTML
Tabs renders a signal-driven tab strip through headless.Tabs: anchors carrying the kernel's signal contract (click sets the signal; the runtime mirrors it to data-active and CSS lights both the tab and the panel), roving tabindex with the full keyboard contract bound by the headless-tabs module, fragment hrefs as the no-script path.
func Tag ¶
Tag renders a small pill: optionally linked (filter chip), optionally removable (dismiss button). Pure server-rendered; dismiss is wired through standard `data-fui-rpc` semantics so the application picks the response side-effect.
func TagInput ¶
func TagInput(cfg TagInputConfig) render.HTML
TagInput renders a free-form tag input bound to a chip strip.
func TerminalBlock ¶
func TerminalBlock(cfg TerminalBlockConfig, lines ...render.HTML) render.HTML
TerminalBlock renders a CLI mock. Body lines are rendered verbatim in a pre-wrapped mono body. Embed "\n" to break lines.
func TerminalOK ¶
TerminalOK wraps a line of success output ("→ installed …").
func TerminalOut ¶
TerminalOut wraps a line of dim, secondary output (echoed commands, noise).
func TextArea ¶
func TextArea(cfg TextAreaConfig) render.HTML
TextArea renders a labelled multi-line text input.
func TextField ¶ added in v0.41.0
func TextField(cfg TextFieldConfig) render.HTML
TextField renders a FormField containing an input[type=text].
func ThemeToggle ¶
func ThemeToggle(cfg ThemeToggleConfig) render.HTML
ThemeToggle renders a dark/light color scheme toggle button.
On click, the button cycles through dark → light → auto and writes the choice to localStorage. The colorscheme.js bootstrap script picks up the change and swaps data-color-scheme on <html> so all theme tokens update immediately.
func Themed ¶
Themed wraps children in a <div class="fui-theme-<hash>"> so the CSS variable cascade applies a section-level theme override to every descendant. Components inside Themed read var(--color-…) as usual: the browser dereferences them against the override block, not the canonical :root.
Use it for dark sections, branded callouts, multi-tenant re-skinning of one subtree without touching surrounding chrome.
var Dark = style.RegisterThemeOverride(darkTheme)
ui.Themed(Dark,
ui.Section(ui.SectionConfig{Heading: "Settings"},
ui.Button(ui.ButtonConfig{Label: "Save", Variant: ui.ButtonPrimary}),
),
)
The override class block lives in /__gofastr/app.css; registering the same theme twice (same content) returns the same handle, so the CSS only ships once.
func TimePicker ¶
func TimePicker(cfg TimePickerConfig) render.HTML
TimePicker renders a styled native time input with a label.
func Timeline ¶
func Timeline(cfg TimelineConfig) render.HTML
Timeline renders an ordered list of events on a vertical rail, on headless.Timeline.
func ToastSlot ¶
ToastSlot exposes a fresh empty-stack slot Component for callers composing a preset.ToastStack(name, ToastSlot(name)) manually. preset.ToastStack uses it internally; this is exported so a host can build its own custom layout while sharing the runtime contract.
func ToggleAction ¶ added in v0.13.0
func ToggleAction(cfg ToggleActionConfig) render.HTML
ToggleAction renders the button. The marker fetches this sheet; the clicks are bound through the data-hui-action* hooks the primitive renders.
func Toolbar ¶
func Toolbar(cfg ToolbarConfig) render.HTML
Toolbar renders a horizontal action strip with role=toolbar.
func Tooltip ¶
func Tooltip(cfg TooltipConfig, trigger render.HTML) render.HTML
Tooltip wraps the given trigger HTML and appends a hidden tooltip pop. The trigger is unwrapped. Tooltip only adds a containing span + the pop element, so inline buttons and links stay inline.
Use on icon-only buttons, truncated labels, or anywhere extra context is useful without occupying layout space.
func ValidationSummary ¶
func ValidationSummary(cfg ValidationSummaryConfig) render.HTML
ValidationSummary renders an inline summary of form validation errors with anchor links to each field. Output ordering is deterministic: FieldOrder first if provided, then any leftover field names alphabetically, then the General row.
func Workbench ¶ added in v0.49.0
func Workbench(cfg WorkbenchConfig) render.HTML
Workbench renders the two-pane inspector shell.
Types ¶
type AnchoredRailConfig ¶
type AnchoredRailConfig struct {
// Label is the visible heading above the rail (e.g. "Categories",
// "By intent", "The path"). Required: also doubles as the
// aria-label on the underlying <aside>.
Label string
// Items in display order. Required.
Items []RailItem
// ObserveSelector is the CSS selector for the container the
// headless-rail module watches for in-view sections. Typically the
// id of a wrapper around the sections (e.g. "#docs-sections"). If
// empty, the rail is purely static: the links work and nothing is
// marked.
ObserveSelector string
// TargetSelector overrides the module's default heading targets.
// Set it when the sections aren't headings (e.g. ".intent[id]").
TargetSelector string
// Class is appended to the <aside>'s class list.
Class string
// ID optionally tags the <aside>.
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the rail's root <aside>.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-hui-* (the rail wiring), and aria-label (use Label).
ExtraAttrs html.Attrs
}
AnchoredRailConfig configures the rail.
type AnimatedCounterConfig ¶
type AnimatedCounterConfig struct {
// To is the target value (required).
To int
// From is the starting value during animation. Default 0.
From int
// DurationMs is the animation length. Default 1200.
DurationMs int
// Prefix / Suffix are static strings on either side (e.g.
// Prefix="$", Suffix="+", Suffix=" users").
Prefix string
Suffix string
// ID / Class are passed through.
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the counter's root.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and every data-hui-* hook.
ExtraAttrs html.Attrs
}
AnimatedCounterConfig configures an AnimatedCounter.
type AspectRatio ¶
type AspectRatio string
AspectRatio selects a CSS aspect-ratio bucket.
const ( AspectRatio1_1 AspectRatio = "1-1" AspectRatio4_3 AspectRatio = "4-3" AspectRatio16_9 AspectRatio = "16-9" AspectRatio21_9 AspectRatio = "21-9" AspectRatio3_4 AspectRatio = "3-4" AspectRatio3_2 AspectRatio = "3-2" AspectRatio2_3 AspectRatio = "2-3" AspectRatioAuto AspectRatio = "auto" )
type AspectRatioConfig ¶
type AspectRatioConfig struct {
// Ratio is the aspect-ratio bucket (required). Use one of the
// AspectRatio* constants.
Ratio AspectRatio
// Class adds extra CSS classes.
Class string
// ID sets the element id.
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the wrapper's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), style and data-fui-*.
ExtraAttrs html.Attrs
}
AspectRatioConfig configures an aspect-ratio wrapper.
type AuthCardConfig ¶ added in v0.7.0
type AuthCardConfig struct {
// Title is the card heading (e.g. "Sign in to Acme").
Title string
// Alert is an optional message shown above the body, typically a
// failed-login notice. Empty renders nothing.
Alert render.HTML
// Body is the card contents, typically a ui.Form.
Body render.HTML
// Footer is an optional row below the body, e.g. a "Create an
// account" link.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the card's root element.
// Keys the component owns are dropped: class (use Class), id, and
// data-fui-*.
ExtraAttrs html.Attrs
}
AuthCardConfig configures an AuthCard.
type AvatarConfig ¶
type AvatarConfig struct {
// Name is required; used for alt text and to derive initials when
// no image source is set.
Name string
Src string // optional image URL; falls back to initials when empty
Size AvatarSize // sm | "" (default md) | lg | xl
// Status draws a presence dot in the lower corner (online / away /
// busy / offline). Empty renders no dot.
Status AvatarStatus
// StatusLabel overrides the dot's accessible name. Defaults to the
// status value (e.g. "online"). Ignored when Status is empty.
StatusLabel string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the avatar's root <span>.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
AvatarConfig configures an avatar.
type AvatarGroupConfig ¶
type AvatarGroupConfig struct {
// Avatars is the source list: at least one. Order matters: the
// first element renders on top.
Avatars []AvatarConfig
// Max caps how many avatars render before the "+N" indicator
// replaces the remainder. Default 5.
Max int
// Size propagates to each child Avatar unless the child has its
// own Size set explicitly. Default AvatarMd.
Size AvatarSize
// Label is the aria-label on the group element. Default "Avatars".
Label string
// ShowNames wraps each Avatar in a Tooltip so hover / keyboard
// focus reveals the avatar's Name. Useful for team-roster stacks
// where the SR-only initials aren't enough for sighted users.
ShowNames bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the group's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, role, and aria-label (use Label).
ExtraAttrs html.Attrs
}
AvatarGroupConfig configures an avatar group / stack.
type AvatarSize ¶
type AvatarSize string
AvatarSize is one of a small set of pre-defined avatar sizes. Sizes are CSS classes, not inline styles, so a strict CSP that blocks `style="…"` attributes still works.
const ( AvatarSm AvatarSize = "sm" // ~1.5rem AvatarMd AvatarSize = "" // default ~2.5rem AvatarLg AvatarSize = "lg" // ~3rem AvatarXl AvatarSize = "xl" // ~4rem )
type AvatarStatus ¶ added in v0.19.0
type AvatarStatus string
AvatarStatus is a presence indicator drawn as a small dot in the avatar's lower corner. Empty renders no dot. Colors come from the status tokens so a themed app recolors them for free. This is the visual half of presence; the framework does not track who is online: an app feeds the status from its own source (see the presence note in framework/docs/content/interactive-patterns.md).
const ( AvatarStatusNone AvatarStatus = "" // no dot (default) AvatarOnline AvatarStatus = "online" // success token AvatarAway AvatarStatus = "away" // warning token AvatarBusy AvatarStatus = "busy" // danger token AvatarOffline AvatarStatus = "offline" // muted token )
type BackToTopConfig ¶
type BackToTopConfig struct {
// Position selects which corner the button anchors to.
// Defaults to BackToTopBottomRight when empty.
Position BackToTopPosition
// Icon overrides the button content. Pass any render.HTML
// (SVG markup, text, an icon component, etc).
// Defaults to a chevron-up arrow SVG.
Icon render.HTML
// ThresholdPx is the scroll distance in pixels before the
// button becomes visible. Defaults to 400 when 0.
ThresholdPx int
// Smooth controls scroll-to-top behavior.
// Defaults to smooth scrolling (BackToTopSmooth).
// Set to BackToTopInstant for no animation.
Smooth BackToTopScrollBehavior
// Size controls the button diameter.
// Defaults to BackToTopMD (2.75rem).
Size BackToTopSize
// Variant controls the color scheme.
// Defaults to BackToTopPrimary (solid primary color).
Variant BackToTopVariant
// Offset controls the distance from the viewport edge.
// Defaults to BackToTopOffsetMD.
Offset BackToTopOffset
// Label overrides the aria-label. Defaults to "Back to top".
Label string
// ScrollTarget overrides the scroll-to selector.
// Defaults to scrolling to y=0. Set to a CSS selector
// (e.g. "#main-content") to scroll a specific element
// into view instead.
ScrollTarget string
// ID is an optional id for the root element.
ID string
// Class is an optional extra CSS class.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root <button>. Keys
// the component owns are dropped: class and id (use Class / ID),
// data-fui-*, type, aria-label (use Label), and inert (the
// runtime's initial-hidden wiring).
ExtraAttrs html.Attrs
}
BackToTopConfig configures the back-to-top button.
type BackToTopOffset ¶
type BackToTopOffset string
BackToTopOffset presets for distance from the viewport edge.
const ( BackToTopOffsetNone BackToTopOffset = "none" BackToTopOffsetSM BackToTopOffset = "sm" BackToTopOffsetMD BackToTopOffset = "" // default BackToTopOffsetLG BackToTopOffset = "lg" BackToTopOffsetXL BackToTopOffset = "xl" )
type BackToTopPosition ¶
type BackToTopPosition string
BackToTopPosition selects which corner the button anchors to.
const ( BackToTopBottomRight BackToTopPosition = "br" BackToTopBottomLeft BackToTopPosition = "bl" BackToTopTopRight BackToTopPosition = "tr" BackToTopTopLeft BackToTopPosition = "tl" )
type BackToTopScrollBehavior ¶
type BackToTopScrollBehavior string
BackToTopScrollBehavior controls the scroll animation.
const ( BackToTopSmooth BackToTopScrollBehavior = "" // default BackToTopInstant BackToTopScrollBehavior = "instant" )
type BackToTopSize ¶
type BackToTopSize string
BackToTopSize controls the button diameter.
const ( BackToTopSM BackToTopSize = "sm" BackToTopMD BackToTopSize = "" // default (2.75rem) BackToTopLG BackToTopSize = "lg" )
type BackToTopVariant ¶
type BackToTopVariant string
BackToTopVariant selects the color variant.
const ( BackToTopPrimary BackToTopVariant = "" // default: solid primary BackToTopSecondary BackToTopVariant = "secondary" // outlined, subtle BackToTopGhost BackToTopVariant = "ghost" // transparent bg, only visible on hover )
type BannerConfig ¶
type BannerConfig struct {
// Title is the bold lead-in (required).
Title string
// Body is the supporting text (optional).
Body string
// Variant picks color + role. Defaults to BannerInfo.
Variant BannerVariant
// Strip renders a full-width announcement with square edges and inline copy.
Strip bool
// Dismissible adds an X button. When DismissID is set the runtime
// records the dismissal in localStorage AND a same-name cookie; when
// Ctx also carries the request (app.WithRequest, layouts and screens
// get this automatically), Banner sees the cookie and renders nothing
// at all on later requests, no flash of a dismissed banner before
// the runtime's hide pass. (Richer server-side persistence is still
// up to the app. Banner doesn't ship its own RPC.)
Dismissible bool
DismissID string
// Action is an optional inline call-to-action (a Link or Button
// rendered to the right of the body).
Action render.HTML
// ID / Class are passed through to the outer element.
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the banner's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and the severity contract (role, aria-live,
// derived from Variant).
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the dismiss label.
// When nil, English fallbacks apply.
Ctx context.Context
}
BannerConfig configures a Banner.
type BannerVariant ¶
type BannerVariant string
BannerVariant picks the color / icon family.
const ( BannerInfo BannerVariant = "" BannerSuccess BannerVariant = "success" BannerWarn BannerVariant = "warn" BannerDanger BannerVariant = "danger" )
type BarChartBar ¶
type BarChartBar struct {
// Label is the x-axis category label + AT <title>.
Label string
// Value is the bar height (≥0).
Value float64
// Color overrides the default theme primary. Accepted forms:
// - a palette token: "primary", "info", "success", "warning",
// "danger" (rendered via a theme class, so it re-skins in dark
// mode);
// - a registered status variant name (ui.RegisterStatusVariant),
// resolved to its accent color;
// - a CSS color written as hex (#rgb/#rgba/#rrggbb/#rrggbbaa),
// or a rgb()/rgba()/hsl()/hsla()/oklch()/color() function, or
// var(--…), emitted verbatim as the SVG fill.
//
// CSS named colors ("tomato") must be written as hex or var(). An
// unrecognized value falls back to the theme primary instead of
// rendering an invalid (black) fill.
Color string
}
BarChartBar is one bar.
type BarChartConfig ¶
type BarChartConfig struct {
// Bars are the entries (≥1).
Bars []BarChartBar
// Width / Height in CSS pixels. Default 320×200.
Width int
Height int
// ShowAxis renders a left value axis: hairline gridlines at clean
// tick values with numeric labels down the left gutter. Default off
// (the always-on value labels + baseline already make magnitudes
// legible; turn this on for a denser analytical read).
ShowAxis bool
// ShowLabels renders the category labels under each bar. Long labels
// wrap onto up to two lines; a single over-long word is ellipsized
// with the full text preserved in the bar's <title>. Default off.
ShowLabels bool
// HideValues suppresses the per-bar value labels that ride above each
// cap. Values are shown by default. Set this to opt out (e.g. a dense
// sparkline-style strip where the numbers would crowd).
HideValues bool
// FitHeight sizes the SVG to hug the tallest bar instead of a
// fixed Height: the plot area is chosen so the tallest bar lands
// at 96px and the SVG height becomes the value/label gutters plus
// exactly that, so no empty band pads the space above the caps.
// The y-scale still rounds up to a clean maximum (the headroom
// rule), so bar RATIOS are identical to the fixed-height chart —
// only the blank pixels above the tallest bar are gone. Ignored
// when Height is set explicitly.
FitHeight bool
// LabelledBy is the id of an element naming the chart for AT.
LabelledBy string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root <svg>. Keys the
// component owns are dropped: class and id (use Class / ID),
// data-fui-*, width, height, viewBox, xmlns, role,
// aria-labelledby (use LabelledBy), and aria-hidden. With no Bars
// the extras land on the shared zero-data placeholder instead.
ExtraAttrs html.Attrs
}
BarChartConfig configures a BarChart.
type BoxConfig ¶
type BoxConfig struct {
Pad BoxPad // padding (none | sm | md | lg | xl)
Surface bool // when true, applies the surface background + border-radius
Outlined bool // when true, applies a 1px border (pairs well with Surface=false)
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the box's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), style and data-fui-*.
ExtraAttrs html.Attrs
}
BoxConfig configures a Box wrapper.
type BreadcrumbsConfig ¶ added in v0.86.0
type BreadcrumbsConfig struct {
// Items are the steps, shallowest first.
Items []Crumb
// Label is the nav landmark's accessible name. Defaults to
// "Breadcrumb", resolved per request through StringsFor when a
// translator is on the context.
Label string
// CompactMobile shows only the final two steps below md, without
// a leading separator. The full trail remains on wide screens.
CompactMobile bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the <nav> root.
// Keys the component owns are dropped: class and id (use Class /
// ID) and aria-label (use Label).
ExtraAttrs html.Attrs
// Ctx resolves the Strings table through the request's translator.
Ctx context.Context
}
BreadcrumbsConfig configures the trail.
type ButtonConfig ¶
type ButtonConfig struct {
Label string // required visible text + aria-label
// AriaLabel overrides the accessible name when it must differ from
// the visible Label: a row of buttons all reading "Revoke" that
// each need a distinct accessible name ("Revoke admin from Alice").
// Empty ⇒ the accessible name is Label. This is the supported way
// to set it — an aria-label in ExtraAttrs is dropped (owned key).
AriaLabel string
// Variant defaults to ButtonPrimary.
Variant ButtonVariant
// Size defaults to ButtonSizeDefault.
Size ButtonSize
// Type is the button type: "button" (default), "submit", or "reset".
Type string
// Disabled renders the disabled state. This is the supported way to
// set it — a disabled key in ExtraAttrs panics pointing here.
Disabled bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the rendered <button>.
// Every data-fui-* key is runtime wiring and goes through the
// typed Action seam (attach interactive wiring with
// interactive.Action.Attrs(), interactive.OpenOnClick and friends —
// headless.ButtonProps.Action admits exactly that vocabulary and
// panics on any data-fui-* key outside it, where the old carrier
// contract rendered it as a dead attribute). Keys the component
// owns are dropped: class and id (use Class / ID), type (use
// Type), disabled (use Disabled) and aria-label (use AriaLabel).
ExtraAttrs html.Attrs
ID string
Class string
}
ButtonConfig configures a button.
type ButtonSize ¶
type ButtonSize string
ButtonSize is the rendered button size. Default sits on a 44px touch-target floor (WCAG 2.5.5). ButtonSizeSmall opts out of the floor for row-action contexts where the parent row already provides the tap area (table rows, dense toolbars). ButtonSizeLarge bumps padding + font-size for hero CTAs.
const ( ButtonSizeDefault ButtonSize = "" ButtonSizeSmall ButtonSize = "small" ButtonSizeLarge ButtonSize = "large" )
func RegisterButtonSize ¶ added in v0.13.0
func RegisterButtonSize(name string, css VariantCSS) ButtonSize
RegisterButtonSize registers a custom ButtonSize under name (shared by Button and LinkButton, same rules as RegisterButtonVariant: sizes and variants share the ui-button--<name> class namespace, so a name can only be one or the other).
type ButtonVariant ¶
type ButtonVariant string
ButtonVariant is the semantic variant of a Button. String-typed for ergonomic Go enums + readable serialization. Apps extend the set with RegisterButtonVariant; unregistered values panic at render.
const ( ButtonPrimary ButtonVariant = "primary" ButtonSecondary ButtonVariant = "secondary" ButtonDanger ButtonVariant = "danger" ButtonGhost ButtonVariant = "ghost" )
func RegisterButtonVariant ¶ added in v0.13.0
func RegisterButtonVariant(name string, css VariantCSS) ButtonVariant
RegisterButtonVariant registers a custom ButtonVariant under name and returns the typed value to pass as ButtonConfig.Variant / LinkButtonConfig.Variant (the two share the variant set and the ui-button stylesheet). The CSS lands in the registered ui-button sheet as plain `.fui-button--<name>` class rules, and the class itself joins the shared button class map, so every wearer — Button, LinkButton, ToggleAction, OptimisticAction — draws it.
Call at package init. Panics on: empty/invalid name (allowed: lowercase letters, digits, hyphens), a built-in or already-registered name, empty or odd-count Props/Hover/Focus, or registration after the ui-button sheet was built.
type CalloutConfig ¶
type CalloutConfig struct {
Title string
Variant StatusVariant // info | success | warning | danger | neutral
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the callout's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// data-fui-* and role.
ExtraAttrs html.Attrs
}
CalloutConfig configures a persistent informational block.
type CardConfig ¶
type CardConfig struct {
// Heading is the optional top-of-card title, rendered as a
// heading inside the card's header. The heading level defaults to
// 3; a card does not know how deep in the outline it sits, so a
// page that nests cards under an h2 says HeadingLevel: 2.
Heading string
// HeadingLevel overrides the heading element level (default 3).
HeadingLevel int
// Description is optional supporting text rendered beneath the
// heading.
Description string
// Header replaces the auto-rendered Heading/Description block
// through the primitive's fillable header part. Use when the
// header needs more than a title, e.g. a row with an avatar and
// trailing actions.
Header render.HTML
// Common usage: button row, last-updated timestamp, status pill.
Footer render.HTML
// Interactive flips the surface to a focusable, hover-able link
// shell. When set, the card renders as an <a> wrapping one inner
// part so the entire surface activates on click.
Href string
Variant CardVariant
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the card's root element,
// whichever shape it takes (<a> or <div>). Keys the component
// owns are dropped: class and id (use Class / ID), style,
// data-fui-* and href (use Href).
ExtraAttrs html.Attrs
}
CardConfig configures a card.
type CardVariant ¶
type CardVariant string
CardVariant selects the chrome treatment. Apps extend the set with RegisterCardVariant; unregistered values panic at render.
const ( // CardElevated is the default: surface + shadow + radius. CardElevated CardVariant = "" // CardOutlined draws a 1px border instead of a shadow. CardOutlined CardVariant = "outlined" // CardFlat drops both the border and the shadow. CardFlat CardVariant = "flat" // CardRow is a dense linked record: heading and body metadata above // the description, with no elevated chrome. CardRow CardVariant = "row" )
func RegisterCardVariant ¶ added in v0.13.0
func RegisterCardVariant(name string, css VariantCSS) CardVariant
RegisterCardVariant registers a custom CardVariant under name. The CSS lands in the registered ui-card sheet as `[data-fui-comp="ui-card"].fui-card--<name>` rules. Same rules and panics as RegisterButtonVariant ("interactive" is reserved: Card uses it for the Href form).
type CarouselConfig ¶
type CarouselConfig struct {
// Slides are the entries (≥1).
Slides []CarouselSlide
// Label is the accessible label for the carousel region (required,
// becomes role=region + aria-label).
Label string
// NoDots hides the pagination dots.
NoDots bool
// NoArrows hides the Prev/Next buttons.
NoArrows bool
// AutoRotateMs, when > 0, auto-advances every N ms. Paused on
// hover, focus, hidden tab and prefers-reduced-motion.
AutoRotateMs int
// Loop makes Next-on-last wrap to first (and vice versa). Default
// false: Prev/Next refuse at the ends.
Loop bool
// VisiblePerView (default 1) shows N slides side-by-side.
VisiblePerView int
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the carousel's root.
// Keys the component owns are dropped: class and id, the data-hui-*
// wiring, and the region contract (role, aria-roledescription,
// aria-label).
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the
// carousel's sentences. When nil, English fallbacks apply.
Ctx context.Context
}
CarouselConfig configures a Carousel.
type CarouselSlide ¶
type CarouselSlide struct {
// Content is the slide body (required). Caller decides the shape.
Content render.HTML
// Label is the slide's accessible label. Defaults to the
// Strings.CarouselSlide sentence ("Slide {n} of {total}").
Label string
}
CarouselSlide is one entry.
type CenterConfig ¶
type CenterConfig struct {
// MinHeight maps to a class: "viewport" (100vh), "screen" (100dvh
// where supported), or "" (auto). Used for empty-state landing /
// onboarding panels.
MinHeight string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the region's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), style and data-fui-*.
ExtraAttrs html.Attrs
}
CenterConfig configures a centered region.
type CheckboxGroupConfig ¶
type CheckboxGroupConfig struct {
// Name is the shared form-field name for all checkboxes (required).
Name string
// Legend is the group label rendered as <legend> (required).
Legend string
// Options is the list of checkbox options (required, at least one).
Options []CheckboxGroupOption
// Help renders supporting text under the group.
Help string
// Error replaces Help with an error message.
Error string
// Required marks every leaf required.
Required bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the group's root
// <fieldset> element, with the same owned-key drops as
// RadioGroup's.
ExtraAttrs html.Attrs
}
CheckboxGroupConfig configures a group of checkboxes.
type CheckboxGroupOption ¶
CheckboxGroupOption describes one checkbox in a CheckboxGroup.
type ClusterConfig ¶
type ClusterConfig struct {
Gap Gap
Align Align
Justify Justify
// NoWrap opts out of the default responsive wrapping behavior. Use it only
// for compact chrome that is guaranteed to fit, such as two icon controls.
NoWrap bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the cluster's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), style, data-fui-* and the data-hui-* hooks.
ExtraAttrs html.Attrs
}
ClusterConfig configures a horizontal cluster.
type CodeBlockConfig ¶
type CodeBlockConfig struct {
Code string // raw source to render; escaped. Ignored when Lines is set.
Language string // optional, used for aria-label only
// Lines carries pre-rendered (e.g. syntax-highlighted) logical source
// lines. When non-empty it takes precedence over Code; each entry is
// wrapped as one line so LineNumbers can number it. Callers own the
// per-token markup: pass already-escaped, trusted HTML.
Lines []render.HTML
// Filename, when set, renders a chrome header (status dot + filename)
// above the body and switches the wrapper to a framed container.
Filename string
// ShowCopy adds a copy-to-clipboard button (the framework CopyButton)
// in the header, targeting this block's own body. Forces a header even
// when Filename is empty.
ShowCopy bool
// LineNumbers renders a left gutter numbering each line.
LineNumbers bool
// Scroll caps the body height (var(--ui-code-block-scroll-max,
// 26rem)) and makes it scroll vertically, for showing a long file in
// full without letting it dominate the page. Implies the framed
// container.
Scroll bool
// HighlightLines marks the given 1-based source lines with
// fui-code-block__line--highlight, a background band that reaches the
// block's edge. Ranges past the last line match nothing.
HighlightLines []LineRange
// Diff classifies lines by their first character: '+' (including the
// '+++' file-header form) gets fui-code-block__line--added, '-' (and
// '---') gets --removed. The marker stays in the text: a diff's
// content IS the diff. On the Lines path a leading token span is
// skipped, so the marker behind it still classifies.
Diff bool
// HighlightWords wraps literal (not regex) matches inside a line in
// <mark class="fui-code-block__mark">. Matching runs on the source
// text of each line's text nodes: a word never matches across a tag
// boundary, and marked text is escaped like the rest of the line.
HighlightWords []string
// Wrap soft-wraps long lines (white-space: pre-wrap) instead of the
// default horizontal scroll. The zero value keeps today's behaviour:
// code blocks scroll, they do not wrap.
Wrap bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the block's root element, whichever shape
// it takes (a bare <pre> or a framed <div>). Keys the component
// owns are dropped: class and id (use Class / ID), data-fui-*, and
// the scroll contract (tabindex, aria-label) that lives on the
// <pre> body.
ExtraAttrs html.Attrs
}
CodeBlockConfig configures a styled code-sample block.
type CodeSample ¶ added in v0.32.0
type CodeSample struct {
// Label is the visible tab text ("Go", "TypeScript", "curl"). Required.
Label string
// Language is the HighlightLines language key (go, js, ts, sql, json,
// yaml, shell, …). Unknown values fall back to plain escaped text.
Language string
// Code is the raw source; it is escaped/tokenized, never trusted HTML.
// Required.
Code string
// Filename, when set, renders the CodeBlock's framed chrome header.
Filename string
}
CodeSample is one language tab in a CodeTabs group: a label, a language key for syntax highlighting, and the raw source.
type CodeTabsConfig ¶ added in v0.32.0
type CodeTabsConfig struct {
// Name groups the tabs as one exclusive set (native <details name=>
// exclusivity). Required and must be unique within the page.
Name string
// Label is an optional aria-label for the group.
Label string
// LineNumbers turns on the CodeBlock line-number gutter for every tab.
LineNumbers bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the tab group's root
// element. Keys the component owns are dropped: class (use
// Class), id (ID tags the inner tabset, not the root), and
// data-fui-*.
ExtraAttrs html.Attrs
}
CodeTabsConfig configures a CodeTabs group.
type CollapsibleConfig ¶
type CollapsibleConfig struct {
Summary string // required: the always-visible header
Open bool // optional: start expanded (default: collapsed)
Class string // optional: additional CSS classes
ID string // optional: element id
// Name groups sections into an exclusive set: sections sharing a
// Name are the native <details name> group, so opening one closes
// the others with no script. Empty leaves each section independent.
Name string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root <details>. Keys
// the component owns are dropped: class and id (use Class / ID),
// the data-hui-* wiring, and open (use Open).
ExtraAttrs html.Attrs
}
CollapsibleConfig configures an expand/collapse section. Uses the native <details> element; the headless-disclosure module supplies the accessibility behaviour (Escape to close, aria-expanded mirroring) through the data-hui-disclosure hook.
type ColorFieldConfig ¶ added in v0.49.0
type ColorFieldConfig struct {
// Name is the hex text input's form-field name (required): the
// text input is the control that submits.
Name string
// Value is the authoritative value, placed in the text input
// verbatim. When it is not #rgb or #rrggbb the swatch falls back
// to black and the shell is marked data-invalid.
Value string
// TextID is the id of the text input, for a label's `for`.
// A Field's id wins over it when both are set.
TextID string
// SwatchLabel is required. The swatch's own accessible name comes
// from the component's PickColor word plus Name; SwatchLabel
// names the TEXT input when TextLabel is empty — the input that
// carries the value is the worse of the two to leave unnamed,
// and the easy one to miss, because a caller that wraps this in
// its own <label for=…> sees a labelled control while a caller
// that does not ships an unnamed critical control.
SwatchLabel string
// TextLabel is the accessible name for the text input. Defaults
// to SwatchLabel. Set aria-label or aria-labelledby in TextAttrs
// to take over.
TextLabel string
// SwatchAttrs and TextAttrs add attributes to the respective
// inputs, for the data-* attributes a caller's own JS binds to.
// Keys the component owns are dropped: the swatch's aria-label,
// type, value and tabindex; the text input's name, value and the
// field wiring; and every data-fui-* / data-hui-* key.
SwatchAttrs html.Attrs
TextAttrs html.Attrs
Class string
// ExtraAttrs forwards additional attributes to the shell's root
// element. Keys the component owns are dropped: class (use
// Class), id, and every data-fui-* / data-hui-* key. Per-input
// attributes belong in SwatchAttrs / TextAttrs.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the swatch's
// word (ui.StringsFor: PickColor). When nil, the English default
// is used.
Ctx context.Context
// Field is the wiring an enclosing FormField handed its builder:
// applied to the text input (id, described-by chain, invalid
// state), and it wins over TextID. Zero value means standalone.
Field headless.FieldControl
}
ColorFieldConfig configures a ColorField.
type ColorPickerConfig ¶
type ColorPickerConfig struct {
// Name is the form field name for the color input (required).
Name string
// Label is the accessible label (required).
Label string
// Value is the initial color (hex, e.g. "#4F46E5"). Defaults to
// the browser's native default (black) when empty.
Value string
// Disabled disables the input.
Disabled bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the picker's root element
// (the wrapper div, not the <input>). Keys the component owns
// are dropped: class, id (the wrapper id derives from ID / Name),
// and data-fui-*.
ExtraAttrs html.Attrs
}
ColorPickerConfig configures a ColorPicker.
type Column ¶
type Column struct {
// Key is the column identifier used for sort state and matching
// against Row.Cells. Required.
Key string
// Header is the visible column header text. May be empty: an
// actions or icon column. A sortable column with no header gets
// its sort anchor named from the column Key.
Header string
// Sortable makes the header a sort control: an anchor that
// re-submits the screen's query with this column's Key and the
// next direction.
Sortable bool
// Align is "start" (default), "center", or "end". It reaches the
// markup as the column's variant, so the class map names the
// alignment class for the header and the cell.
Align string
}
Column describes one DataTable column.
type ComboboxConfig ¶ added in v0.86.0
type ComboboxConfig struct {
// ID is the input element id (the listbox takes <ID>-listbox).
// Required, page-unique.
ID string
// Name is the form-submit name on the input. Required.
Name string
// Label is the visible label text. Required.
Label string
// LabelHidden folds the label into the visually-hidden recipe (the
// placeholder or surrounding chrome already names the field).
LabelHidden bool
// Placeholder for the input.
Placeholder string
// Options is a static list the module filters client-side. Takes
// precedence over Island.
Options []headless.ComboboxOption
// Island is the typed in-page results contract: the endpoint that
// re-renders the listbox and the signal the region is bound to.
Island *headless.Island
// NoScriptAction is the form's action URL, the no-script
// destination: same-origin, a GET that submits the query. Required
// when Island is set; refused when it is "#".
NoScriptAction string
// DebounceMs bounds the input debounce. Default 250.
DebounceMs int
// Class rides the wrapper beside the component's own class.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the combobox's root.
// Keys the component owns are dropped, as everywhere.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the
// combobox's sentences. When nil, English fallbacks apply.
Ctx context.Context
}
ComboboxConfig configures a Combobox.
type CommandPaletteConfig ¶
type CommandPaletteConfig struct {
// Name uniquely identifies the modal widget. Default
// "command-palette".
Name string
// RPCPath is the search endpoint. The handler receives the
// query string and returns `<li role="option">…</li>` fragments
// to swap into the listbox. Required unless Commands is set.
RPCPath string
// Placeholder is the input placeholder. Default
// "Type a command or search…".
Placeholder string
// Shortcut is the chord that opens the palette. Default "Meta+K"
// (Cmd+K on Mac, Ctrl+K elsewhere: the runtime treats either as
// Mod when matching).
Shortcut string
// DebounceMs is the search debounce window. Default 150 (snappier
// than a generic combobox since results render eagerly).
DebounceMs int
// TriggerLabel is the SR-only trigger button text: what AT
// users hear if they tab to it. Default "Open command palette".
TriggerLabel string
// EmptyHTML is the listbox HTML at first paint. Empty (default)
// renders a placeholder hint.
EmptyHTML string
// Commands, when non-empty, renders a static, client-side-filtered
// command list, no search endpoint needed. Use for a small fixed
// set (docs/nav links) so the palette works on a serverless export
// where no RPC handler exists. Takes precedence over RPCPath.
Commands []PaletteCommand
// FallbackHref is the ordinary same-origin destination the trigger
// navigates to without script: a modal trigger with no navigation
// path is a button a scriptless reader cannot use. Required; "#"
// and cross-origin values are refused at render.
FallbackHref string
// Ctx carries the per-request context used to resolve i18n labels
// (placeholder, trigger + dialog titles, hint chips). When nil,
// English fallbacks apply.
Ctx context.Context
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) onto the palette's own root
// (the ui-cmd-palette panel inside the modal; the modal chrome is
// widget machinery). Keys the component owns are dropped:
// class, id, and data-fui-*.
ExtraAttrs html.Attrs
}
CommandPaletteConfig configures the command palette.
type ConditionalFieldConfig ¶
type ConditionalFieldConfig struct {
// WhenName is the form field name to watch. Required.
WhenName string
// WhenValue is the value that triggers showing the children.
// For checkboxes/radios, this matches the value attribute. Required.
WhenValue string
// Children is the content to show when the condition is met.
Children []render.HTML
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the region's root
// element. Keys the component owns are dropped: class (use
// Class), id, data-fui-*, data-hui-* (the region's hooks are the
// runtime's contract, not a caller's to forge), hidden and
// aria-hidden (the module owns the region's visibility).
ExtraAttrs html.Attrs
}
ConditionalFieldConfig configures a field conditionally shown based on another field's value.
type ConfirmActionConfig ¶
type ConfirmActionConfig struct {
// Name uniquely identifies the modal widget. Required.
// Usually qualified per row, e.g. "delete-user-42".
Name string
// TriggerLabel is the visible text on the destructive button.
// Required.
TriggerLabel string
// TriggerVariant maps to one of the framework button variants.
// Defaults to "danger". The trigger always renders as
// .fui-btn--<TriggerVariant>.
TriggerVariant string
// Title is the alertdialog title (h2). Required.
Title string
// Body is the alertdialog body paragraph. Required: the body
// gives the user the information they need to confirm safely.
Body string
// ConfirmLabel defaults to "Confirm".
ConfirmLabel string
// CancelLabel defaults to "Cancel".
CancelLabel string
// RPCPath is the endpoint the Confirm button posts to. Required.
RPCPath string
// RPCMethod defaults to "POST".
RPCMethod string
// SuccessSignal, when set, emits data-fui-rpc-signal="<name>" on
// the Confirm button. On a 2xx response the runtime broadcasts
// the response body (typically the fresh authoritative list HTML)
// into the named signal: pair it with a
// data-fui-signal="<name>" data-fui-signal-mode="html" region to
// swap in that HTML (e.g. the shorter list after a delete). On a
// non-2xx response html-mode regions are left unchanged (the
// optimistic-UI invariant: a failed delete leaves the row/list
// intact), while text-mode regions render a human-readable
// "Error: …" string. Empty (the default) leaves the response
// unused, which is correct for fire-and-forget confirms.
//
// The name MUST match ^[A-Za-z0-9_-]+$: ConfirmAction panics
// otherwise. The runtime interpolates the value into a CSS
// attribute selector (querySelectorAll '[data-fui-signal="…"]'),
// so any other shape is either an invalid selector (silently
// drops the broadcast) or a selector-injection footgun.
SuccessSignal string
// AutofocusConfirm flips the initial focus from Cancel (the
// default, safer choice for destructive flows where accidental
// Enter must not fire the action) to Confirm. Set to true for
// non-destructive confirmations ("Apply changes?", "Continue?").
AutofocusConfirm bool
// Ctx carries the per-request context used to resolve the
// Confirm/Cancel button labels. When nil, English fallbacks apply.
Ctx context.Context
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) onto the dialog's own root
// (the ui-confirm-action panel; the modal chrome is widget
// machinery, and the trigger is a plain ui.Button — render a
// Button yourself for trigger-level extras). Keys the component
// owns are dropped: class, id, and data-fui-*.
ExtraAttrs html.Attrs
}
ConfirmActionConfig configures the confirmation flow.
type ContainerConfig ¶
type ContainerConfig struct {
// Width picks the max-inline-size. Defaults to ContainerDefault.
Width ContainerWidth
// Pad picks the block padding. Defaults to ContainerPadNone.
Pad ContainerPad
// As lets the caller pick a non-<div> tag (e.g. "section", "main").
// Defaults to "div".
As string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the wrapper element.
// Keys the component owns are dropped: class and id (use Class /
// ID), style and data-fui-*.
ExtraAttrs html.Attrs
}
ContainerConfig configures a Container.
type ContainerPad ¶ added in v0.86.0
type ContainerPad string
ContainerPad picks the block padding: the page's rhythm between the site header, the content and the footer. The two sizes are CSS variables (--ui-container-pad-start, --ui-container-pad-end) a theme can retune.
const ( // ContainerPadNone adds no block padding: a container nested inside // a page, or a page whose first block owns its own top spacing. ContainerPadNone ContainerPad = "" // ContainerPadPage pads both ends: roomy under the header // (clamp(40px, 6vw, 64px)), roomier above the footer // (clamp(48px, 7vw, 80px)). The main region of a marketing or // editorial page. ContainerPadPage ContainerPad = "page" // ContainerPadEnd pads only the end: a compact page whose first // block sits right under the header but still clears the footer. ContainerPadEnd ContainerPad = "end" )
type ContainerWidth ¶
type ContainerWidth string
ContainerWidth picks the max-inline-size cap.
const ( // ContainerNarrow caps at ~640px: long-form prose, marketing. ContainerNarrow ContainerWidth = "narrow" // ContainerDefault caps at ~1080px: most pages. ContainerDefault ContainerWidth = "" // ContainerWide caps at the wide width (1280px default): dashboards. ContainerWide ContainerWidth = "wide" // ContainerPage caps at the page measure (Theme.Layout.PageWidth, // --size-page-width, 66rem default): the editorial column of a // marketing page. // A recipe's main and its header/footer bands share it. Like the // bands, the content box is the measure and the page gutter sits // outside it, so main's text starts on the header brand's edge. ContainerPage ContainerWidth = "page" // ContainerFull removes the cap; padding still applies. ContainerFull ContainerWidth = "full" )
type ContentRowConfig ¶ added in v0.86.0
type ContentRowConfig struct {
// Sidebar is the start column. Give it a ui.Sidebar; the column
// takes its width from the sidebar's content, sits on the surface
// color and draws the inline-end rule. Below the breakpoint the
// sidebar's own drawer serves navigation and the column stacks
// above main with a block-end rule instead.
Sidebar render.HTML
// landmark that wraps the sidebar's title, links and footer (the
// sidebar's own inner nav names only the links list). Defaults to
// "Sidebar".
NavLabel string
// Toolbar is an optional row above main, beside the sidebar —
// the workspace the shell's Toolbar slot renders. Compose a
// ui.Toolbar (or any row) here; the row owns only its placement
// and its block-end rule.
Toolbar render.HTML
// Aside is the optional end column after main: a context aside.
// It stacks below main under the breakpoint, and it releases its
// width when it holds only an empty outlet, so an unfilled
// context column takes no space.
Aside render.HTML
// AsideLabel labels the aside landmark. Defaults to "Context".
AsideLabel string
// Breakpoint picks the viewport width below which the row stacks:
// below md (48rem, the default) or below lg (64rem). Match it to
// SidebarConfig.DrawerBreakpoint so the sidebar becomes a drawer
// at the same width the row collapses.
Breakpoint StackBreakpoint
// Viewport confines desktop scrolling to main, the nav column and
// the aside: at and above the breakpoint the row fills the rest of
// the viewport below the page header and each column scrolls on
// its own; below it the page scrolls normally. The row cannot
// style its parent, so it reads the header's height from the
// --size-header-height token (56px default) — the same token
// the app-shell header band fixes its own height with — and
// assumes the page column above it is at least one screen tall.
// A recipe arranges both: ui.Stack{Screen: true} above, a header
// carrying the fixed band. The row assumes no footer band below it
// in this mode; give viewport pages their footer inside main.
Viewport bool
// below the breakpoint. Set it when the sidebar's phone navigation
// lives outside the column (a NativeMobile sidebar whose drawer
// trigger the page header hosts): the stacked column renders empty
// on phones and an empty band must not draw a line.
PhoneNavFlush bool
// Class appends to the row root's class list.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the row root. Keys the
// component owns are dropped: class (use Class), and data-fui-*.
ExtraAttrs html.Attrs
}
ContentRowConfig configures a ContentRow.
type ControlConfig ¶ added in v0.86.0
type ControlConfig struct {
// Field is the wiring the enclosing FormField handed the builder
// (the FieldControl its Input closure received). Required: a
// control built without it is exactly the defect the builder
// exists to prevent — an id the label does not point at, a
// description that never arrives, an invalid state the control
// does not carry. It supplies the id, the aria-describedby, the
// invalid state and the required flag; those four never come from
// anywhere else, because two sources for one fact is how they
// drift.
Field headless.FieldControl
// Type is the input type: text (the default), email, password,
// datetime-local, file, tel, url, search, hidden — any type the
// browser knows.
Type string
// Name is the form-field name (required).
Name string
// Value, Placeholder and AutoComplete render their attributes.
Value, Placeholder, AutoComplete string
// Disabled disables the control.
Disabled bool
// Min, Max and Step are the numeric and date bounds, through
// headless's Owned seam (which admits exactly those three keys).
Min, Max, Step string
// MinLength and MaxLength are the length constraints.
MinLength, MaxLength int
// Class appends to the control's own class.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks, a
// relation's data-rel-entity, pattern and title) onto the input.
// Keys the control owns are dropped: class and id, type, name,
// value, placeholder, autocomplete, minlength, maxlength, min,
// max, step, required, disabled, aria-invalid and
// aria-describedby.
ExtraAttrs html.Attrs
}
ControlConfig configures a Control.
type CopyButtonConfig ¶
type CopyButtonConfig struct {
// Target is a CSS selector that identifies the element whose
// textContent will be copied. Required.
Target string
// Label is the visible button text before copying. Default "Copy".
Label string
// CopiedLabel is the visible text shown briefly after success.
// Default "Copied".
CopiedLabel string
// IconOnly hides the visible label but keeps the SR-only label
// (via AriaLabel or default). Use when the button is icon-only.
IconOnly bool
// AriaLabel overrides the screen-reader name. When IconOnly is
// true and AriaLabel is empty, defaults to "Copy to clipboard".
AriaLabel string
// AnnounceText is the message written into the role=status span
// on copy success. Default "Copied".
AnnounceText string
// ToastOnCopy, when true, fires a toast on copy success. The toast
// is dispatched via window.__gofastr.toast({...}) so it stacks in
// the page's existing ToastStack (or auto-created one), no extra
// wiring required. Use ToastTitle / ToastBody / ToastVariant to
// configure the message; sensible defaults if left blank.
ToastOnCopy bool
// ToastTitle is the toast title when ToastOnCopy=true. Default "Copied".
ToastTitle string
// ToastBody is the toast body when ToastOnCopy=true. Default empty.
ToastBody string
// ToastVariant maps to the toast's variant: "success" (default),
// "info", "warning", "danger".
ToastVariant string
// ToastTTLms is the toast auto-dismiss timeout in milliseconds.
// Default 3000.
ToastTTLms int
// Ctx carries the per-request context used to resolve the
// Copy/Copied/clipboard labels. When nil, English fallbacks apply.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root wrapper (the
// span carrying data-fui-comp). Keys the component owns are
// dropped: class, id (ID lands on the button, not the wrapper),
// and data-fui-*.
ExtraAttrs html.Attrs
}
CopyButtonConfig configures the copy button.
type CounterConfig ¶
type CounterConfig struct {
// SignalName is the signal that holds the count value. Required
// unless Slice is set.
SignalName string
// Slice, when set, supplies both the signal name and the initial
// value from one typed source (and auto-seeds it). Takes precedence
// over SignalName.
Slice *store.Slice[int]
// Step is the increment/decrement size. Defaults to 1.
Step int
// Class is an optional extra CSS class on the wrapper.
Class string
// Ctx carries the per-request context used to resolve the Decrement,
// Increment and Counter group aria labels. When nil, English fallbacks apply.
Ctx context.Context
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root element. Keys
// the component owns are dropped: class (use Class), id, and
// data-fui-*, plus role=group and the aria-label it derives.
ExtraAttrs html.Attrs
}
CounterConfig configures a client-side counter with increment/decrement buttons. The counter is purely local, no RPC calls. It uses the signal system for state.
type Crumb ¶ added in v0.86.0
type Crumb struct {
// Text is the step's visible label. Required.
Text string
// Href is the step's destination; empty on the last step.
Href string
// Current marks the step as the current page whatever its Href.
Current bool
}
Crumb is one step in the breadcrumb trail.
type DataTableConfig ¶
type DataTableConfig struct {
// Columns is the column definitions. Required.
Columns []Column
// Rows is the rendered rows for the current page.
Rows []Row
// Caption is an accessible table caption (optional).
Caption string
// CaptionHidden keeps the caption out of sight: the caption still
// names the table and its scroll region for assistive technology
// (the region's aria-labelledby resolves to it) but renders
// visually hidden, for a table that sits under a visible heading
// saying the same thing. Requires Caption.
CaptionHidden bool
// SortBy is the active sort column's Key (optional). Empty means
// no column is sorted.
SortBy string
// SortDir is the active sort direction (asc/desc).
SortDir SortDir
// Summary is a sentence about the result window the caller owns,
// e.g. "Showing 8 of 10". Appended to the sort sentence the
// table's announcement carries after a sort swap: the table knows
// the sort, and only the caller knows the window.
Summary string
// Path is the screen's own path: each sort href is it plus the
// carried query, the sort parameters replaced. Empty means the
// current document — a relative "?query" href.
Path string
// Query is the request state sort anchors carry unchanged: the
// search, the filters, anything a sort must not drop. The
// primitive replaces SortParam and DirParam in it rather than
// appending duplicate pairs.
Query url.Values
// SortParam and DirParam name the sort key and direction query
// parameters. Empty defaults to "sort" and "dir".
SortParam string
DirParam string
// Island is optional. A zero value keeps plain sort anchors; a
// set value puts the GET RPC contract on those same anchors —
// the href is still the page without script, the region update
// with it. The Pagination config inherits the same endpoint and
// signal automatically.
//
// The signal-bound wrapper is the caller's responsibility: wrap
// the DataTable's rendered HTML in:
// <div data-fui-signal="<Signal>" data-fui-signal-mode="html">
// {DataTable(...)}
// </div>
Island headless.Island
// Pagination is an optional *PaginationConfig. When set, the
// pagination nav renders below the table, outside the scroll
// region. A table with an Island shares it with the pager, so
// sort and page hit the same handler and swap the same region.
Pagination *PaginationConfig
// Empty is the EmptyState shown when len(Rows) == 0, under the
// table's head: an empty result still has named columns and
// usable sort controls. If zero, a default empty state renders.
Empty EmptyStateConfig
// Responsive selects how the table behaves when its container is
// narrow. Default keeps horizontal scroll; ResponsiveCards
// collapses rows into labeled cards via container queries.
Responsive ResponsiveMode
// Ctx carries the per-request context used to resolve i18n
// strings (empty-state labels, sort aria-labels, pagination
// labels). When nil, English fallbacks are returned.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the list's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), style, data-fui-* and the data-hui-* hooks.
ExtraAttrs html.Attrs
}
DataTableConfig configures a DataTable.
Note the split between the two paginations this type touches: framework/pagination is the server side — it parses ?limit/?offset/?cursor params for the auto-generated CRUD list endpoints and builds cursor tokens, and never renders HTML — while the Pagination field takes a *PaginationConfig (this package, over the headless primitive) and renders the page-link nav below the table. A typical handler uses framework/pagination to slice the data, then feeds the resulting page count into this config's Pagination nav.
type DateFieldConfig ¶ added in v0.41.0
type DateFieldConfig struct {
Name string
Label string
ID string
Value string
Placeholder string
Help string
Error string
Class string
Required bool
Disabled bool
Min string
Max string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) onto the field's <input>. Keys the input owns
// are dropped: class and id (use ID), data-fui-*, type, name,
// value, placeholder, min, max, required, disabled,
// aria-invalid, and aria-describedby.
ExtraAttrs html.Attrs
}
DateFieldConfig configures a labelled native date field. Min, Max, and Value use the HTML date format (YYYY-MM-DD); browsers enforce the concrete value.
type DetailItem ¶ added in v0.7.0
DetailItem is one label/value row.
type DetailListConfig ¶ added in v0.7.0
type DetailListConfig struct {
Items []DetailItem
Class string
// Inline keeps short label/value pairs on one line in narrow panes.
// Long values wrap within their column instead of moving below the label.
Inline bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root <dl>. Keys the
// component owns are dropped: class (use Class), id, style and
// data-fui-*.
ExtraAttrs html.Attrs
}
DetailListConfig configures a DetailList.
type DiffViewerConfig ¶
type DiffViewerConfig struct {
// Patch is the raw unified-diff body (required). Lines prefixed
// "+" are additions, "-" are removals, " " (space) are context,
// "@@" lines are hunk headers, "---" / "+++" headers are
// rendered as a filename row.
Patch string
// Mode picks unified (default) or split layout.
Mode DiffMode
// LeftLabel / RightLabel show above split columns (defaults
// "Old" / "New").
LeftLabel string
RightLabel string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root element. Keys
// the component owns are dropped: class and id (use Class / ID),
// and data-fui-*.
ExtraAttrs html.Attrs
}
DiffViewerConfig configures a DiffViewer.
type DividerConfig ¶
type DividerConfig struct {
// Label optionally renders a centered inline label. Common
// usage: "OR" between two auth options, "Pinned" above the rest
// of a list. When set, the divider switches from a plain <hr>
// to a labelled <div role="separator">.
Label string
// Orientation selects horizontal (default) or vertical.
Orientation DividerOrientation
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the root element (<hr>,
// or the role=separator div for vertical / labelled shapes).
// Keys the component owns are dropped: class and id (use Class /
// ID), style, data-fui-*, role and aria-orientation (use
// Orientation).
ExtraAttrs html.Attrs
}
DividerConfig configures a divider.
type DividerOrientation ¶
type DividerOrientation string
DividerOrientation selects horizontal vs. vertical line.
const ( DividerHorizontal DividerOrientation = "" // default DividerVertical DividerOrientation = "vertical" )
type EmptyStateConfig ¶
type EmptyStateConfig struct {
Title string // required
Description string // optional supporting text
Action render.HTML // optional CTA (e.g. a button or link)
ID string
Class string
// HeadingLevel overrides the title's heading level (1–6). Zero defaults
// to 3 (h3), preserving the gallery/demo behaviour where the empty state
// nests inside a section. A real page that mounts the empty state as the
// only content under the page <h1> (e.g. an admin list with zero rows)
// passes 2 so the outline doesn't skip h1 → h3.
HeadingLevel int
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the empty state's root.
// Keys the component owns are dropped: class and id (use
// Class / ID), style, data-fui-*, role, aria-label and
// aria-labelledby.
ExtraAttrs html.Attrs
}
EmptyStateConfig configures an empty-state surface.
type Facet ¶ added in v0.12.0
type Facet struct {
// Name is the form field name: it becomes the URL query key. Required.
Name string
// Label is the group's accessible name (the <select> label or the
// pill <fieldset> legend). Required.
Label string
// Options are the choices. Required, at least one.
Options []FacetOption
// Value is the currently-active Option.Value (from the URL). Empty
// selects the "all" choice.
Value string
// Kind picks the render mode. FacetSelect (default) or FacetPills.
Kind FacetKind
// AllLabel overrides the auto-prepended "all / no filter" choice
// (value ""). Defaults to "All <Label>" for selects and "All" for
// pills. Ignored when an Option already declares Value "".
AllLabel string
}
Facet is one filter dimension: a labelled group of mutually-exclusive options (a status filter, a plan filter, …).
type FacetKind ¶ added in v0.12.0
type FacetKind string
FacetKind selects how a facet renders its options.
const ( // FacetSelect renders the facet as a labelled native <select> // (the default: best for many options / long labels). FacetSelect FacetKind = "" // FacetPills renders the facet as a wrapping radio-pill group // (best for a small set of short, glanceable choices). FacetPills FacetKind = "pills" )
type FacetOption ¶ added in v0.12.0
type FacetOption struct {
// Label is the visible option text. Required.
Label string
// Value is the submitted value and the option's stable identifier.
// A Value of "" is the "no filter / all" choice.
Value string
}
FacetOption is one choice within a facet.
type FactBoxConfig ¶
type FactBoxConfig struct {
Label string // required short label
Value string // visible value; mutually exclusive with ValueHTML
// ValueHTML lets the value contain inline markup (code, links).
// If non-empty, takes precedence over Value.
ValueHTML render.HTML
// Style picks the visual hierarchy. Default FactStyleLabelFirst.
Style FactStyle
// FullWidth, when true, marks the box to span the full grid row
// (the consuming grid still controls the column template).
FullWidth bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the fact's root div.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
FactBoxConfig configures one labelled fact.
type FactStyle ¶
type FactStyle string
FactStyle picks the visual hierarchy of a FactBox.
const ( // FactStyleLabelFirst renders the label on top (small, uppercase) // and the value below (body-size). Default. FactStyleLabelFirst FactStyle = "" // FactStyleValueFirst renders the value on top (large display // type) and the label below (small, uppercase). Use for KPI-style // stat bands. FactStyleValueFirst FactStyle = "value-first" )
type FieldErrors ¶
FieldErrors maps form field names to user-visible error messages. It is the same shape returned by [framework.ValidationRegistry.Validate] so server-side validation results round-trip directly into FormField.
Example flow:
errors := registry.Validate(ctx, formData) // framework.ValidationRegistry
page := ui.Form(ui.FormConfig{
Action: "/customers", ID: "customer-form",
Errors: errors,
},
ui.FormFieldFor(errors, "email", ...),
ui.FormFieldFor(errors, "name", ...),
)
type FileDropzoneConfig ¶
type FileDropzoneConfig struct {
// Name is the form-field name (required).
Name string
// Label is the accessible label (required, used as the input's
// aria-label and the visible heading inside the dropzone).
Label string
// Prompt overrides the default "Drop files here or click to
// browse" call-to-action text.
Prompt string
// Accept is the MIME-type filter (e.g. "image/*", ".csv").
Accept string
// Multiple allows selecting multiple files.
Multiple bool
// Required marks the input required.
Required bool
// Disabled disables interaction.
Disabled bool
// ShowPreview opts into a thumbnail strip rendered below the
// dropzone after change. Only works for image MIME types: the
// filedropzone runtime module FileReader-reads each file and
// emits <img>.
ShowPreview bool
// MaxSizeMB is announced in the help text. Server is still
// authoritative.
MaxSizeMB int
// Help renders supporting text under the dropzone.
Help string
// Error overrides Help and switches to error state.
Error string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the dropzone's root div.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and every data-hui-* key — the drop hooks are
// the runtime's contract, not a caller's to forge. A retargeted
// data-hui-drop-input would send every drop on this zone to
// another input.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the prompt,
// the max-size help label and the announcement sentences. When
// nil, English fallbacks apply.
Ctx context.Context
}
FileDropzoneConfig configures a FileDropzone.
type FileUploadConfig ¶
type FileUploadConfig struct {
// Name is the form-field name. Required.
Name string
// Label is the visible label inside the drop zone. Required.
Label string
// ID is the input element's id. Defaults to Name.
ID string
// Accept is the MIME-type filter passed to the native input.
// Example: "image/*", ".pdf,.docx"
Accept string
// Multiple allows selecting multiple files.
Multiple bool
// Required marks the field as required in form submission.
Required bool
// Disabled disables interaction.
Disabled bool
// MaxSizeMB, when > 0, is announced in the hint so users
// understand the constraint. The native input doesn't enforce
// it; server-side validation must.
MaxSizeMB int
// Help renders supporting text inside the drop zone (beside the
// size hint, joined with " · ").
Help string
// Error overrides Help's described-by slot and switches the field
// to error state: the input is marked aria-invalid and the
// message renders below the zone as a role="alert" paragraph the
// input's aria-describedby names.
Error string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the component's root
// element. Keys the component owns are dropped: class (use
// Class), id, and data-fui-*.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the zone's
// drop sentence and the announcement sentences. When nil, English
// fallbacks apply.
Ctx context.Context
}
FileUploadConfig configures a file upload.
type FilterChip ¶
type FilterChip struct {
// Label is the visible chip text. Required.
Label string
// DismissPath is the POST endpoint that removes this filter on
// click of the × button. Required.
DismissPath string
// DismissBody is an optional static JSON body sent with the
// dismiss request (data-fui-rpc-body). When empty, the server
// is expected to deduce the filter from DismissPath alone.
DismissBody string
// Variant maps to StatusVariant: defaults to neutral. Use to
// surface filter kind (info chips for tags, success for "active"
// status filters, etc).
Variant StatusVariant
}
FilterChip is one active filter.
type FilterChipBarConfig ¶
type FilterChipBarConfig struct {
// Filters is the active filter set. Empty renders an empty
// (but valid) toolbar.
Filters []FilterChip
// ClearAllPath, when non-empty, renders a trailing "Clear all"
// button that POSTs here.
ClearAllPath string
// ClearAllLabel overrides the trailing button's text.
// Default "Clear all".
ClearAllLabel string
// Label is the aria-label on the toolbar.
// Default "Active filters".
Label string
// RPCSignal, when set, is broadcast on every chip dismiss AND
// on Clear all, so the bar swaps itself with the server's
// re-rendered HTML.
RPCSignal string
// SignalName, when set, is also placed on the wrapper as
// data-fui-signal so the runtime can swap the entire bar from
// the RPC response. Pair with data-fui-signal-mode="html" on
// the parent container.
SignalName string
// Ctx carries the per-request context used to resolve i18n labels
// (Clear all / "Remove filter <label>"). When nil, English fallbacks.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the toolbar's root div.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, role, and aria-label (use Label).
ExtraAttrs html.Attrs
}
FilterChipBarConfig configures the bar.
type FilterSearch ¶ added in v0.12.0
type FilterSearch struct {
// Name is the form field name (the URL query key). Required.
Name string
// Value is the current query text (from the URL).
Value string
// Placeholder overrides the default "Search…".
Placeholder string
// Label overrides the accessible name (default "Search").
Label string
}
FilterSearch configures the toolbar's optional search field.
type FilterToolbarConfig ¶ added in v0.12.0
type FilterToolbarConfig struct {
// Action is the list route the form GETs to. Required.
Action string
// Facets are the filter dimensions, rendered left-to-right and
// wrapping as width shrinks.
Facets []Facet
// Search, when non-nil, renders a search field.
Search *FilterSearch
// Sort, when non-empty, renders a labelled sort <select>.
Sort []SortOption
// SortName is the sort field's form name. Default "sort".
SortName string
// SortValue is the currently-selected sort Value (from the URL).
SortValue string
// SortLabel overrides the sort control's label. Default "Sort by".
SortLabel string
// ApplyLabel overrides the submit button text. Default "Apply".
ApplyLabel string
// ResetLabel overrides the reset link text. Default "Reset".
ResetLabel string
// HideReset suppresses the Reset link (e.g. when the caller renders
// an active-filter chip bar with its own "Clear all").
HideReset bool
// Compact keeps search and actions on one row in narrow record lists.
// Below 18rem the controls still stack so none are clipped.
Compact bool
// Label is the toolbar's accessible name (search landmark
// aria-label). Default "Filters".
Label string
// Ctx carries the per-request context used to resolve i18n labels
// (Filters / Apply / Reset / Sort by / "All <label>" / Search…).
// When nil, English fallbacks are returned.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the toolbar's root <form>.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and the form contract (method, action, role,
// aria-label) — the sanitized Action is never overridable.
ExtraAttrs html.Attrs
}
FilterToolbarConfig configures a FilterToolbar.
type FormConfig ¶
type FormConfig struct {
// Action is the form's action URL. Required. An action the anchor
// policy refuses is a panic at render, not a silent "#" — a form
// pointed at a dangerous URL is worse than a no-op, and a dead
// one is found where it was made.
Action string
// Method is "POST" (default) or "GET". This is the NATIVE method,
// what a scriptless browser submits; the request seam's method
// (see ExtraAttrs) is independent of it.
Method string
// Errors is an optional set of field-level errors. When non-empty
// the form renders a ValidationSummary above its fields, marked so
// the headless behaviour module moves focus to the summary after a
// failed submit — which requires ID (the summary's id is derived
// from it), and the per-field wiring reaches FormFieldFor'd fields
// automatically.
Errors FieldErrors
// Summary is a sentence that belongs to no one field (a general
// failure, a credentials mismatch). It renders as a text row in
// the validation summary, after the field errors. Empty means
// nothing when Errors is empty, and the framework default
// ("Please fix the highlighted fields and try again.") when
// Errors is not.
Summary string
// FieldLabels, FieldIDs and FieldOrder are passed to the
// ValidationSummary: FieldIDs maps a field name to its control's
// id (a link to #email misses a control whose id is f_email —
// an error whose field has no known id renders as text, not as an
// anchor to nothing), FieldLabels supplies each link's label, and
// FieldOrder fixes the row order.
FieldLabels map[string]string
FieldIDs map[string]string
FieldOrder []string
// SubmitLabel is the visible submit button label. Defaults to "Save".
SubmitLabel string
// HideSubmit omits the submit button entirely when true.
// Use when the caller renders its own submit button.
HideSubmit bool
// SubmitFullWidth stacks the actions row into a single full-width
// column and stretches the submit button to the form's width. Use
// for mobile-first auth and wizard forms where the primary action
// should be a thumb target spanning the card.
SubmitFullWidth bool
// NoValidate turns off the browser's own validation bubbles, for a
// form that validates on the server and reports through Errors.
NoValidate bool
// Ctx, when non-nil, lets Form auto-stamp the hidden CSRF input
// (the framework's "_csrf" field) on unsafe-method submits. It
// reads middleware.TokenFromContext(Ctx), i.e. the token the CSRF
// middleware stashes on every request, so callers do not have to
// remember `render.HTML(csrfInput(ctx))` as the first child of
// every form. Nil-safe: a form rendered without Ctx omits the
// hidden input (matches pre-v3 behavior so existing tests and
// non-CSRF flows like Method:"GET" stay correct).
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes to the <form>
// element. Every data-fui-* and data-action-* key is runtime
// wiring and goes through the typed request seam (attach island
// wiring with interactive.Post(...).OnSuccess(...).Attrs() —
// headless.FormProps.Request admits exactly that vocabulary and
// panics on any wiring key outside it, where the old carrier
// contract silently rendered a plain form that posts natively).
// Everything else is decoration and passes through.
ExtraAttrs html.Attrs
}
FormConfig wraps a server-rendered <form>.
type FormFieldConfig ¶
type FormFieldConfig struct {
Label string // required → <label>
For string // required → <label for=…> matches the control ID
Help string // optional helper text under the field
Error string // optional error message; non-empty marks the control invalid
Required bool // marks the label and the control
// Input BUILDS the control from the wiring the field hands it:
// the id the label points at, the described-by chain, the invalid
// state and the required flag. It is a builder rather than a
// pre-built value because the wiring has to reach the control, and
// a pre-built control is how a hint ends up rendered, given an id,
// and never referenced — visible on screen and absent to a screen
// reader. Build the control with ui.Control (any input type), a
// typed field, ui.PasswordInput (its Field field), or headless
// directly; a closure that ignores its FieldControl compiles and
// loses the wiring, which is the one way left to get this wrong.
Input func(headless.FieldControl) render.HTML
// ReserveError keeps an empty error paragraph rendered — wired
// into the control's aria-describedby and found by the id that
// rides it — for a script that fills it without
// re-rendering (see headless.FieldProps.ReserveError). The caller
// that fills it must also set aria-invalid on the control; the
// server-rendered path should pass Error instead.
ReserveError bool
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the field row's root <div>. Keys the
// component owns are dropped: class and id (use Class) and
// data-fui-*.
ExtraAttrs html.Attrs
}
FormFieldConfig configures a single form field row.
type FormRepeaterConfig ¶
type FormRepeaterConfig struct {
// Name is the repeater group name (used as prefix for field
// indexing). Required.
Name string
// Items is the current list of rendered item groups.
// Each item is a slice of render.HTML representing one row's fields.
Items [][]render.HTML
// MinItems prevents removal below this count. Default 0.
MinItems int
// MaxItems prevents addition above this count. Default 0 = unlimited.
MaxItems int
// AddLabel is the "Add" button text. Default "Add item".
AddLabel string
// RemoveLabel is the "Remove" button text. Default "Remove".
RemoveLabel string
Class string
// ExtraAttrs forwards additional attributes to the repeater's
// root div. Keys the component owns are dropped: class and id
// (use Class), data-fui-*, aria-label, and aria-live.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve i18n labels
// (Add / Remove). When nil, English fallbacks apply.
Ctx context.Context
}
FormRepeaterConfig configures a dynamic repeating field group.
type FormSectionConfig ¶
type FormSectionConfig struct {
Heading string // optional
Description string // optional
Class string
// ID names the group and roots the description's id (<ID>-desc).
// Without one the id is derived from Heading, so two sections
// with one heading and a description on a page would share it:
// give the second an ID.
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the group's root element, whichever shape
// it takes (<div> without a Heading, <fieldset> with one). Keys
// the component owns are dropped: class and id (use Class) and
// data-fui-*.
ExtraAttrs html.Attrs
}
FormSectionConfig groups related fields under a heading + description.
type GalleryCaptionMode ¶
type GalleryCaptionMode string
GalleryCaptionMode picks where captions render.
const ( GalleryCaptionBelow GalleryCaptionMode = "" // <figcaption> under each thumb GalleryCaptionOverlay GalleryCaptionMode = "overlay" // gradient + text over the bottom of each thumb on hover/focus GalleryCaptionOff GalleryCaptionMode = "off" // no caption )
type GalleryConfig ¶
type GalleryConfig struct {
// Variant picks the surface layout.
Variant GalleryVariant
// Items are the entries (≥1).
Items []GalleryItem
// Label is the accessible label for the gallery list. Defaults
// to "Image gallery".
Label string
// Columns (Grid mode): the MAXIMUM number of columns. Default 3.
// The grid is responsive: tracks never shrink below --ui-gallery-min
// (default 9.5rem, overridable per instance via a Class), so narrow
// viewports automatically get fewer columns without media queries.
// Masonry mode: uses this as the maximum column count too.
Columns int
// Gap between thumbs. Default GapMD.
Gap Gap
// Lightbox, when non-empty, is the Name of a paired
// framework/ui.Lightbox. Each item becomes a trigger for that
// lightbox via data-fui-open + data-fui-deeplink.
Lightbox string
// HrefFn, when set, returns a per-item destination URL. Ignored
// when Lightbox is set.
HrefFn func(i int, it GalleryItem) string
// CaptionMode controls caption rendering. Default Below.
CaptionMode GalleryCaptionMode
// ID / Class are passed through to the wrapper.
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the gallery's root <ul>.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and aria-label (use Label).
ExtraAttrs html.Attrs
}
GalleryConfig configures a Gallery.
type GalleryItem ¶
type GalleryItem struct {
// Src is the full-resolution image URL (required).
Src string
// Thumb is the thumbnail URL. Defaults to Src.
Thumb string
// Alt is the accessible image description (required: empty Alt
// is rejected at render time to surface omissions).
Alt string
// Caption is optional descriptive text shown per CaptionMode.
Caption string
// Width / Height for the thumbnail (CLS-safe). Default 200×150.
Width int
Height int
}
GalleryItem is one entry.
type GalleryVariant ¶
type GalleryVariant string
GalleryVariant picks the surface layout.
const ( GalleryGrid GalleryVariant = "" GalleryStrip GalleryVariant = "strip" GalleryMasonry GalleryVariant = "masonry" )
type GlobalSearchConfig ¶
type GlobalSearchConfig struct {
// ID is the input element id (the listbox takes <ID>-listbox).
// Required, page-unique.
ID string
// Name is the form-submit name on the input. Required.
Name string
// Label is the visible label text (required, used as <label for=…>;
// visually hidden by the bar's shape).
Label string
// RPCPath is the search endpoint. Required. POSTed with the query
// in `<Name>=<value>`; the listbox re-renders through the signal.
RPCPath string
// SignalName is the rpc-signal value used to swap the listbox HTML
// after each search response. Required.
SignalName string
// NoScriptAction is the same-origin GET destination the wrapping
// form submits to without script. Required: a reader without
// script must still reach the results page. `#` is refused.
NoScriptAction string
// Placeholder for the input. Default "Search…".
Placeholder string
// Shortcut, when set, opts the input into runtime focus-on-key:
// `data-hui-shortcut-focus="<chord>"` (default "/"). Pass an
// explicit empty string to disable.
Shortcut string
// ShowHint renders a small "Press <chord>" hint chip on the right
// of the input. Default true when Shortcut is set.
ShowHint *bool
// DebounceMs is the input debounce window. Default 200.
DebounceMs int
// Sticky toggles position: sticky on the wrapper. Default true.
Sticky bool
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the search bar's root
// wrapper. Keys the component owns are dropped: class, the
// data-hui-* wiring, and the shortcut chords.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve i18n labels
// (placeholder, the combobox's sentences). When nil, English
// fallbacks apply.
Ctx context.Context
}
GlobalSearchConfig configures a GlobalSearch.
type GridConfig ¶
type GridConfig struct {
// Min is the minimum column width (e.g. "20rem"). The grid uses
// `repeat(auto-fit, minmax(<Min>, 1fr))` so columns wrap at the
// breakpoint implied by the minimum. Defaults to "16rem".
Min string
Gap Gap
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the grid's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), style, data-fui-*, data-hui-* and data-min (use Min).
ExtraAttrs html.Attrs
}
GridConfig configures a CSS grid.
type HeaderInfo ¶
HeaderInfo is the subset of framework/image.VariantHeader that PipelineSourcesFromHeaders consumes. Decoupling from the concrete VariantHeader type lets framework/ui avoid an upward dependency on framework/image. Callers using framework/image can adapt their []VariantHeader with a one-line loop or by writing a typed adapter helper in their own code.
Note: Format from VariantHeader is intentionally omitted. MIME is the discriminator the <source type="..."> attribute actually needs, and a parallel `Format string` field would drift in type vs VariantHeader.Format (image.Format enum).
type HeroConfig ¶ added in v0.7.0
type HeroConfig struct {
// Eyebrow is an optional short kicker rendered as an accent pill above
// the title (e.g. "Billing & revenue").
Eyebrow string
// Title is the display headline (rendered as the page <h1>).
Title string
// Subtitle is the supporting lede under the title.
Subtitle string
// Actions are the call-to-action elements (usually ui.LinkButton),
// laid out in a wrapping row beneath the lede.
Actions []render.HTML
// Media is an optional visual rendered beside the copy. When set, the
// hero becomes a two-column split; when empty it's a single column.
Media render.HTML
// AriaLabel names the hero <section>. Defaults to the Title.
AriaLabel string
// Class is appended to the ui-hero wrapper.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the hero's root <section>.
// Keys the component owns are dropped: class and id (use Class),
// data-fui-*, and aria-label (use AriaLabel).
ExtraAttrs html.Attrs
}
HeroConfig configures a Hero.
type HeroSplitConfig ¶
type HeroSplitConfig struct {
// Copy is the left column body (title, lede, CTAs).
Copy render.HTML
// Media is the right column body (code, image, stats).
Media render.HTML
// Ratio picks the column split. Defaults to HeroSplitEqual.
Ratio HeroSplitRatio
// AriaLabel labels the <section> for screen readers (the hero is
// almost always the page-opening landmark). Required unless an
// h1 inside Copy provides the accessible name.
AriaLabel string
// Class is appended to the ui-hero-split wrapper.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the hero's root <section>.
// Keys the component owns are dropped: class and id (use Class),
// data-fui-*, and aria-label (use AriaLabel).
ExtraAttrs html.Attrs
}
HeroSplitConfig configures a HeroSplit. Copy and Media are both slots. The framework does not assume their contents. Pair with ui.Container if you want a max-width wrapper around the hero.
type HeroSplitRatio ¶
type HeroSplitRatio string
HeroSplitRatio picks the column ratio. The three values cover the shapes that actually show up. Pages that want something else should write a one-off and not abuse the enum.
const ( // HeroSplitEqual is 1:1, balanced two-column hero. HeroSplitEqual HeroSplitRatio = "" // HeroSplitCopyWide gives the copy column more room (1.4:1). // Use when the right slot is a compact stat band or icon grid. HeroSplitCopyWide HeroSplitRatio = "copy" // HeroSplitMediaWide gives the media column more room (1:1.2). // Use when the right slot is a code block, screenshot, or video. HeroSplitMediaWide HeroSplitRatio = "media" )
type IconConfig ¶
type IconConfig struct {
// Size sets the rendered width/height. Accepts any CSS length
// (e.g. "20", "1.25rem"). Default: "20".
Size string
// AriaLabel makes the icon meaningful to assistive tech. When set,
// the SVG renders with role="img" and aria-label="<AriaLabel>";
// without it, the icon is aria-hidden="true" (decorative).
AriaLabel string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the icon's root <svg>
// element. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-*, and the drawing / accessibility
// keys the component derives (xmlns, width, height, viewBox,
// fill, stroke*, role, aria-label, aria-hidden).
ExtraAttrs html.Attrs
}
IconConfig configures an icon render.
type ImageAspect ¶
type ImageAspect string
ImageAspect selects a CSS aspect-ratio class. Predefined buckets avoid inline styles (CSP-clean).
const ( ImageAspectAuto ImageAspect = "" ImageAspectSquare ImageAspect = "1-1" ImageAspect4x3 ImageAspect = "4-3" ImageAspect16x9 ImageAspect = "16-9" ImageAspect21x9 ImageAspect = "21-9" ImageAspect3x4 ImageAspect = "3-4" )
type ImageSource ¶
type ImageSource struct {
URL string // image URL: required
Width int // intrinsic pixel width: required (becomes "<url> <width>w")
}
ImageSource represents a single entry in an image's responsive source set.
type InputGroupConfig ¶
type InputGroupConfig struct {
// Prepend is optional content rendered before the input (text, icon, etc.).
Prepend render.HTML
// Input is the actual input element (required). Inside a
// FormField builder, build it from the wiring the field handed
// the closure — ui.Control, a typed control, or headless directly
// — so the id and the description chain arrive with it.
Input render.HTML
// Append is optional content rendered after the input.
Append render.HTML
// Class adds extra CSS classes to the wrapper.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the group's root wrapper
// div. Keys the component owns are dropped: class and id (use
// Class) and data-fui-*.
ExtraAttrs html.Attrs
}
InputGroupConfig configures an InputGroup.
type JSONViewerConfig ¶
type JSONViewerConfig struct {
// Value is the data to render (required).
Value any
// OpenDepth is the recursion depth that renders open by default.
// 0 means just the root is open; -1 means everything is open.
OpenDepth int
// MaxStringLen truncates long strings with "…". 0 = no limit.
MaxStringLen int
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the viewer's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
JSONViewerConfig configures a JSONViewer.
type LightboxConfig ¶
type LightboxConfig struct {
// Name is the unique widget name (required) used as the
// preset.Modal name. Page-unique. Any element with
// data-fui-open="<this Name>" opens the overlay.
Name string
// Label is the accessible name for the open modal. Defaults to
// "Image viewer" (i18nui.KeyLightboxLabel through the strings
// bridge).
Label string
// ArrowLeft/Right keyboard nav over siblings sharing the same
// data-fui-lightbox-group attribute.
NavArrows bool
// ShowCaption adds a <figcaption> bound to the "caption" signal.
// Triggers pass caption=<text> in their data-fui-deeplink.
ShowCaption bool
// AllowDownload renders a visible "Download" anchor inside the
// modal whose href is bound to the current src signal.
AllowDownload bool
// Pages, when non-empty, scopes the modal mount to those routes.
Pages []string
// Ctx carries the per-request context used to resolve i18n strings
// (the viewer label, Prev/Next nav and Download aria-labels) through
// the strings bridge. When nil, context.Background() is used and
// English fallbacks are returned, preserving today's behaviour.
Ctx context.Context
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) onto the lightbox's own root
// (the fui-lightbox viewer panel; the modal chrome is widget
// machinery, and triggers are caller-owned elements). Keys the
// component owns are dropped: class, id, data-fui-* (the viewer and
// nav wiring) and data-hui-* (the headless anatomy's hooks).
ExtraAttrs html.Attrs
}
LightboxConfig configures a Lightbox.
type LineChartConfig ¶
type LineChartConfig struct {
// Series are the lines (≥1, each with ≥2 Values).
Series []LineSeries
// Labels are optional x-axis tick labels. When non-empty, must
// match the length of the longest series.
Labels []string
// Width / Height in CSS pixels. Default 360×200.
Width int
Height int
// ShowLegend renders a small legend strip below the chart.
ShowLegend bool
// LabelledBy is the id of an element naming the chart for AT.
LabelledBy string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the chart's root <svg>
// element, or to the shared zero-data placeholder when there is
// nothing to draw. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-*, and the geometry / accessibility
// keys the chart derives (width, height, viewBox, xmlns, role,
// aria-labelledby, aria-hidden).
ExtraAttrs html.Attrs
}
LineChartConfig configures a LineChart.
type LineRange ¶ added in v0.85.0
LineRange is a 1-based, inclusive range of source lines. To == 0 means a single line (From only).
func ParseLineRanges ¶ added in v0.85.0
ParseLineRanges parses a comma-separated list of 1-based line numbers and ascending inclusive ranges ("2", "1,3-5"), the form the highlight fence option accepts. An empty spec parses to no ranges. Anything that is not a positive line number or an ascending range is an error; callers that degrade instead of failing (ui.Markdown) drop the option.
type LineSeries ¶
type LineSeries struct {
// Name is the legend label (required).
Name string
// Values are the y-values in order.
Values []float64
// Color overrides the default palette pick. Optional palette key
// or raw CSS color.
Color string
// Area, when true, fills under the line.
Area bool
}
LineSeries is one series.
type LinkButtonConfig ¶
type LinkButtonConfig struct {
Label string // required visible text
Href string // required navigation target
Variant ButtonVariant // defaults to ButtonPrimary
Size ButtonSize // defaults to ButtonSizeDefault
// External, when true, opens the link in a new tab with
// rel="noopener noreferrer". Use for off-site links (docs to
// GitHub, pkg.go.dev, etc.). The runtime's SPA-nav interceptor
// naturally skips http(s):// hrefs (they're not "internal"), so
// External does not also need to "suppress SPA nav": the
// underlying SPA router already does the right thing.
External bool
// Icon, when set, renders the named registered icon (see
// RegisterIcon / Icon) before the label. The button's inline-flex
// gap handles spacing. Unknown names render the label alone.
Icon string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the rendered <a>. The
// four data-fui-* keys that make sense on a link (push-state,
// prefetch, open, deeplink) go through the typed Action seam;
// every other data-fui-* key is refused, as it always was — a
// link navigates, a button acts. Keys the component owns are
// dropped: class and id (use Class / ID) and href (use Href).
// With External, target and rel are owned too; without it a caller
// may still set them.
ExtraAttrs html.Attrs
}
LinkButtonConfig configures a button-styled <a> link. Use this when the affordance navigates (changes URL): CTAs like "Get started", "Read the docs". For in-page actions that don't change URL, use Button instead.
type LinkConfig ¶
type LinkConfig struct {
Href string // required
Text string // required visible text
Variant LinkVariant
Class string
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the rendered <a>. Link is
// a wiring carrier: data-fui-* passes through, which is how a
// progressive-enhancement link ships an href fallback plus a
// data-fui-rpc upgrade (uinoderender's ActionRef links). Keys the
// component owns are dropped: class and id (use Class / ID) and
// href (use Href). on* event handlers and values with control
// bytes are also scrubbed (see scrubAttrs).
ExtraAttrs html.Attrs
}
LinkConfig configures a Link.
type LinkVariant ¶
type LinkVariant string
LinkVariant chooses the visual treatment of a Link.
const ( // LinkInline is a normal in-flow text link: primary-colored, hover // underline, no min-height. Use this for links in prose. LinkInline LinkVariant = "" // LinkAction is a row-action / list-item link: 44×44 tap target // (WCAG 2.5.5) and inline-flex centering. Use this when the link // sits in a table row, list, or toolbar alongside Button siblings. LinkAction LinkVariant = "action" // LinkMuted is a subdued text-muted link, for "see all", "view // details" affordances that should not compete with primary CTAs. LinkMuted LinkVariant = "muted" )
type ListDetailConfig ¶ added in v0.86.0
type ListDetailConfig struct {
// List is kept chrome in a group layout, not a per-route outlet.
List render.HTML
// ListLabel labels the independently scrolling list. Required.
ListLabel string
// Detail is the group's primary slot, replaced on detail navigation.
Detail render.HTML
// MobileSinglePane shows either list or detail on phones instead of
// stacking them. Render ListDetailPlaceholder for the index screen.
MobileSinglePane bool
// BackHref adds a link back to the list at the top of the detail
// pane. It shows only while the detail pane is alone: a phone, with
// a selected detail (not ListDetailPlaceholder). It sits outside
// Detail, so it survives detail navigation. Requires MobileSinglePane.
BackHref string
// BackLabel is the back link's text. Default "Back".
BackLabel string
// ExtraAttrs forwards safe data-* and ARIA attributes to the root.
// LayoutTree.VTRegion's two transition attributes are also accepted.
ExtraAttrs html.Attrs
}
ListDetailConfig configures the two panes of a ListDetail.
type MarkdownConfig ¶
type MarkdownConfig struct {
// Source is the raw markdown text (required).
Source string
// Compact tightens spacing, useful for inline previews where
// hero-page paragraph rhythm would feel wrong.
Compact bool
// Measure caps the line length at a reading width
// (--ui-markdown-measure, 72ch) for long-form pages: about, terms,
// an explanatory paragraph in a wide page column.
Measure bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the prose container's
// root <div>. Keys the component owns are dropped: class and id
// (use Class / ID) and data-fui-*.
ExtraAttrs html.Attrs
}
MarkdownConfig configures a Markdown renderer.
type MenuAction ¶ added in v0.79.0
type MenuAction struct {
// Path is the form's action URL.
Path string
// Method defaults to POST. GET is allowed for completeness but
// defeats the point; prefer Href for navigations.
Method string
// Fields are the hidden inputs, first use: the CSRF token.
Fields map[string]string
// Unsafe acknowledges the no-Fields case deliberately.
Unsafe bool
}
MenuAction is MenuItem's form-POST row. The menuitem is a submit button inside <form method action>; Fields supplies the hidden inputs.
CSRF contract: the framework never mints or verifies tokens — the caller's form middleware owns that exactly as it would for any inline form. But a state-changing POST with NO hidden inputs is almost certainly a forgotten token, so the default refuses it: an Action with no Fields panics unless Unsafe explicitly acknowledges the endpoint carries its own protection (same-origin POST + session checks, a one-shot token in the path, or a reviewed exception like the port's tokenless parity surface). Unsafe is greppable debt, not a recommendation.
type MenuConfig ¶
type MenuConfig struct {
// ID becomes the dropdown's stable identifier. Used to pair the
// trigger with the panel for aria-controls + analytics. Optional
// auto-generated when empty.
ID string
// Label is the trigger's visible text. Mutually exclusive with
// TriggerHTML.
Label string
// TriggerHTML overrides Label with custom inline HTML. Use for
// avatar buttons, icon-only triggers, etc.
TriggerHTML render.HTML
// TriggerElement replaces the framework-rendered summary with a
// caller-owned interactive element: inline HTML for a real <button>
// (or <a>). The menu renders a summary-less disclosure holding the
// panel, with the element in a presentation wrapper beside it, and
// the runtime makes the element the disclosure controller: click,
// Enter, and Space toggle the panel; aria-haspopup /
// aria-controls / aria-expanded are wired onto the element at
// hydration (attributes cannot be injected into raw caller HTML
// server-side); focus lands on the first menuitem on open; Escape
// closes one level at a time and returns focus to the element; Tab
// closes the chain. Use for host-styled triggers whose markup and
// classes the page owns: routing such an element through
// TriggerHTML nests an interactive control inside the summary
// control, which axe reports as nested-interactive (SERIOUS).
// Activation is preventDefaulted — the element opens the menu, it
// does not navigate or submit; put navigation on menu items.
// Overrides Label and TriggerHTML. Auto-generated IDs fold the
// markup in, but two structurally identical trigger menus on one
// page still need distinct IDs.
TriggerElement render.HTML
// Items is the menu's contents. Required (empty menus panic at
// render time. They signal a bug, not a runtime state).
Items []MenuItem
// Position anchors the panel relative to the trigger.
Position MenuPosition
// LazyPanel keeps the panel's rows out of the document tree until
// the menu is first opened: SSR wraps them in an inert
// <template data-hui-menu-lazy> as the panel's only child, and the
// menu module moves them into the panel on first open (the panel
// <div> itself always renders, so aria-controls still resolves
// while closed). Use it when page-scoped consumers must not see
// closed-menu rows in the live DOM: host test contracts that pin
// getByText('Theme') to a visible element or getByLabel to exactly
// one. The rows are still in the HTML source, so this hides
// nothing from a crawler that parses the response. The cost: rows
// are not in the DOM until first open, so host JS that binds rows
// by id at page load must use delegated listeners instead, and
// with JavaScript disabled the menu opens empty (only the module
// mounts the rows). The zero value (false) renders rows inline
// exactly as before. Applies to the summary path and
// TriggerElement alike; nested submenus live inside the template
// and mount with the rest.
LazyPanel bool
// TriggerClass / PanelClass append to the rendered element class
// lists (rare).
TriggerClass string
PanelClass string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the menu's root element
// (the <details> on the summary path, the wrapper <div> when
// TriggerElement is set). Keys the component owns are dropped:
// class, id, and the disclosure/menu wiring.
ExtraAttrs html.Attrs
}
MenuConfig describes a dropdown menu: a trigger that, when activated, reveals a list of MenuItems with proper roles, keyboard navigation, and theming.
type MenuItem ¶
type MenuItem struct {
// Label is the item's visible text. Required unless Separator.
Label string
// Href turns the item into an <a> link. Mutually exclusive with
// custom action attrs; if both are supplied, Href wins.
Href string
// RPC + RPCMethod wire the item to a server-side handler via
// data-fui-rpc / data-fui-rpc-method. Use for "Delete this row"
// menu items.
RPC, RPCMethod string
// Confirm asks the user to confirm before the RPC fires. Maps to
// data-fui-confirm, which the runtime honors on RPC dispatch and on
// any form submit. A menu item is neither unless it carries RPC, so
// on a plain link item the attribute is inert.
Confirm string
// Icon is rendered to the left of Label. Inline HTML; caller
// supplies an <svg>, character, or render.Text("⚙").
Icon render.HTML
// Variant tints destructive items (red), purely a visual hint;
// the actual confirm step is Confirm above.
Danger bool
// Disabled greys the item out and removes it from keyboard
// navigation.
Disabled bool
// Separator renders a horizontal divider instead of an item.
// Label and other fields are ignored when true.
Separator bool
// ID becomes the rendered row's id attribute, so page JS, test
// suites, or aria wiring elsewhere on the page can address this
// exact item (a Help Mode toggle a script binds to, an Imports
// row a shortcut targets). Uniqueness is caller-owned within one
// menu, like any HTML id: the menu refuses duplicates it can see.
// Ignored on separators, like every other field. Empty emits no
// id, leaving the output identical to a menu that never set it.
ID string
// Radio, when non-empty, renders the row as a radio option:
// role="menuitemradio" plus aria-checked (see Checked) and
// data-hui-menu-radio="<Radio>". Every item sharing the same Radio
// value within one Menu forms a radio group — across submenus too:
// a picker whose rarer options sit behind a "More" submenu is one
// group, not two. Exactly one of them should carry Checked (like
// ID, uniqueness is caller-owned, not enforced here). The runtime's
// menu module arbitrates the group client-side on activation
// (click / Enter / Space): the activated row is checked, its
// same-group siblings — anywhere in the same menu — unchecked, so
// pure-client menus feel like radios without a round trip; a row
// carrying RPC or Href still fires it and the server re-render
// stays authoritative. Mutually exclusive with Children (a radio
// row is a leaf command, a submenu parent is a disclosure) — both
// set panics at render time. Empty renders the plain menuitem, so
// zero-value output is unchanged.
Radio string
// Checked sets aria-checked on a Radio row. Inert without Radio
// (like Confirm without RPC): there is no checked state to render
// on a plain menuitem.
Checked bool
// Action renders the row as a form submission instead of a link or
// RPC, for hosts whose command rows hit PRG endpoints (stop
// impersonation, sign out with server-side sessions) where a plain
// Href would widen a state-changing endpoint to GET. Nil (the zero
// value) renders nothing — Action is a pointer exactly so the
// unconfigured case cannot half-render. See MenuAction for the
// CSRF contract. Mutually exclusive with Href, RPC, Radio, and
// Children: incoherent combos panic at render time.
Action *MenuAction
// Children nests a submenu behind this row: the row renders as a
// <summary role="menuitem" aria-haspopup="menu"> whose activation
// reveals a nested role="menu" panel, reusing the same disclosure
// machinery the top level uses (Escape, SPA-nav close,
// aria-expanded mirroring, focus-on-open). Keyboard: the menu
// module opens it on ArrowRight (ArrowLeft in RTL) and enters,
// closes it on ArrowLeft (ArrowRight in RTL) and ArrowUp-style
// roving focus applies inside it; Escape closes one level at a
// time. The parent row is purely a disclosure: setting Href, RPC,
// or Radio on it panics at render time. Disabled greys the row out
// and removes it from keyboard navigation like any other item; the
// children still render (closed, unreachable) so a server-side
// state change only needs to flip Disabled.
Children []MenuItem
// Class appends to the rendered item's class list (rare; mainly
// for testing or one-off hooks).
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) onto the rendered item
// element. Keys the item owns are dropped: class (use Class),
// id (use ID), the runtime wiring (data-fui-*), and the menuitem
// contract (type, href, tabindex, role, aria-disabled, disabled,
// aria-checked).
ExtraAttrs map[string]string
}
MenuItem is one row in a Menu: either an actionable item (Label required, Href / OnClickAttr / RPC etc. as supplied) or a separator. The framework owns the role attributes; callers only describe semantics.
type MenuPosition ¶
type MenuPosition string
MenuPosition controls which corner of the trigger the menu panel anchors to. Defaults to MenuBottomStart (panel hangs below the trigger, aligned to its inline-start edge).
const ( MenuBottomStart MenuPosition = "bottom-start" MenuBottomEnd MenuPosition = "bottom-end" MenuTopStart MenuPosition = "top-start" MenuTopEnd MenuPosition = "top-end" )
type MetricBandConfig ¶ added in v0.23.0
type MetricBandConfig struct {
Items []MetricBandItem
Label string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the band's root <dl> element. Keys the
// component owns are dropped: class and id (use Class / ID),
// data-fui-*, and aria-label (derived from Label).
ExtraAttrs html.Attrs
}
MetricBandConfig configures a flat band of one to six related signals.
type MetricBandItem ¶ added in v0.23.0
MetricBandItem is one compact label/value signal.
type MultiSelectConfig ¶ added in v0.86.0
type MultiSelectConfig struct {
// Name is the form-field name every checkbox shares. Required.
Name string
// Label is the group's accessible name and the disclosure's
// summary. Required.
Label string
// Placeholder is what the chips strip says when nothing is
// picked. Defaults to "Choose…" through the Strings table.
Placeholder string
// Options are the choices, in order. Required.
Options []MultiSelectOption
// Open renders the disclosure expanded.
Open bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the wrapper. Keys
// the component owns are dropped: class and id (use Class / ID).
ExtraAttrs html.Attrs
// Ctx resolves the Strings table through the request's translator.
Ctx context.Context
}
MultiSelectConfig configures one multiselect.
type MultiSelectOption ¶ added in v0.86.0
type MultiSelectOption = headless.MultiSelectOption
MultiSelectOption is one checkbox option: Value is the form-submit value, Label the visible text, Selected the first-paint state, Disabled the greyed-out unsubmitting state.
type NetworkRetryBannerConfig ¶
type NetworkRetryBannerConfig struct {
// HealthEndpoint is the URL the Retry button pings to test
// connectivity. Must return 2xx when the server is healthy.
// Required.
HealthEndpoint string
// Title is the banner heading. Default "Connection lost".
Title string
// Description is the body text. Default explains the recovery
// action.
Description string
// RetryLabel is the retry button text. Default "Retry now".
RetryLabel string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the banner's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, role, aria-live, and hidden (the runtime
// un-hides the banner when connectivity degrades).
ExtraAttrs html.Attrs
}
NetworkRetryBannerConfig configures the banner.
type NotificationBellConfig ¶
type NotificationBellConfig struct {
// Name is the unique widget name (required) used for the paired
// preset.Popover. Keep page-unique.
Name string
// Href is where the trigger goes without script: the
// notifications page, same-origin. Required — a bell that rings
// to nowhere is a dead link on the no-script page, and "#" is
// not a destination.
Href string
// Label is the accessible label on the bell button (required,
// e.g. "Notifications").
Label string
// UnreadCount renders as a badge on the bell. Hidden when 0
// (unless SignalUnread is set, then the badge always renders
// and the signal drives its visibility / text).
UnreadCount int
// Items are the entries rendered inside the popover. ≥1 recommended;
// 0 renders the EmptyText placeholder.
Items []NotificationItem
// EmptyText is shown when Items is empty. Default
// "No new notifications".
EmptyText string
// SignalUnread, when non-empty, binds the badge text to that
// signal name so live updates can swap the count without a page
// reload. The badge always renders when this is set (signal value
// "" hides it via the empty-state CSS rule).
SignalUnread string
// SignalList, when non-empty, binds the popover list HTML to that
// signal so live updates can swap the list. Items above seed the
// SSR initial render.
SignalList string
// Pages, when non-empty, scopes the popover mount to those routes.
Pages []string
// Ctx carries the per-request context used to resolve the
// empty-state text. When nil, English fallbacks apply.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the bell's root <button>.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-* (the popover wiring), type, aria-label (use
// Label), and aria-describedby (the unread-count announcement).
ExtraAttrs html.Attrs
}
NotificationBellConfig configures a NotificationBell.
type NotificationConfig ¶
type NotificationConfig struct {
// Title is the prominent first line. Required.
Title string
// Body is optional supporting text below the title.
Body string
// Variant colors the leading icon and accent rail. Defaults to Info.
Variant StatusVariant
// DismissHref optionally adds a × link with this href. Pair with a
// server-side handler that removes the notification from session
// state. Empty omits the dismiss control.
DismissHref string
// DismissLabel overrides the dismiss link's accessible label.
// Defaults to "Dismiss notification".
DismissLabel string
// Position pins the notification to a screen corner via fixed
// positioning. Defaults to NotificationInline (in document flow).
Position NotificationPosition
// Island is where the dismiss goes with script: a dismissing
// toast changes the stack, which is an in-page state change and
// needs the endpoint that renders the region again. Required by
// the primitive when DismissHref is set; without script the same
// link navigates to DismissHref.
Island headless.Island
// Ctx carries the per-request context used to resolve the
// dismiss-label string. When nil, English fallbacks apply.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the notification's root
// element. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-*, role, and aria-live.
ExtraAttrs html.Attrs
}
Notification is the styled content for an ephemeral toast. Drop it inside a core-ui/widget/preset.Toast surface (or any container) to render a status pill with optional icon, title, body, and a dismiss link.
Notification is intentionally stateless: auto-dismiss timing is the host's responsibility. The dismiss link can target a URL that the server uses to remove the notification from session state, then a signal-driven re-render swaps it out.
type NotificationItem ¶
type NotificationItem struct {
// Title is the headline (required, e.g. "Build #4821 failed").
Title string
// Body is optional supporting text.
Body string
// Time is an optional right-aligned timestamp string ("2m ago").
Time string
// Href, when set, makes the entire row a link.
Href string
// Unread marks the row with a left-edge primary stripe.
Unread bool
}
NotificationItem is one entry in the bell dropdown.
type NotificationPosition ¶
type NotificationPosition string
NotificationPosition controls where a Notification renders.
const ( // NotificationInline (default) renders in document flow. Hosts // position a stack themselves. NotificationInline NotificationPosition = "" NotificationTopRight NotificationPosition = "top-right" NotificationTopLeft NotificationPosition = "top-left" NotificationBottomRight NotificationPosition = "bottom-right" NotificationBottomLeft NotificationPosition = "bottom-left" )
type NumberFieldConfig ¶ added in v0.41.0
type NumberFieldConfig struct {
Name string
Label string
ID string
Value string
Placeholder string
Help string
Error string
Class string
Required bool
Disabled bool
Min *float64
Max *float64
Step *float64
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) onto the field's <input>. Keys the input owns
// are dropped: class and id (use ID), data-fui-*, type, name,
// value, placeholder, min, max, step, required, disabled,
// aria-invalid, and aria-describedby.
ExtraAttrs html.Attrs
}
NumberFieldConfig configures a labelled native number field. Pointer bounds distinguish an explicit zero from an omitted constraint.
type NumberInputConfig ¶
type NumberInputConfig struct {
// Name is the form-field name (required).
Name string
// Label is the accessible label (required, used as <label for=…>).
Label string
// Min / Max bound the value. When both 0, no client-side bound is
// applied (server is still authoritative). When either is set, Min
// is a real floor even at 0 (Max: 10 means 0..10); a caller that
// allows negatives sets Min explicitly. Max is emitted only when
// non-zero, so Min: 1 alone never fabricates an empty 1..0 range.
Min int
Max int
// Step is the +/- button granularity. Default 1.
Step int
// Value is the initial value.
Value int
// Disabled disables interaction.
Disabled bool
// Required marks the field required.
Required bool
// Help renders supporting text under the field.
Help string
// Error overrides Help with an error message.
Error string
ID string
Class string
// ExtraAttrs forwards additional attributes to the root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and every data-hui-* hook.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the Decrement
// and Increment aria labels. When nil, English fallbacks apply.
Ctx context.Context
}
NumberInputConfig configures a NumberInput.
type OptimisticActionConfig ¶
type OptimisticActionConfig struct {
// Endpoint is the URL the click fires against. Required.
Endpoint string
// Method is "POST" (default), "DELETE", "PATCH", or "PUT".
Method string
// IdleLabel is the button text in the rest state. Required.
IdleLabel string
// SuccessLabel is shown immediately on click (the optimistic
// flip). Required.
SuccessLabel string
// IdleIcon optionally renders alongside IdleLabel.
IdleIcon render.HTML
// SuccessIcon optionally renders alongside SuccessLabel. Common
// usage: a small check or filled-heart SVG.
SuccessIcon render.HTML
// Variant maps to the standard Button variant ("primary"/""
// default, "secondary", "danger", "ghost").
Variant ButtonVariant
// Size maps to the standard Button size ("" default, "small",
// "large").
Size ButtonSize
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the button's root
// element. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-* (endpoint and method wiring),
// type, and data-state — the optimistic lifecycle contract.
ExtraAttrs html.Attrs
// FailedText is what the status span announces when the server
// refuses. Empty takes the Strings default.
FailedText string
// Ctx carries the per-request context used to resolve the
// failure sentence. When nil, English fallbacks apply.
Ctx context.Context
}
OptimisticActionConfig configures an OptimisticAction button.
type OptimizedImageConfig ¶
type OptimizedImageConfig struct {
Src string // fallback / single-resolution URL (required)
Alt string // alt text: required for non-decorative images
// Width and Height are the intrinsic pixel dimensions of the
// fallback Src. Setting them is mandatory to reserve layout space
// and avoid Cumulative Layout Shift on first paint.
Width int
Height int
// Sources, when set, render alongside Src in a <picture> via
// srcset="<url> <width>w, …". The browser picks the best size for
// the viewport.
Sources []ImageSource
// Sizes is the CSS sizes attribute for the responsive source set.
// Defaults to "100vw" when Sources is non-empty.
Sizes string
// Eager flips loading="lazy" → loading="eager". Use for
// above-the-fold hero images.
Eager bool
// HighPriority sets fetchpriority="high" (above-the-fold critical
// imagery). Mutually exclusive with Eager=false; setting both
// keeps both behaviors.
HighPriority bool
// Fit selects the object-fit treatment (default cover).
Fit ImageFit
// Aspect locks the aspect ratio via a CSS class (CSP-clean,
// no inline style). Setting Width + Height already establishes
// the intrinsic ratio; Aspect is for forced ratios distinct from
// the source.
Aspect ImageAspect
// Rounded toggles a token-driven border-radius treatment.
Rounded bool
// Placeholder, when set to an inline raster data: URI, renders a
// low-fidelity image behind this one so something content-shaped is
// visible before the real pixels arrive.
//
// Produce one with framework/image: BlurHashDataURL(hash, …) to render
// a stored BlurHash, or Image.Placeholder() to build an LQIP straight
// from the source. A bare BlurHash string is not accepted: it is not
// an image until it is decoded.
//
// Values that are not usable inline images (a raw hash, a remote URL,
// a non-raster data: URI) are dropped and the image renders without a
// placeholder. See placeholderImage for why that degrades instead of
// panicking.
Placeholder string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the image's root wrapper
// (the outer <span>, in both the single-source and <picture>
// shapes). Keys the component owns are dropped: class and id
// (use Class / ID) and data-fui-*.
ExtraAttrs html.Attrs
}
OptimizedImageConfig configures a responsive, lazy-loaded image.
type PageHeaderConfig ¶
type PageHeaderConfig struct {
Title string // required
Subtitle string // optional supporting text below the title
Eyebrow string // optional small label above the title (e.g. "Customers")
Actions render.HTML // optional trailing action slot (button row, link)
Badge render.HTML // optional status beside the title; wraps below when needed
// HeadingLevel overrides the title's heading level (default 1). Set to
// 2 when the header is a sub-section of a page that already has an <h1>
// (e.g. a related-list block on a detail page) so the outline doesn't
// produce a second <h1> or skip levels.
HeadingLevel int
Class string
ID string
// Compact removes the divider and outer padding for pane and article titles.
Compact bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the header's root <header>
// element. Keys the component owns are dropped: class and id
// (use Class / ID), style, data-fui-* and role.
ExtraAttrs html.Attrs
}
PageHeaderConfig configures a page-top header.
type PaginationConfig ¶ added in v0.86.0
type PaginationConfig struct {
// Page is the current page, 1-based. Must be within 1..Pages.
Page int
// Pages is the total number of pages. At least 1.
Pages int
// Path is the screen's own path: each page href is it plus the
// carried query, the page parameter replaced. Empty means the
// current document — a relative "?query" href.
Path string
// Query is the request state the page anchors carry unchanged:
// the search, the filters, the sort — anything a page turn must
// not drop. The primitive replaces PageParam in it rather than
// appending duplicate pairs.
Query url.Values
// PageParam names the page query parameter. Empty defaults to "p".
PageParam string
// Window is the number of pages shown each side of the current
// one, the first and last always shown. Default 1; a Window large
// enough shows every page.
Window int
// OmitPrevNext drops the Previous and Next anchors entirely.
OmitPrevNext bool
// AriaLabel names the nav landmark for AT. Empty resolves to the
// reader's "Pagination" through the i18n keys.
AriaLabel string
// PrevLabel and NextLabel override the end anchors' words, which
// otherwise resolve through the i18n keys.
PrevLabel string
NextLabel string
// Island is optional. A zero value keeps plain page anchors —
// the URL is the truth for a list, and a list screen's pager is
// list state. A set value puts the GET RPC contract on those same
// anchors, for a pager embedded in an island region (a
// DataTable's footer under an island table): the href is still
// the page without script, the region update with it.
Island headless.Island
// Ctx carries the per-request context used to resolve the i18n
// strings (the nav label, the end anchors' words). When nil,
// English fallbacks are returned.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the nav landmark. Keys
// the component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and the data-hui-* hooks.
ExtraAttrs html.Attrs
}
PaginationConfig configures the pager.
type PaletteCommand ¶ added in v0.8.0
type PaletteCommand struct {
Label string // visible text
Href string // route to navigate to on pick (data-fui-push-state)
Meta string // optional muted secondary text (e.g. the route path)
}
PaletteCommand is one entry in a static command-palette list.
type PaneHostConfig ¶ added in v0.19.0
type PaneHostConfig struct {
// Primary is the always-visible main pane. Required: PaneHost
// panics when it is empty (mirrors DataTable's required slots).
Primary render.HTML
// Secondary is the first optional side pane. When empty, no
// secondary pane is rendered.
Secondary render.HTML
// Tertiary is the second optional side pane.
Tertiary render.HTML
// SecondaryOpen / TertiaryOpen set the SSR initial open state so
// the first paint matches server state (Hard Rule 6), e.g. a
// detail route that should render with the pane already shown. A
// closed optional pane renders with hidden; the runtime reveals it
// on open so there is no flash.
SecondaryOpen bool
TertiaryOpen bool
// SecondaryLabel / TertiaryLabel label each side pane's
// role="region" via aria-label. Empty falls back to "Secondary" /
// "Tertiary".
SecondaryLabel string
TertiaryLabel string
// DeepLinkParam opts this host into URL round-tripping, naming the
// query parameter that carries pane state, e.g. "pane" for
// `?pane=secondary:ticket-42`. Opening a pane whose trigger declares
// a key writes that parameter, closing strips it, and Back moves
// between those states. Empty (the default) leaves the URL alone.
//
// Pane open/close remains in-page state, not a route (Hard Rule 1):
// the parameter records which pane is showing so a refresh or a
// shared link reproduces it, exactly as widget deep links do for
// modals. The server still decides first paint. Read the parameter
// with PaneDeepLink and set SecondaryOpen/TertiaryOpen plus the
// pane's content from it. Without that, a shared link renders the
// URL's pane closed and the runtime opens it after hydration.
//
// Triggers declare their key with interactive.PaneKey; a trigger
// with no key opens the pane without touching the URL.
DeepLinkParam string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the host's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-* (the pane-host marker and deep-link wiring).
ExtraAttrs html.Attrs
}
PaneHostConfig configures a PaneHost.
type PasswordInputConfig ¶
type PasswordInputConfig struct {
// Name is the form-field name (required).
Name string
// ID is the input element's id — the id a surrounding label's
// for= points at. Required unless Field carries one.
ID string
// Placeholder renders the native placeholder.
Placeholder string
// Required marks the field required.
Required bool
// Autocomplete sets the autocomplete attribute (e.g. "current-password", "new-password").
Autocomplete string
// Class adds extra CSS classes to the shell.
Class string
// ExtraAttrs forwards additional attributes to the shell's root
// element — the same contract every component's ExtraAttrs
// carries (data-* test hooks, analytics markers). Keys the
// component owns are dropped: class (use Class), id, the input's
// type, name, placeholder, required, autocomplete, aria-invalid
// and aria-describedby (the field's wiring owns them), plus every
// data-fui-* and data-hui-* key — the reveal hooks are the
// runtime's contract, not a caller's to forge. Autocomplete has
// its own field because it belongs to the input that submits.
ExtraAttrs map[string]string
// Ctx carries the per-request context used to resolve the reveal
// button's words (ui.StringsFor: ShowPassword, HidePassword,
// RevealShow, RevealHide). When nil, the English defaults are
// used.
Ctx context.Context
// Field is the wiring an enclosing FormField handed its builder
// (the headless.FieldControl its Input closure received). Applied
// to the inner input — the id the outer label points at, the
// described-by chain, the invalid state and the required flag —
// and it wins over the config's own: two sources for one fact is
// how they drift. Zero value means standalone.
Field headless.FieldControl
}
PasswordInputConfig configures a PasswordInput.
type PieChartConfig ¶
type PieChartConfig struct {
// Slices are the entries (≥1 with non-zero Value).
Slices []PieSlice
// Size is the SVG square side in CSS pixels. Default 160.
Size int
// InnerRadius (0–1, fraction of outer radius) cuts the center
// out, turning it into a donut. Default 0 (pie).
InnerRadius float64
// CenterLabel renders a label in the middle of the donut hole.
// Ignored when InnerRadius=0.
CenterLabel string
// CenterSubtext renders smaller text under the CenterLabel.
CenterSubtext string
// LabelledBy is the id of an element naming the chart for AT.
// Without it the chart is aria-hidden.
LabelledBy string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the chart's <svg> root,
// or to the shared zero-data placeholder when there is nothing to
// draw. Keys the component owns are dropped: class and
// id (use Class / ID), data-fui-*, and the sizing and naming
// attributes the SVG derives from config (width, height, viewBox,
// xmlns, role, aria-labelledby, aria-hidden).
ExtraAttrs html.Attrs
}
PieChartConfig configures a PieChart.
type PieSlice ¶
type PieSlice struct {
// Label is the accessible label for the slice (required when
// LabelledBy is set on the chart, used as <title> for AT).
Label string
// Value is the slice value (≥0). Slices with Value=0 are skipped.
Value float64
// Color overrides the default palette pick. Optional CSS color
// or one of: "primary", "info", "success", "warning", "danger".
Color string
}
PieSlice is one slice of the pie.
type PipelineImageConfig ¶
type PipelineImageConfig struct {
// Fallback is the <img>'s src: required, used by browsers that
// can't pick from Sources. Typically a mid-size JPEG / PNG.
Fallback string
// Alt is required for non-decorative images.
Alt string
// Width and Height are the intrinsic dimensions of Fallback.
// Setting them is mandatory to avoid CLS.
Width, Height int
// Sources is the typed responsive set; one <source> element is
// emitted per distinct Type, grouping every PipelineSource with
// that type into a single srcset.
//
// Groups are emitted in the order their Type first appears, so
// putting the modern format (WebP) before the legacy one makes
// older browsers fall through to the Fallback <img>.
Sources []PipelineSource
// Sizes is the CSS sizes attribute. Default "100vw".
Sizes string
// Placeholder, when set to an inline raster data: URI, renders a
// low-fidelity image behind this one so something content-shaped is
// visible before the real pixels arrive.
//
// Produce one with framework/image: BlurHashDataURL(hash, …) to render
// a stored BlurHash, the natural companion to VariantResult.BlurHash,
// or pass VariantResult.Placeholder straight through for an LQIP.
// A bare BlurHash string is not accepted; it is not an image until it
// is decoded.
//
// Values that are not usable inline images are dropped and the image
// renders without a placeholder.
Placeholder string
Eager bool
HighPriority bool
Fit ImageFit
Aspect ImageAspect
Rounded bool
ID, Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the image's root element
// (the wrapping <span>, not the inner <img>). Keys the component
// owns are dropped: class and id (use Class / ID) and data-fui-*.
ExtraAttrs html.Attrs
}
PipelineImageConfig configures a multi-format <picture> with an optional placeholder (LQIP data URL or BlurHash string).
type PipelineSource ¶
type PipelineSource struct {
URL string // image URL: required
Width int // intrinsic pixel width: required
Type string // MIME type: required (e.g. "image/webp", "image/jpeg")
}
PipelineSource is one entry in a typed responsive source set, typically produced by framework/image.VariantSet.
func PipelineSourcesFromHeaders ¶
func PipelineSourcesFromHeaders(headers []HeaderInfo, urlFor func(name string) string) []PipelineSource
PipelineSourcesFromHeaders bridges framework/image's variant pipeline to a typed PipelineSource slice. Given a URL function that maps a variant's Name to its public URL (e.g. through a storage backend), build the slice that goes into PipelineImageConfig.Sources without re-deriving MIME or width from filenames.
Empty headers are skipped (Width==0 or URL=="").
type PollingIndicatorConfig ¶
type PollingIndicatorConfig struct {
// Label is the text rendered next to the pulsing dot.
// Defaults to "Live".
Label string
// Paused freezes the pulse animation and dims the dot, use when
// the upstream polling has been paused or completed.
Paused bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the indicator's root
// element. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-*, role, and aria-live — the
// live-region contract.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the live label.
// When nil, English fallbacks apply.
Ctx context.Context
}
PollingIndicatorConfig configures a PollingIndicator.
type PricingCardConfig ¶ added in v0.7.0
type PricingCardConfig struct {
Name string // plan name, e.g. "Pro"
Price string // headline price, e.g. "$99"
Period string // optional period suffix, e.g. "/mo"
Description string // optional one-line pitch under the name
Features []string // checked feature list
CTALabel string // CTA button label (defaults to "Choose " + Name)
CTAHref string // CTA target
Featured bool // highlight as the recommended plan
ID string
// HeadingLevel overrides the plan-name heading level (default 3).
// Set to 2 when cards sit directly under the page <h1> (no
// intervening section <h2>) so axe's heading-order rule passes.
HeadingLevel int
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the card's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
PricingCardConfig configures one plan card.
type ProgressConfig ¶ added in v0.86.0
type ProgressConfig struct {
// Value is the current progress. 0 to Max renders a determinate
// bar; a negative value renders an indeterminate one. Clamped to
// Max at render.
Value float64
// Max is the ceiling. 0 takes 100.
Max float64
// Label is the bar's accessible name. Required; visible as text
// when ShowLabel is set, aria-label otherwise.
Label string
ShowLabel bool
// Description is an optional sentence beside the bar ("73 of
// 100", "Uploading…").
Description string
ID string
Class string
// ExtraAttrs forwards additional attributes to the root. Keys the
// component owns are dropped: class and id (use Class / ID).
ExtraAttrs html.Attrs
}
ProgressConfig configures one bar.
type ProgressStep ¶
type ProgressStep struct {
// Label is the step name (required, e.g. "Account").
Label string
// Hint is the optional supporting line below the label.
Hint string
// Status picks the visual state. Defaults to ProgressStepUpcoming.
Status ProgressStepStatus
// Href, when set on a complete step, makes the step a link the
// user can click to navigate back. Upcoming steps ignore Href.
Href string
}
ProgressStep is one entry in the indicator.
type ProgressStepStatus ¶
type ProgressStepStatus string
ProgressStepStatus is the rendered state of a single step.
const ( ProgressStepUpcoming ProgressStepStatus = "" // default ProgressStepCurrent ProgressStepStatus = "current" ProgressStepComplete ProgressStepStatus = "complete" )
type ProgressStepsConfig ¶
type ProgressStepsConfig struct {
// Steps are the entries in order. Required (≥1).
Steps []ProgressStep
// Orientation defaults to horizontal.
Orientation ProgressStepsOrientation
// Label is the optional aria-label for the wrapping nav. Defaults
// to the reader's "Progress".
Label string
// Ctx carries the per-request context used to resolve the
// aria-label. When nil, English fallbacks apply.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes to the <nav> root.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-* and aria-label (use Label).
ExtraAttrs html.Attrs
}
ProgressStepsConfig configures a step indicator.
type ProgressStepsOrientation ¶
type ProgressStepsOrientation string
ProgressStepsOrientation chooses horizontal (default) or vertical layout.
const ( ProgressStepsHorizontal ProgressStepsOrientation = "" ProgressStepsVertical ProgressStepsOrientation = "vertical" )
type RadioGroupConfig ¶
type RadioGroupConfig struct {
// Name is the shared form-field name for all radios (required).
Name string
// Legend is the group label rendered as <legend> (required).
Legend string
// Options is the list of radio options (required, at least one).
Options []RadioGroupOption
// Help renders supporting text under the group.
Help string
// Error replaces Help with an error message.
Error string
// Required marks every leaf required, which is how HTML makes a
// radio group required.
Required bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the group's root
// <fieldset> element. Keys the component owns are dropped: class
// and id (use Class / ID), role (the fieldset is the native group
// semantic; headless renders no role on it), aria-describedby
// (wired to the group's message), and every data-fui-* key.
ExtraAttrs html.Attrs
}
RadioGroupConfig configures a group of radio buttons.
type RadioGroupOption ¶
RadioGroupOption describes one radio button in a RadioGroup.
type RailItem ¶
type RailItem struct {
Anchor string // required, e.g. "modeling" → href="#modeling"
Text string // required, link label
Eyebrow string // optional leading chip
Count int // optional trailing chip (0 = hidden)
}
RailItem is one entry in the rail.
Anchor is required (the fragment without the leading #). Text is the visible link label. Eyebrow is the leading mono chip (e.g. "01" / "01 / overview"); empty hides the chip column. Count is the trailing numeric chip (e.g. doc count per section); 0 hides the column.
type RangeSliderConfig ¶
type RangeSliderConfig struct {
// Name is the form-field base name (required). Two inputs ship:
// Name+"-min" and Name+"-max".
Name string
// Label is the accessible group name (required; each thumb is
// named from it: "Minimum <Label>", "Maximum <Label>").
Label string
// Min / Max bound the range. Defaults: 0 / 100.
Min int
Max int
// Step is the step granularity. Default 1.
Step int
// ValueLow / ValueHigh are the initial values. Defaults: Min / Max.
// A crossed pair (low above high) is refused at render — the
// module clamps drags, never the server's props.
ValueLow int
ValueHigh int
// ShowValue renders the live "lo to hi" sentence beside the label.
ShowValue bool
// Disabled disables both thumbs.
Disabled bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, role, and aria-label (use Label).
ExtraAttrs html.Attrs
}
RangeSliderConfig configures a RangeSlider.
type RatingConfig ¶
type RatingConfig struct {
// Name is the form-field name (required).
Name string
// Label is the accessible label (required, used as the
// radiogroup's aria-label).
Label string
// Max is the rating ceiling (1..N). Defaults to 5.
Max int
// Value is the initial selection (0..Max). 0 = no rating chosen.
Value int
// Shape picks one of the bundled glyphs (star/heart/thumb/fire/
// diamond/circle/square). Ignored when Icon is set.
Shape RatingShape
// Icon is a caller-supplied monochrome SVG (or any render.HTML)
// used in place of the bundled Shape glyph. The fill / stroke
// inside should use currentColor so the selected-state highlight
// works. Cloned into every star.
Icon render.HTML
// Size picks the icon glyph size. Default=24px, Small=16px,
// Large=32px. Tap target stays at the WCAG floor regardless.
Size RatingSize
// Gap picks the visual spacing between stars. Default keeps the
// AAA 44×44 tap target per star. Tight shrinks the inline tap
// zone to glyph+8px, relaxing AAA to AA (24px floor) for dense
// inline ratings. Loose / Wide widen the gap. Independent of Size.
Gap RatingGap
// Disabled disables all radios.
Disabled bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the rating's root
// <fieldset>. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-*, role, and aria-label — the
// radiogroup contract.
ExtraAttrs html.Attrs
}
RatingConfig configures a RatingInput.
type RatingGap ¶
type RatingGap string
RatingGap controls the visual gap between stars, independent of Size. Useful for compact (tight) inline ratings vs. roomy (loose / wide) detail-page ratings.
type RatingShape ¶
type RatingShape string
RatingShape picks one of the bundled glyphs. For a custom glyph, set RatingConfig.Icon instead. Icon overrides Shape.
const ( RatingShapeStar RatingShape = "" // default RatingShapeHeart RatingShape = "heart" RatingShapeThumb RatingShape = "thumb" RatingShapeFire RatingShape = "fire" RatingShapeDiamond RatingShape = "diamond" RatingShapeCircle RatingShape = "circle" RatingShapeSquare RatingShape = "square" )
type RatingSize ¶
type RatingSize string
RatingSize controls the painted glyph size. The tap target stays at the --spacing-touch-target floor (44px WCAG 2.5.5) regardless; only the SVG glyph inside shrinks or grows.
const ( RatingSizeDefault RatingSize = "" // 24px RatingSizeSmall RatingSize = "small" RatingSizeLarge RatingSize = "large" )
type RecordSummaryConfig ¶ added in v0.23.0
type RecordSummaryConfig struct {
Title string
Eyebrow string
Description string
Status render.HTML
Highlight render.HTML
Metrics render.HTML
Aside render.HTML
Actions render.HTML
Tone RecordSummaryTone
HeadingLevel int
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the summary's root
// <article> element. Keys the component owns are dropped: class
// and id (use Class / ID), data-fui-*.
ExtraAttrs html.Attrs
}
RecordSummaryConfig configures the dominant summary of one record, event, or operational state. The slots are intentionally bounded: use Highlight for the next decision, Metrics for a MetricBand, Aside for one compact supporting fact group, Footer for ownership/context, and Actions for natural-width primary controls. Actions render in the lead region so the primary path does not fall below a long summary on phones.
type RecordSummaryTone ¶ added in v0.23.0
type RecordSummaryTone string
RecordSummaryTone selects the semantic accent rail for RecordSummary.
const ( RecordSummaryToneNeutral RecordSummaryTone = "" RecordSummaryToneInfo RecordSummaryTone = "info" RecordSummaryToneSuccess RecordSummaryTone = "success" RecordSummaryToneWarning RecordSummaryTone = "warning" RecordSummaryToneDanger RecordSummaryTone = "danger" )
type RepeaterConfig ¶
type RepeaterConfig struct {
Name string
Label string
ID string
MinItems int
MaxItems int
AddLabel string
RemoveLabel string
Template func(index int) render.HTML
Items []render.HTML
// RPCPath, when set, makes add/remove a region update: the
// endpoint the operations POST to and the signal whose region the
// answer replaces (the items container, "<ID>-items").
RPCPath string
// ExtraAttrs forwards additional attributes to the repeater's root
// element. Keys the component owns are dropped: class, id,
// data-fui-*, and every data-hui-* hook.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve i18n strings
// (AddLabel, RemoveLabel defaults). When nil, context.Background()
// is used and English fallbacks are returned.
Ctx context.Context
}
RepeaterConfig configures a dynamic form repeater.
type ResponsiveConfig ¶
type ResponsiveConfig struct {
// Below is the breakpoint the mobile variant shows below; the
// desktop variant shows at and above it. The zero value is
// StackBelowMD (48rem); StackBelowLG is 64rem. Other values panic.
Below StackBreakpoint
// Class is appended to the wrapping <div>'s class list.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the swap's root element.
// Keys the component owns are dropped: class (use Class) and
// data-fui-*.
ExtraAttrs html.Attrs
}
ResponsiveConfig configures the swap.
type ResponsiveMode ¶
type ResponsiveMode string
ResponsiveMode selects how a DataTable behaves when its container shrinks below the configured breakpoint. Detection is **container query** based: the table responds to its own container's inline size, not the viewport, so a wide table in a narrow sidebar gets the responsive treatment even when the page itself is wide.
const ( // ResponsiveScroll keeps the default horizontal-scroll behavior: // the table stays a table; the scroll region overflows. ResponsiveScroll ResponsiveMode = "" // ResponsiveCards collapses each row into a labeled card stack // (header → value pairs) when the container is narrower than // ~640px. Column headers travel with each cell via data-label, // which the primitive renders for every headered column. ResponsiveCards ResponsiveMode = "cards" )
type Row ¶
type Row struct {
// Cells is a map from column Key to the rendered cell HTML.
// Missing cells render as empty strings.
Cells map[string]render.HTML
// ID optionally identifies the row for ARIA / interaction. Empty
// is fine; it just won't get an `id=` attribute.
ID string
}
Row is a single rendered table row. Cells map column Key → HTML.
type SearchInputConfig ¶
type SearchInputConfig struct {
// Name is the form-field name (required).
Name string
// ID is the input element's id (required).
ID string
// Placeholder renders the native placeholder. Defaults to "Search...".
Placeholder string
// Action is an optional form action URL. When set, wraps in <form role="search">.
Action string
// Method is the form method. Defaults to "GET".
Method string
// Class adds extra CSS classes to the wrapper.
Class string
// ExtraAttrs forwards additional attributes to the <input> element.
// Keys the component owns are dropped: class and id, data-fui-*,
// type, and name. "value" is deliberately NOT owned: the resource
// UI prefills the current search term through it.
ExtraAttrs map[string]string
// Ctx carries the per-request context used to resolve i18n labels
// (placeholder, aria-labels). When nil, English fallbacks apply.
Ctx context.Context
}
SearchInputConfig configures a SearchInput.
type SectionConfig ¶
type SectionConfig struct {
// Eyebrow is an optional short decorative kicker rendered above
// the heading, e.g. a section number ("01 / what it generates").
// It is marked aria-hidden because it duplicates the heading for
// SR users.
Eyebrow string
Heading string // optional <h2> heading
Description string // optional supporting text under the heading
// DescriptionHTML lets the supporting text carry inline markup (code,
// links). When non-empty it takes precedence over Description.
DescriptionHTML render.HTML
// Label sets the section's accessible name when there is no
// Heading, by aria-label.
Label string
Class string
ID string
// Compact removes outer margins when a parent Stack owns section spacing.
Compact bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the section's root <section> element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and the accessible-name contract (role,
// aria-label, aria-labelledby).
ExtraAttrs html.Attrs
}
SectionConfig configures a labelled content section.
ID behaviour, on headless.Section:
- If ID is set, it names the root, and the heading's own id derives from it ("<id>-title"), so repeated heading text with distinct IDs never shares a target.
- If ID is empty and Heading is set, the section auto-slugs the heading as its id ("Forms" → id="forms"), the scrollspy/rail case, and the heading's id is the slug plus "-title".
- If both ID and Heading are empty but Label is set, the region is named by aria-label.
- If all three are empty the section renders a plain div: an unnamed section is noise in the landmark list, not a landmark.
type SegmentedControlConfig ¶
type SegmentedControlConfig struct {
// Name is the form-submit name shared by all radios. Required.
Name string
// Options must contain at least two segments. Required.
Options []SegmentedOption
// Selected is the initially selected Value. When empty or not
// matching any option, defaults to Options[0].Value.
Selected string
// Label is the aria-label on the radiogroup wrapper. Required
// when the surrounding context doesn't already label it (e.g.
// the SegmentedControl is not inside a <label> or FormField).
Label string
// RPCPath, when set, attaches data-fui-rpc to each radio so a change
// POSTs to the server carrying the selected segment's name=value. The
// runtime serializes the form the radio belongs to (node.form), so place
// the SegmentedControl inside a <form> for the selection to round-trip:
// a radio with no enclosing form posts an empty body and the handler
// cannot see which segment was chosen. An explicit data-fui-rpc-body on a
// radio still wins over form serialization. Method is POST.
RPCPath string
// RPCSignal, when set, broadcasts the response as the given
// signal name (data-fui-rpc-signal).
RPCSignal string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the control's root
// element. Keys the component owns are dropped: class and id
// (use Class / ID), data-fui-*, role, aria-label, and data-count.
ExtraAttrs html.Attrs
}
SegmentedControlConfig configures a segmented radiogroup.
type SegmentedOption ¶
type SegmentedOption struct {
// Label is the visible text. Required.
Label string
// Value is the submit value and the option's stable identifier.
// Required and unique within the control.
Value string
// Disabled marks the segment as non-selectable.
Disabled bool
}
SegmentedOption is one selectable segment.
type SelectConfig ¶
type SelectConfig struct {
// Name is the form-field name (required).
Name string
// Label is the accessible label (required).
Label string
// Options is the list of <option> elements (required, at least one).
Options []SelectOption
// Placeholder adds a disabled, selected-first option with empty value
// that acts as a placeholder hint (e.g. "Choose a country…").
Placeholder string
// Required marks the field required.
Required bool
// Disabled disables interaction.
Disabled bool
// Help renders supporting text under the field.
Help string
// Error renders the field's error message and marks the control
// invalid. The help stays visible alongside it, the error first.
Error string
ID string
Class string
// ExtraAttrs forwards additional attributes to the <select>
// element (a relation's data-rel-entity among them). Keys the
// component owns are dropped: class and id (use Class / ID),
// data-fui-*, name, disabled, required, aria-invalid, and
// aria-describedby.
ExtraAttrs html.Attrs
}
SelectConfig configures a Select.
type SelectOption ¶
SelectOption describes a single <option>.
type ShortcutHintConfig ¶
type ShortcutHintConfig struct {
// Chord is the human-readable chord string accepted by the
// runtime's parseCombo: "Mod+K", "Ctrl+/", "Shift+Tab", "/",
// "Esc", "Enter". Required.
Chord string
// BindTarget is an optional CSS selector. When set, the hint
// renders data-hui-shortcut-hint carrying the selector and the
// headless-navigation module resolves the first connected match and
// CLICKS it when the chord is pressed. The selector is validated at
// render: control bytes and markup openers are refused, and the
// value must be a single selector.
BindTarget string
// SROnlyLabel overrides the screen-reader announcement.
// Default: humanized chord (e.g. "Command-K", "Slash", "Escape").
SROnlyLabel string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the hint's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and aria-hidden — the wrapper must stay in the
// accessibility tree for its SR-only label.
ExtraAttrs html.Attrs
}
ShortcutHintConfig configures the chord display.
type SidebarCollapse ¶ added in v0.75.0
type SidebarCollapse string
SidebarCollapse selects who owns the collapsed state of the collapsible variant: the server (per-request, e.g. restored from the signed-in user's stored preference) or the runtime (localStorage).
SidebarCollapseAuto: zero value. The runtime owns the state and restores it from localStorage after hydration — the default behaviour since the component exists. SidebarCollapseCollapsed: the server renders the collapsed rail (data-collapsed="true" on the root). The runtime neither reads nor writes localStorage: a stale local value cannot overwrite the server's state on first paint or after a toggle. SidebarCollapseExpanded: the server renders the expanded column (data-collapsed="false"). Same localStorage suppression.
This mirrors CurrentPath's split: when set, the server decides and the state ships in the SSR bytes; when empty, the runtime decides after hydration. Only meaningful with Variant: SidebarCollapsible.
const ( SidebarCollapseAuto SidebarCollapse = "" SidebarCollapseCollapsed SidebarCollapse = "collapsed" SidebarCollapseExpanded SidebarCollapse = "expanded" )
type SidebarConfig ¶
type SidebarConfig struct {
// Title is rendered as the sidebar's top heading. Empty omits it.
Title string
// Set a distinct label when more than one navigation landmark appears.
NavLabel string
// Items is the navigation tree.
Items []SidebarItem
// CurrentPath is the screen's current path, used for active-state
// highlighting. When empty, falls back to JS: the runtime stamps
// aria-current on any matching <a> after hydration.
CurrentPath string
// Variant defaults to SidebarPersistent.
Variant SidebarVariant
// Compact is a documentation rail: tighter links and a thin current marker.
// On phones its full-width trigger shows NavLabel and links keep 44px targets.
Compact bool
// DrawerBreakpoint picks the viewport width below which the
// sidebar collapses to its hamburger drawer instead of the inline
// column. The default (StackBelowMD, 48rem) serves phones; below
// lg (StackBelowLG, 64rem) collapses the column on tablets too.
// Every place the component encodes the switch follows it: the
// inline column's hiding, the drawer trigger's self-hiding, and
// the NativeMobile no-script disclosure.
DrawerBreakpoint StackBreakpoint
// Collapse decides who owns the collapsed state when Variant is
// SidebarCollapsible. Zero (SidebarCollapseAuto) keeps the
// localStorage-driven behaviour. Collapsed/Expanded make the server
// own the state: the collapsed rail (or expanded column) ships in
// the SSR bytes and the runtime never reads or writes the
// localStorage key. Use it for per-user preferences restored from
// the database that must survive first paint on any device.
Collapse SidebarCollapse
// GroupMarkup selects the dialect used for items with Children.
// Zero (SidebarGroupDetails) renders <details><summary>.
// SidebarGroupButton renders button[aria-expanded][aria-controls]
// plus a hidden-when-closed container of the child links.
GroupMarkup SidebarGroupMarkup
// Prepend is an optional component rendered between the title and
// the nav, on every body path: the inline sidebar, SidebarBody, and
// the MountSidebar drawer. Use it for a section switcher that the
// phone drawer must carry because the header hides it there. It is
// a component, not HTML, because MountSidebar runs once at boot and
// the drawer body renders per request: a Prepend that implements
// component.ContextComponent sees the request (current section,
// signed-in user) on the inline and drawer paths alike. Wrap static
// markup in app.NewStaticComponent. Hidden with the title in the
// collapsed rail and the auto-hide rest state. Nil emits no markup.
Prepend component.Component
// user pill, settings link, etc.).
Footer render.HTML
// DrawerTitle is the brand text the < md drawer's header row
// shows. Falls back to Title when empty; when both are empty the
// drawer renders no header (just the nav, as before). Set it to
// the same brand the top bar shows when the layout does not
// expose one.
DrawerTitle string
// DrawerName overrides the widget name used for the < md drawer.
// Defaults to "ui-sidebar-drawer". Apps that host multiple
// sidebars per page must override to avoid collisions.
DrawerName string
// CollapseStorageKey overrides the localStorage key used by the
// collapsible variant. Defaults to "gofastr.sidebar.<DrawerName>.collapsed".
// Ignored when Collapse is Collapsed/Expanded: server-owned state
// never touches localStorage.
CollapseStorageKey string
// CollapseLabel is the collapse button's aria-label when the
// sidebar is expanded. Defaults to "Collapse navigation".
CollapseLabel string
// ExpandLabel is the collapse button's aria-label when the sidebar
// is collapsed (the same button expands the rail). Defaults to
// "Expand navigation". Both labels are also emitted as
// data-hui-sidebar-collapse-label / data-hui-sidebar-expand-label
// so the runtime keeps using them after a client-side toggle.
ExpandLabel string
// SuppressDrawerTrigger hides the hamburger button rendered by
// Sidebar (some apps put their hamburger in the page header
// instead and call MountSidebar themselves).
SuppressDrawerTrigger bool
// NativeMobile adds a native disclosure when scripting is disabled.
// Scripted browsers keep the mounted drawer and its keyboard behavior.
NativeMobile bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the sidebar's root element. Keys the
// component owns are dropped: class and id, aria-label (the
// navigation landmark's name comes from NavLabel), data-collapsed,
// and every data-fui-*/data-hui-* wiring key (the sidebar marker
// and collapse-storage contract).
ExtraAttrs html.Attrs
}
SidebarConfig describes a navigation sidebar.
type SidebarGroupMarkup ¶ added in v0.75.0
type SidebarGroupMarkup string
SidebarGroupMarkup selects the markup dialect used for groups (items with Children).
SidebarGroupDetails: zero value. <details data-hui-disclosure data-hui-disclosure-persist><summary>, the default since the component exists. SidebarGroupButton: a <button type="button" aria-expanded aria-controls data-hui-sidebar-group-toggle> header plus the child links in a container that carries the hidden attribute when closed. For hosts whose contract pins that shape for keyboard/AT parity with the rest of their app; the sidebar runtime module toggles aria-expanded and hidden on click.
Two details-dialect behaviours do not carry over to the button dialect: group open state is not persisted across navigation (the details dialect carries data-hui-disclosure-persist; every swap resets a button-dialect group to its server-rendered state), and the dialect needs JavaScript — <details> opens natively without it, but without the runtime module a closed button-dialect group's links are unreachable.
const ( SidebarGroupDetails SidebarGroupMarkup = "" SidebarGroupButton SidebarGroupMarkup = "button" )
type SidebarItem ¶
type SidebarItem struct {
Label string
Href string
Icon render.HTML
Children []SidebarItem
// Roles, when non-empty, restricts the item to users holding at least
// one of the named roles. Empty = visible to everyone. Filtering happens
// at render time via the roles extractor (SetRolesExtractor); when no
// extractor is registered, items render unfiltered (opt-in feature).
Roles []string
// Active forces the item into the active state regardless of the
// caller's MatchPath. Useful for pages that don't map 1:1 to a URL.
Active bool
// MatchPath, when set, overrides the default "current URL equals
// Href" check used to mark the item as active. Pass a section
// prefix ("/customers") to highlight on the section root and its
// sub-paths; the match is on the path-segment boundary, so
// "/customers" does not light up "/customers-archive". For anything
// non-trivial, use CurrentPath in your screen and set Active
// manually.
MatchPath string
// Open forces a group to render expanded on first paint regardless
// of active-state rules — for hosts whose contract pins certain
// sections open by default (metacollector's My Inventory group).
// Leaf items ignore it.
Open bool
}
SidebarItem is one navigation entry. Children nest one level deep. Deeper nesting is unsupported by design. Sidebars should not be trees.
type SidebarVariant ¶
type SidebarVariant string
SidebarVariant selects how the sidebar behaves at ≥ md viewports.
SidebarPersistent: fixed-width column, always visible. SidebarCollapsible: column with a chevron that toggles a compact rail; expanded/collapsed state persists in localStorage. SidebarOffCanvas: hidden by default. Opens via the hamburger trigger on every viewport (no inline column). SidebarAutoHide: like persistent, but at >= md the column rests as a 64px icon rail and reveals the full column on :hover or :focus-within (keyboard). Pure CSS from the component's own stylesheet; no JavaScript.
On `< md` every variant collapses to a hamburger + drawer.
const ( SidebarPersistent SidebarVariant = "persistent" SidebarCollapsible SidebarVariant = "collapsible" SidebarOffCanvas SidebarVariant = "off-canvas" SidebarAutoHide SidebarVariant = "auto-hide" )
type SignOutConfig ¶ added in v0.7.0
type SignOutConfig struct {
// Action is the POST target; defaults to "/auth/logout".
Action string
// Label is the button text; defaults to "Sign out".
Label string
// Next is an optional post-logout redirect, sent as a hidden field.
Next string
// Variant styles the button; defaults to ButtonGhost.
Variant ButtonVariant
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the control's root <form>.
// Keys the component owns are dropped: class (use Class),
// data-fui-*, method, and action.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the sign-out label.
// When nil, English fallbacks apply.
Ctx context.Context
}
SignOutConfig configures a SignOut control.
type SignalToggleConfig ¶
type SignalToggleConfig struct {
SignalName string // required unless Slice is set
Slice *store.Slice[bool] // optional; supplies the signal name + initial value, takes precedence
Label string // optional: aria-label (falls back to the signal name)
Class string // optional: extra CSS classes
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the toggle's root
// <button>. Keys the component owns are dropped: class (use
// Class), data-fui-*, role, aria-checked, and aria-label — the
// switch contract and signal wiring the runtime drives.
ExtraAttrs html.Attrs
}
SignalToggleConfig configures a boolean toggle/switch that flips a signal entirely client-side. Unlike the form-based Switch (which wraps a native <input type="checkbox">), SignalToggle uses the runtime's signal system. No form submission, pure JS reactivity.
Clicking the button toggles the named signal; the signal drives both the aria-checked attribute and a visible label.
type SkeletonAvatarConfig ¶
type SkeletonAvatarConfig struct {
// HideSubline collapses the two stacked lines into one.
HideSubline bool
// Label is the announcement the preset makes once, politely.
// Defaults to the reader's "Loading…".
Label string
// Ctx carries the per-request context used to resolve the default
// label. When nil, English fallback applies.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the placeholder's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and aria-hidden.
ExtraAttrs html.Attrs
}
SkeletonAvatarConfig configures a SkeletonAvatar.
type SkeletonCardConfig ¶
type SkeletonCardConfig struct {
// BodyLines is the number of skeleton lines rendered in the body.
// Defaults to 2 when zero.
BodyLines int
ShowFooter bool
// Label is the announcement the preset makes once, politely.
// Defaults to the reader's "Loading…".
Label string
// Ctx carries the per-request context used to resolve the default
// label. When nil, English fallback applies.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the placeholder's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and aria-hidden (skeletons are always
// presentational; the one announcement is the primitive's).
ExtraAttrs html.Attrs
}
SkeletonCardConfig configures a SkeletonCard.
type SkeletonLineConfig ¶ added in v0.86.0
type SkeletonLineConfig struct {
// Label is the announcement the preset makes once, politely.
// Defaults to the reader's "Loading…".
Label string
// Ctx carries the per-request context used to resolve the default
// label. When nil, English fallback applies.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the placeholder's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and aria-hidden.
ExtraAttrs html.Attrs
}
SkeletonLineConfig configures a SkeletonLine.
type SkeletonRowConfig ¶
type SkeletonRowConfig struct {
// HideChevron drops the trailing chevron skeleton: use for plain
// label/value rows that aren't drill-down navigable.
HideChevron bool
// Label is the announcement the preset makes once, politely.
// Defaults to the reader's "Loading…".
Label string
// Ctx carries the per-request context used to resolve the default
// label. When nil, English fallback applies.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the placeholder's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and aria-hidden.
ExtraAttrs html.Attrs
}
SkeletonRowConfig configures a SkeletonRow.
type SkeletonTimelineConfig ¶ added in v0.86.0
type SkeletonTimelineConfig struct {
// Rows is the number of event-shaped rows to draw (dot, name
// line, two text lines each). Default 3, the shape of a short
// activity feed.
Rows int
// Label is the polite announcement. Default "Loading…".
Label string
// Ctx carries the per-request context used to resolve the default
// label. When nil, English fallback applies.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the placeholder's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and aria-hidden.
ExtraAttrs html.Attrs
}
SkeletonTimelineConfig configures a SkeletonTimeline.
type SkipLinkConfig ¶
type SkipLinkConfig struct {
// Target is the id of the element to jump to.
// Defaults to "main-content" when empty.
Target string
// Text is the visible label shown on focus.
// Defaults to "Skip to main content" when empty.
Text string
Class string
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the link's root <a>. Keys the component
// owns are dropped: class and id (use Class / ID), data-fui-*, and
// href (use Target).
ExtraAttrs html.Attrs
}
SkipLinkConfig configures a skip-navigation link.
Renders a visually-hidden anchor that becomes visible on keyboard focus, letting users jump past repetitive navigation to the main content area. Required for WCAG 2.1 Level A (criterion 2.4.1 "Bypass Blocks").
Place SkipLink as the first element inside <body>.
Usage:
ui.SkipLink(ui.SkipLinkConfig{Target: "main-content"})
// … then on the main element:
// <main id="main-content"> ...
// Or with no Target: defaults to "main-content".
ui.SkipLink(ui.SkipLinkConfig{})
type SliderConfig ¶
type SliderConfig struct {
// Name is the form-field name (required).
Name string
// Label is the accessible label (required, used as <label for=…>).
Label string
// Min / Max bound the range. Defaults: 0 / 100.
Min int
Max int
// Step is the step granularity. Default 1.
Step int
// Value is the initial value. Outside the range or off a step is
// refused at render — the server's own props are not repaired.
Value int
// ShowValue renders the value output beside the label.
ShowValue bool
// ShowEdgeLabels renders the Min and Max values under the track.
ShowEdgeLabels bool
// Disabled disables interaction.
Disabled bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and every data-hui-* hook.
ExtraAttrs html.Attrs
}
SliderConfig configures a Slider.
type SortOption ¶ added in v0.12.0
type SortOption struct {
// Label is the visible text ("Newest", "Name A–Z"). Required.
Label string
// Value is the submitted sort key. Required.
Value string
}
SortOption is one choice in the sort control.
type SortableItem ¶ added in v0.86.0
type SortableItem = headless.SortableItem
SortableItem is one row: Key is the stable identifier the server applies the order by, Label the visible text and drag name, Content an optional richer body.
type SortableListConfig ¶ added in v0.86.0
type SortableListConfig struct {
// Items are the rows in initial order. May be empty (an empty
// column stays a drop target).
Items []SortableItem
// Label is the list's accessible name. Required.
Label string
// RPCPath is POSTed after every successful reorder: the new key
// order, plus container/version fields when configured and
// moved=<key> on a cross-container drop.
RPCPath string
// Group is the board id shared by linked columns (kanban).
Group string
// Container is the per-column id that routes the write.
Container string
// Version is an optional optimistic-concurrency token; a 409 then
// fires the conflict path instead of a rollback.
Version string
// ConflictRPC is GET-fetched on a versioned 409; its response
// (fresh rows, e.g. from SortableListItems) replaces the list.
ConflictRPC string
ID string
Class string
// ExtraAttrs forwards additional attributes to the wrapper. Keys
// the component owns are dropped: class and id (use Class / ID)
// and aria-label (use Label).
ExtraAttrs html.Attrs
// Ctx resolves the Strings table through the request's translator.
Ctx context.Context
}
SortableListConfig configures one list.
type SparklineConfig ¶
type SparklineConfig struct {
// Values are the points in order (≥2).
Values []float64
// Width / Height in CSS pixels. Default 120×32.
Width int
Height int
// FullWidth stretches the chart to its container's content width
// (width="100%"): the viewBox keeps the configured aspect, Height
// stays fixed. For cards whose column width is fluid (responsive
// grids) where a fixed px width would leave dead margins.
FullWidth bool
// Shape picks line or area. Default line.
Shape SparklineShape
// Color override: defaults to var(--color-primary) via CSS.
// Set to "danger" / "success" / "warning" / "info" to use the
// matching theme token; any other string is passed through as a
// raw CSS color.
Color string
// LabelledBy is the id of an element naming the chart (e.g. the
// StatCard label), used as the SVG's aria-labelledby. Without
// it the chart is aria-hidden (decorative).
LabelledBy string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the chart's root element:
// the <svg> itself, or the "no trend data" <span> when Values has
// fewer than two points. Keys the component owns are dropped:
// class and id (use Class / ID), data-fui-*, and the sizing and
// naming attributes the SVG derives from config (width, height,
// viewBox, xmlns, role, aria-labelledby, aria-hidden).
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the no-trend-data label.
// When nil, English fallbacks apply.
Ctx context.Context
}
SparklineConfig configures a Sparkline.
type SparklineShape ¶
type SparklineShape string
SparklineShape picks line (default) or area.
const ( SparklineLine SparklineShape = "" SparklineArea SparklineShape = "area" )
type SpinnerConfig ¶
type SpinnerConfig struct {
// Label is the assistive-text announced by screen readers.
// Defaults to "Loading…" when empty.
Label string
// Size selects a named size (sm | md (default) | lg).
Size SpinnerSize
// Variant selects the visual treatment.
Variant SpinnerVariant
// Inline true renders inline-flex (sits next to text); false
// renders block (centered in its own row).
Inline bool
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the spinner's root element. Keys the
// component owns are dropped: class and id (use Class / ID),
// style, data-fui-* and role — the live-region contract is the
// primitive's.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the loading label.
// When nil, English fallbacks apply.
Ctx context.Context
}
SpinnerConfig configures a spinner.
type SpinnerSize ¶
type SpinnerSize string
SpinnerSize selects a named size.
const ( SpinnerSm SpinnerSize = "sm" SpinnerMd SpinnerSize = "" // default SpinnerLg SpinnerSize = "lg" )
type SpinnerVariant ¶
type SpinnerVariant string
SpinnerVariant selects the visual style.
const ( SpinnerRing SpinnerVariant = "" // default: bordered ring SpinnerDots SpinnerVariant = "dots" // SpinnerGrid renders a 3×3 grid of small squares animated in a // staggered ripple. Distinct enough from ring/dots to be the // "loading…heavy" indicator on long-running operations. SpinnerGrid SpinnerVariant = "grid" )
type StackBreakpoint ¶ added in v0.86.0
type StackBreakpoint string
StackBreakpoint picks the viewport width a responsive piece switches its posture at: below md (48rem — phones; the default) or below lg (64rem — phones and tablets, leaving the wide form to large screens). SidebarConfig.DrawerBreakpoint and ContentRowConfig .Breakpoint share it so a page's sidebar and its content row collapse at the same width.
const ( // StackBelowMD is the zero value: switch below md (48rem). StackBelowMD StackBreakpoint = "" // StackBelowLG switches below lg (64rem): tablets join phones in // the collapsed form. StackBelowLG StackBreakpoint = "lg" )
type StackConfig ¶
type StackConfig struct {
Gap Gap // gap between children (default md)
Align Align // cross-axis (horizontal) alignment
Justify Justify // main-axis (vertical) alignment
ID string
Class string
// TrimMargins lets Gap own vertical rhythm by removing direct children's
// block margins. Useful for a stack of paragraphs or headings.
TrimMargins bool
// Screen makes the stack at least one viewport tall and pushes its
// last child to the bottom: the page-frame option a recipe uses to
// keep a short page's footer at the bottom of the screen, the way
// a shell's flex column does. The stack is the page column — do
// not nest one screen-tall stack inside another.
Screen bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the stack's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID), style, data-fui-* and the data-hui-* hooks.
ExtraAttrs html.Attrs
}
StackConfig configures a vertical stack.
type StatCardConfig ¶
type StatCardConfig struct {
Label string // required (e.g. "Active users")
Value string // required (e.g. "12,483" or "98.4%")
Trend string // optional trend label (e.g. "+12% vs. last week")
// Direction colors the trend pill. Defaults to flat.
Direction TrendDirection
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the stat card's root <div>.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
StatCardConfig configures a metric card.
type StatusBadgeConfig ¶
type StatusBadgeConfig struct {
Label string // required visible text
Variant StatusVariant // defaults to Neutral
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the pill's root <span>.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
StatusBadgeConfig configures a small status pill.
type StatusPillConfig ¶
type StatusPillConfig struct {
Label string // required visible text
Tone StatusPillTone // default StatusPillNeutral
// Dot adds a leading status dot. Opt-in.
Dot bool
Class string
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the pill's root element.
// Keys the component owns are dropped: class and id (use Class /
// ID) and data-fui-*.
ExtraAttrs html.Attrs
}
StatusPillConfig configures a StatusPill.
type StatusPillTone ¶
type StatusPillTone string
StatusPillTone selects the colour treatment of a StatusPill.
const ( // StatusPillNeutral is the muted default: subtle text on the surface. StatusPillNeutral StatusPillTone = "" // StatusPillAccent uses the brand primary colour with a glowing dot. StatusPillAccent StatusPillTone = "accent" )
type StatusVariant ¶
type StatusVariant string
StatusVariant is the semantic variant of a StatusBadge. The same set drives Callout, Tag, Notification, and FilterChipBar chips; apps extend it with RegisterStatusVariant. Unregistered values panic at render.
const ( StatusSuccess StatusVariant = "success" StatusWarning StatusVariant = "warning" StatusDanger StatusVariant = "danger" StatusInfo StatusVariant = "info" StatusNeutral StatusVariant = "neutral" )
func RegisterStatusVariant ¶ added in v0.13.0
func RegisterStatusVariant(name string, css StatusVariantCSS) StatusVariant
RegisterStatusVariant registers a custom StatusVariant under name. One registration extends every StatusVariant consumer: StatusBadge, Tag (and therefore FilterChipBar chips), Callout, and Notification, each component deriving its own variant rules from the registered accent color in its own sheet, exactly as the built-ins do.
Call at package init. Panics on: empty/invalid name, a built-in or already-registered name, an empty Color, an Icon containing `"` or `\`, or registration after any status-consuming sheet was built.
type StatusVariantCSS ¶ added in v0.13.0
type StatusVariantCSS struct {
// Color is the variant's accent. Required. Token references like
// "{colors.primary}" resolve to "var(--color-primary)".
Color string
// Icon is the glyph Callout and Notification display for this
// variant (a short string, typically one character). Defaults to
// "•". Must not contain `"` or `\`. It is embedded in a CSS
// string literal.
Icon string
}
StatusVariantCSS declares the palette of a registered custom status variant. Status variants are a color story: one accent color fans out to every status-coded component in that component's own pattern (badge/tag tint the pill from it, Callout and Notification color their accent rail and icon from it).
type StepRailConfig ¶
type StepRailConfig struct {
// Title is the small heading at the top of the rail
// (e.g. "The path", "On this page"). Optional.
Title string
// Items are the numbered steps, in order.
Items []StepRailItem
// ActiveIndex marks one step as the active one (visually
// highlighted, aria-current="step"). Must be in [0, len(Items))
// or -1 for "no active step". Out-of-range values panic at render
// time so a typo (or a `slices.Index` -1 result, which is the
// common one) is caught immediately rather than silently
// rendering a rail with no highlight.
ActiveIndex int
// Meta is optional small text below the list (e.g. a "stuck?
// open the journal" pointer).
Meta string
// MetaHref, when non-empty, renders Meta as a link to this URL
// instead of plain text, so a "stuck? ask here" pointer is
// actually clickable.
MetaHref string
// Class is appended to the fui-step-rail wrapper.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the rail's root <aside>
// element. Keys the component owns are dropped: class (use
// Class), data-fui-*, role and aria-label (derived from Title).
ExtraAttrs html.Attrs
}
StepRailConfig configures a StepRail.
type StepRailItem ¶
type StepRailItem struct {
// Number is the displayed ordinal (e.g. "01", "02"). Caller picks
// the format (zero-padded vs. plain) so the visual matches the
// step headings.
Number string
// Anchor is the in-page #id this rail entry jumps to.
Anchor string
// Label is the visible step name.
Label string
}
StepRailItem is one numbered step.
type StepWizardConfig ¶
type StepWizardConfig struct {
// Steps is the ordered list of wizard steps. Required, min 1.
Steps []StepWizardStep
// CurrentStep is 0-indexed. The server sets this after each POST.
CurrentStep int
// Action is the form action URL. Required.
Action string
// Method defaults to "POST".
Method string
// HiddenFields are hidden inputs to carry forward between steps
// (e.g. previously entered data).
HiddenFields []render.HTML
// Errors is an optional set of field-level errors for the current
// step, the same shape ui.Form takes. When non-empty the wizard
// renders a ValidationSummary between the step rail and the
// step's fields, and marks the form (data-hui-form-errors) so the
// headless behaviour module moves focus to the summary after a
// failed submit — which requires ID, the summary's id being derived
// from it. FieldErrors round-trips directly from a server-side
// validation of the submitted step.
Errors FieldErrors
// Summary is a sentence that belongs to no one field, rendered in
// the summary after the field errors. Empty means the framework
// default when Errors is not.
Summary string
// FieldLabels, FieldIDs and FieldOrder are passed to the
// ValidationSummary; see ValidationSummaryConfig.
FieldLabels map[string]string
FieldIDs map[string]string
FieldOrder []string
// Island, when set, makes each submit a region update: the same
// form and controls, the answer swapped into the signal's region.
Island headless.Island
// ID is the form's id; required when Errors is set (the summary's
// id is derived from it).
ID string
Class string
// ExtraAttrs forwards additional attributes to the wizard's root
// <form> element. Keys the component owns are dropped: class and
// id (use Class / ID), data-fui-*, method, and action (both
// validated by the primitive; the form posts wizard_action
// through them).
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve i18n strings
// (Back, Continue, Submit button labels, the rail's sentence).
// When nil, context.Background() is used and English fallbacks are
// returned.
Ctx context.Context
}
StepWizardConfig configures a multi-step form wizard.
type StepWizardStep ¶
type StepWizardStep struct {
// Heading is the step heading. Required.
Heading string
// Description is optional supporting text below the heading.
Description string
// Fields are the form fields rendered for this step.
Fields []render.HTML
}
StepWizardStep is one step in the wizard.
type StickyConfig ¶
type StickyConfig struct {
// Edge selects which edge to stick to.
// Defaults to StickyTop when empty.
Edge StickyEdge
// Offset selects the distance preset from the edge.
// Defaults to StickyOffsetNone when empty.
Offset StickyOffset
// ZIndexTier selects the z-index tier. Defaults to "sticky" when
// empty. Valid values are exactly the five built-in ZIndexSet tiers
// "sticky", "dropdown", "modal", "popover", "toast", which the
// stylesheet maps to z-index: var(--z-<tier>). These are fixed
// built-ins, not arbitrary theme-supplied tokens: validation and
// the generated CSS only know these five, so an unknown tier panics
// (a typo would otherwise silently fall back to the default layer).
ZIndexTier string
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the sticky wrapper's root
// <div>. Keys the component owns are dropped: class and id (use
// Class / ID), style and data-fui-* (which covers the derived
// data-fui-z-tier).
ExtraAttrs html.Attrs
}
StickyConfig configures a position:sticky wrapper.
Wraps children in a div that sticks to the chosen viewport edge on scroll. Uses theme tokens for z-index so sticky elements layer consistently with modals, widgets, and other surfaces.
Usage:
ui.Sticky(ui.StickyConfig{Edge: ui.StickyTop},
ui.Button(ui.ButtonConfig{Label: "Save"}),
)
ui.Sticky(ui.StickyConfig{Edge: ui.StickyTop, Offset: ui.StickyOffsetLg}, header)
ui.Sticky(ui.StickyConfig{Edge: ui.StickyBottom}, toolbar)
type StickyEdge ¶
type StickyEdge string
StickyEdge selects which edge the element sticks to.
const ( StickyTop StickyEdge = "top" StickyBottom StickyEdge = "bottom" )
type StickyOffset ¶
type StickyOffset string
StickyOffset presets for common sticky offsets.
const ( StickyOffsetNone StickyOffset = "0" StickyOffsetSm StickyOffset = "sm" StickyOffsetMd StickyOffset = "md" StickyOffsetLg StickyOffset = "lg" StickyOffsetXl StickyOffset = "xl" )
type StringsRefusal ¶ added in v0.86.0
type StringsRefusal struct {
// Field is the headless.Strings field, Key the catalog key it
// reads.
Field string
Key i18nui.Key
// English is what the page will say; Translated is what the
// catalog offered and the bridge refused.
English string
Translated string
}
StringsRefusal is one translation StringsFor will not use, and the English it renders instead.
func CheckStrings ¶ added in v0.86.0
func CheckStrings(ctx context.Context) []StringsRefusal
CheckStrings reports every bridged key whose translation on this context would be refused for placeholder drift.
It exists because the refusal is otherwise invisible: a catalog that drops a %s renders one English sentence among the translated ones, on every request, with nothing to notice it by. The fallback is deliberate — English beats fmt's "%!s(MISSING)" inside an accessible name — but a translator cannot fix what nobody can see. Call this once per locale you ship, in a test or at boot, and fail on a non-empty result: the drift is a catalog bug, and this is where it is cheap to find.
A nil ctx, or one with no translator, has nothing to refuse and returns nil. The order follows headless.Strings' field order, so the result is stable to print and to diff.
type TOCConfig ¶
type TOCConfig struct {
// Items are the entries, in document order. Required: the
// no-script contract is this rendered list.
Items []TOCItem
// Target is the CSS selector of the content region whose headings
// the module watches for the active state (e.g. "main",
// "article"). Optional: without it the links work and nothing is
// marked.
Target string
// Label is the accessible nav-label (defaults to "On this page").
Label string
// Sticky adds the position: sticky modifier. Default false: the
// nav scrolls with the content unless the caller opts in.
Sticky bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the <nav> root.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-hui-* (the toc wiring), and aria-label (use Label).
ExtraAttrs html.Attrs
}
TOCConfig configures a TableOfContents.
type TOCItem ¶ added in v0.86.0
type TOCItem struct {
// ID is the fragment id of the heading this entry links to,
// without the leading #. Required.
ID string
// Label is the entry's visible text. Required.
Label string
// Level is the heading's level, 1 to 6; 0 takes 2. It names the
// item's modifier class (fui-toc__item--h3, …) so the sheet can
// indent by depth.
Level int
}
TOCItem is one entry in the contents list.
type TabsConfig ¶
type TabsConfig struct {
SignalName string // required unless Slice is set
Slice *store.Slice[int] // optional; supplies the signal name + initial active index, takes precedence
Tabs []TabItem // required, at least 1
Class string // optional extra CSS class
// StateAttrs adds data-state="active"/"inactive" to every tab,
// the attribute contract Radix-style ports pin their test
// locators to. The headless-tabs module keeps data-state in step
// with the selection after client-side switches. Zero value: no
// data-state anywhere.
StateAttrs bool
// ID overrides the id prefix the tab strip would derive from the
// signal name: each tab gets id "<ID>-tab-<i>" plus aria-controls
// "<ID>-panel-<i>", each panel gets id "<ID>-panel-<i>".
ID string
// VacateHidden ships hidden panels EMPTY, their server-rendered
// content parked in an adjacent JSON stash, so page-scoped test
// locators cannot match text inside hidden panels. The
// headless-tabs module restores a panel's content on first show
// and moves the live nodes out and back afterwards. See the
// headless.TabsProps doc for the timing trade-offs.
VacateHidden bool
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the tab strip's root
// wrapper. Keys the component owns are dropped: class, id, the
// data-hui-* wiring, and data-active (the signal mirror).
ExtraAttrs html.Attrs
}
TabsConfig configures a signal-driven tab strip.
type TagConfig ¶
type TagConfig struct {
// Label is the visible text. Required.
Label string
// Variant maps to the same StatusVariant set as StatusBadge so
// status-coded tags compose with the rest of the system. Default
// neutral.
Variant StatusVariant
// Href makes the entire tag an anchor (e.g. a filter link).
Href string
// Dismiss, when non-empty, is the href of the × link that removes
// the tag. A dismissal is an in-page state change, so the Island
// that re-renders the region is required with it: the same link is
// the no-script destination and the island's trigger.
Dismiss string
// Island is where the dismissal goes with script: the endpoint
// that renders the region again and the signal it is bound to.
// Required when Dismiss is set.
Island headless.Island
// Icon renders before the label, aria-hidden.
Icon render.HTML
// DismissLabel is the assistive-text label on the × button.
// Defaults to "Remove <Label>".
DismissLabel string
// DismissAttrs lets callers attach extra data-fui-* attributes to
// the × button (e.g. data-fui-rpc-signal).
DismissAttrs html.Attrs
// Ctx carries the per-request context used to resolve the
// dismiss-label string. When nil, English fallbacks apply.
Ctx context.Context
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the tag's root element,
// whichever shape it takes (<a> or <span>). Keys the component
// owns are dropped: class and id (use Class / ID), data-fui-*,
// and href (use Href; it goes through the URL sanitizer).
ExtraAttrs html.Attrs
}
TagConfig configures a tag/chip.
type TagInputConfig ¶
type TagInputConfig struct {
// Name is the form-field name (required). Each tag is submitted
// under this name (repeated key).
Name string
// Label is the accessible label (required).
Label string
// Values are the initial tags.
Values []string
// Placeholder for the text input.
Placeholder string
// MaxLength caps individual tag length (chars). 0 = no cap.
MaxLength int
// Help renders supporting text under the field.
Help string
// Disabled disables all interaction.
Disabled bool
ID string
Class string
// ExtraAttrs forwards additional attributes to the field's root.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and every data-hui-* hook.
ExtraAttrs html.Attrs
}
TagInputConfig configures a TagInput.
type TerminalBlockConfig ¶
type TerminalBlockConfig struct {
Label string // required header text, e.g. "$ install"
Class string
ID string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the block's root
// wrapper <div>. Keys the component owns are dropped: class
// and id (use Class / ID), data-fui-*.
ExtraAttrs html.Attrs
}
TerminalBlockConfig configures a TerminalBlock.
type TextAreaConfig ¶
type TextAreaConfig struct {
// Name is the form-field name (required).
Name string
// Label is the accessible label (required).
Label string
// Value is the initial value.
Value string
// Placeholder renders the native placeholder.
Placeholder string
// Rows is the initial visible row count. Defaults to 3.
Rows int
// Autogrow opts into runtime auto-resize: every input event
// resets the height to scrollHeight so the field always shows all
// content without an internal scrollbar.
Autogrow bool
// Required marks the field required.
Required bool
// Disabled disables interaction.
Disabled bool
// Help renders supporting text under the field.
Help string
// Error overrides Help with an error message + aria-invalid.
Error string
// MaxLength applies the native maxlength attribute.
MaxLength int
ID string
Class string
// ExtraAttrs forwards additional attributes to the <textarea>
// element. Keys the component owns are dropped: class and id (use
// Class / ID), data-fui-* (incl. the autogrow wiring), name, rows,
// placeholder, disabled, required, maxlength, aria-invalid, and
// aria-describedby.
ExtraAttrs html.Attrs
}
TextAreaConfig configures a TextArea.
type TextFieldConfig ¶ added in v0.41.0
type TextFieldConfig struct {
Name string
Label string
ID string
Value string
Placeholder string
AutoComplete string
Help string
Error string
Class string
Required bool
Disabled bool
MinLength int
MaxLength int
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, pattern and title) onto the field's <input>.
// Keys the input owns are dropped: class and id (use ID),
// data-fui-*, type, name, value, placeholder, autocomplete,
// minlength, maxlength, required, disabled, aria-invalid, and
// aria-describedby.
ExtraAttrs html.Attrs
}
TextFieldConfig configures a labelled native text field. The wrapper owns label association, help/error ARIA wiring, and the common typed attributes; for the input types this field does not name (email, password, datetime-local, file, tel, url, search) use ui.Control inside a FormField builder.
type ThemeToggleConfig ¶
type ThemeToggleConfig struct {
// Variant selects the visual style.
// Defaults to ThemeToggleIcon when empty.
Variant ThemeToggleVariant
// ID is an optional id for the root element.
ID string
// Class is an optional extra CSS class.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the toggle's root element, whichever
// shape it takes (<button> for icon/label, <div> for pill). Keys
// the component owns are dropped: class and id (use Class / ID),
// data-fui-* (the colorscheme runtime wiring), type, role, and
// aria-label (i18n-resolved).
ExtraAttrs html.Attrs
// LightLabel overrides the light-mode label for label/pill variants.
// Defaults to "Light".
LightLabel string
// DarkLabel overrides the dark-mode label for label/pill variants.
// Defaults to "Dark".
DarkLabel string
// AutoLabel overrides the auto-mode label for pill variant.
// Defaults to "Auto".
AutoLabel string
// Ctx carries the per-request context used to resolve the light/dark/
// auto labels and aria-labels. When nil, English fallbacks apply.
Ctx context.Context
}
ThemeToggleConfig configures a dark/light mode toggle button.
The toggle writes to localStorage["gofastr.colorScheme"] via the existing colorscheme.js bootstrap, which applies the change immediately. No page reload needed.
The component emits the data-hui-theme-toggle / -option / -cycle hooks so the headless-navigation module can attach the click logic via event delegation.
type ThemeToggleVariant ¶
type ThemeToggleVariant string
ThemeToggleVariant selects the visual variant of the toggle button.
const ( // ThemeToggleIcon renders a sun/moon icon button. ThemeToggleIcon ThemeToggleVariant = "icon" // ThemeToggleLabel renders a text button ("Light" / "Dark"). ThemeToggleLabel ThemeToggleVariant = "label" // ThemeTogglePill renders a segmented pill with light/auto/dark. ThemeTogglePill ThemeToggleVariant = "pill" )
type TimePickerConfig ¶
type TimePickerConfig struct {
// Name is the form field name (required).
Name string
// Label is the accessible label (required).
Label string
// Value is the initial value in HH:MM (24-hour) format. Empty
// means no preselection.
Value string
// Min / Max bound the picker (e.g. "09:00", "17:00"). Empty
// leaves them unset.
Min string
Max string
Step int // step in seconds (default = 60). 1 → seconds visible.
// Required marks the input required.
Required bool
// Disabled disables interaction.
Disabled bool
// Help renders supporting text under the picker.
Help string
// Error overrides Help with an error message + aria-invalid.
Error string
ID string
Class string
// ExtraAttrs forwards additional attributes to the input element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and every data-hui-* hook.
ExtraAttrs html.Attrs
}
TimePickerConfig configures a TimePicker.
type TimelineConfig ¶
type TimelineConfig struct {
Events []TimelineEvent
ID string
Class string
// ExtraAttrs forwards additional attributes to the <ol> root.
// Keys the component owns are dropped: class and id (use Class /
// ID), style and data-fui-*.
ExtraAttrs html.Attrs
}
TimelineConfig configures a Timeline.
type TimelineEvent ¶
type TimelineEvent struct {
// Title is the event headline (required, e.g. "Deployed v3.2.1").
Title string
// Meta is the optional right-aligned secondary text (e.g. a time
// or actor: "2h ago" / "by dom"), rendered in the header row
// after the title.
Meta string
// Body is the optional supporting prose / nested HTML.
Body render.HTML
// Variant tints the dot on the rail. Defaults to neutral.
Variant TimelineEventVariant
}
TimelineEvent is one entry in the Timeline.
type TimelineEventVariant ¶
type TimelineEventVariant string
TimelineEventVariant colors the dot on the rail.
const ( TimelineNeutral TimelineEventVariant = "" TimelineSuccess TimelineEventVariant = "success" TimelineWarn TimelineEventVariant = "warn" TimelineDanger TimelineEventVariant = "danger" TimelineInfo TimelineEventVariant = "info" )
type ToastTrigger ¶
type ToastTrigger struct {
Variant StatusVariant `json:"variant,omitempty"` // info | success | warning | danger | neutral
Title string `json:"title"` // required
Body string `json:"body,omitempty"`
TTL int `json:"ttl,omitempty"` // milliseconds; 0 = persistent
// Stack is the name of the toast stack widget to push into.
// Defaults to the first stack mounted on the page. Set explicitly
// when an app hosts multiple stacks (e.g. per-tenant).
Stack string `json:"stack,omitempty"`
}
ToastTrigger is the JSON shape carried by the X-Gofastr-Toast header, and the same shape accepted by __gofastr.toast(cfg) on the client. Field names match the runtime template; keep both in sync when extending.
type ToggleActionConfig ¶ added in v0.13.0
type ToggleActionConfig struct {
// Endpoint is the URL hit when toggling idle → committed. Required.
Endpoint string
// Method is "POST" (default), "DELETE", "PATCH", or "PUT". Applies
// to both the commit and the untoggle request.
Method string
// IdleLabel is the button text in the un-committed state. Required.
IdleLabel string
// CommittedLabel is shown while committed (the runtime flips to it
// optimistically on click). Required.
CommittedLabel string
// IdleIcon optionally renders alongside IdleLabel.
IdleIcon render.HTML
// CommittedIcon optionally renders alongside CommittedLabel.
CommittedIcon render.HTML
// Committed sets the SSR initial state. Render true when the
// server already knows the action is active (user follows, plan
// selected) so first paint matches server state.
Committed bool
// Group, when set, joins this button to a client-side mutex:
// committing any button with the same Group key reverts the
// previously-committed sibling. Maps to data-hui-action-group.
Group string
// AllowUntoggle lets a click on a committed button revert it to
// idle. Maps to the data-hui-action-untoggle hook (empty for a
// local flip, the untoggle endpoint's URL when one is set).
AllowUntoggle bool
// UntoggleEndpoint is the URL hit when reverting committed → idle.
// Setting it implies AllowUntoggle. When empty (with AllowUntoggle
// true) the revert flips locally with no request.
UntoggleEndpoint string
// Variant maps to the standard Button variant ("primary"/""
// default, "secondary", "danger", "ghost").
Variant ButtonVariant
// Size maps to the standard Button size ("" default, "small",
// "large").
Size ButtonSize
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the button's root <button> element. Keys
// the component owns are dropped: class and id (use Class / ID),
// data-fui-* (the toggle runtime wiring), type, data-state, and
// aria-pressed (mirrored from Committed by the runtime).
ExtraAttrs html.Attrs
// FailedText is what the status span announces on a failure.
// Empty takes the Strings default.
FailedText string
// Ctx carries the per-request context used to resolve the
// failure sentence. When nil, English fallbacks apply.
Ctx context.Context
// Disabled is the state at render time.
Disabled bool
}
ToggleActionConfig configures a ToggleAction button.
type ToggleConfig ¶
type ToggleConfig struct {
// Name is the form-field name. Required.
Name string
// Label is the visible label text shown next to the control.
// Required for accessibility.
Label string
// ID is the input element's id. When empty, defaults to Name
// (Checkbox/Switch, one per name) or Name-slug(Value) (Radio, so
// each input in a group gets a distinct id and no two labels
// point at the same control).
ID string
// Value is the form-submit value (for checkboxes / radios sharing
// a Name). Defaults to "on" for Checkbox/Switch, required for
// Radio when several share a Name.
Value string
// Checked is the initial selected state.
Checked bool
// Disabled disables interaction.
Disabled bool
// Required marks the control as required in form submission.
Required bool
// Help renders supporting text inside the row, under the label
// text (Checkbox/Radio) or under the run (Switch, whose headless
// structure carries no hint part).
Help string
// Error replaces Help (either/or, the family's shape), marks the
// input aria-invalid and wires its message by id. Prefer the
// enclosing FormField's Error or the group's: an error is the
// field's verdict, not the choice's.
Error string
// ExtraAttrs forwards additional attributes to the control's
// <input> element — the control that submits. Keys the component
// owns are dropped (type, name, id, value and the state
// attributes, plus every data-fui-* and data-hui-* key); the
// label that wraps the control offers no attribute seam of its
// own, so what rides here rides on the input.
ExtraAttrs html.Attrs
Class string
}
ToggleConfig configures a Checkbox/Radio/Switch.
type ToolbarConfig ¶
type ToolbarConfig struct {
// Label is the accessible name for the toolbar (required,
// becomes aria-label).
Label string
// Groups are rendered in order with separators between.
Groups []ToolbarGroup
// Align picks justify-content. Default is "start". Options:
// "start", "center", "end", "between".
Align string
ID string
Class string
// Plain removes the frame and padding when placed in existing chrome.
Plain bool
// ExtraAttrs forwards additional attributes to the root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, role, and aria-label (use Label).
ExtraAttrs html.Attrs
}
ToolbarConfig configures a Toolbar.
type ToolbarGroup ¶
type ToolbarGroup struct {
// Label is the accessible group name (optional). When set the
// group renders with role="group" + aria-label.
Label string
// Children are the actual button/link elements. The caller
// decides what goes in: Button, Link, IconButton, etc.
Children []render.HTML
}
ToolbarGroup is a logical group of buttons inside a toolbar. Groups are rendered side-by-side with a visual separator between.
type TooltipConfig ¶
type TooltipConfig struct {
// Text is the tooltip message. Required.
Text string
// Placement selects the side. Default top.
Placement TooltipPlacement
// ID is the tooltip's id; the trigger's aria-describedby points
// to it. When empty, a stable id is derived from the trigger's
// content position.
ID string
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers, ARIA overrides) to the tooltip's root
// wrapper <span>. Keys the component owns are dropped: class
// and id (use Class / ID), data-fui-*.
ExtraAttrs html.Attrs
}
TooltipConfig configures a tooltip.
type TooltipPlacement ¶
type TooltipPlacement string
TooltipPlacement selects the side the tooltip appears on.
const ( TooltipTop TooltipPlacement = "" // default TooltipBottom TooltipPlacement = "bottom" TooltipLeft TooltipPlacement = "left" TooltipRight TooltipPlacement = "right" )
type TreeConfig ¶ added in v0.86.0
type TreeConfig struct {
// Label is the aria-label on the role="tree" wrapper. Required.
Label string
// Items are the root-level entries. Required.
Items []TreeItem
// LazySignalPrefix names the signal namespace lazy branches bind
// their child groups to. Required when any item uses LazyPath.
LazySignalPrefix string
ID string
Class string
// ExtraAttrs forwards additional attributes to the wrapper. Keys
// the component owns are dropped: class and id (use Class / ID)
// and aria-label (use Label).
ExtraAttrs html.Attrs
}
TreeConfig configures a tree.
type TreeItem ¶ added in v0.86.0
TreeItem is one entry in the tree. It is headless.TreeNode spelled for this package's config-struct callers.
type TrendDirection ¶
type TrendDirection string
TrendDirection indicates the direction of a stat trend.
const ( TrendUp TrendDirection = "up" TrendDown TrendDirection = "down" TrendFlat TrendDirection = "flat" )
type ValidationSummaryConfig ¶
type ValidationSummaryConfig struct {
// ID names the summary's root. Required: the title's id is derived
// from it, and two summaries on one page without ids would share
// one title id — breaking both labels and both announcements.
ID string
// Errors maps field names to error messages. Required together
// with General for anything to render.
Errors FieldErrors
// General is a sentence that belongs to no one field (a general
// failure, a credentials mismatch). It renders as a text row,
// after the field errors: text rather than a link to nothing.
General string
// FieldLabels maps field names to human-readable labels. The link
// text is "<label>: <message>"; falls back to the field name.
FieldLabels map[string]string
// FieldIDs maps field names to actual control element IDs. When
// the map is non-nil and a field is missing from it, the error
// renders as text — a link to #email misses a control whose id is
// f_email. When the map is nil, the field name itself is the
// target (the typed fields' default: an un-set ID is the Name).
FieldIDs map[string]string
// FieldOrder controls the order of error rows. Entries that aren't
// in Errors are silently skipped, so it's safe to pass the full
// form field list. Without FieldOrder, rows fall back to
// alphabetical-by-field-name so the rendered HTML is deterministic
// across requests (Go map iteration is randomized).
FieldOrder []string
// Title overrides the default heading. Empty → "Please fix the
// following errors:".
Title string
// Class adds extra CSS classes to the wrapper.
Class string
// ExtraAttrs forwards additional attributes (data-* test hooks,
// analytics markers) to the summary's root. Keys the component
// owns are dropped: class and id (use Class / ID), data-fui-*,
// role, tabindex and aria-labelledby.
ExtraAttrs html.Attrs
// Ctx carries the per-request context used to resolve the i18n
// title. When nil, English fallbacks apply.
Ctx context.Context
}
ValidationSummaryConfig configures a ValidationSummary.
type VariantCSS ¶ added in v0.13.0
type VariantCSS struct {
// Props is the variant's base-state declarations. Required.
Props []string
// Hover is emitted under :hover. Optional. Note the component base
// sheet may apply its own hover treatment (Button dims via
// `filter: brightness(0.95)`). Include "filter", "none" to replace
// it rather than stack on it.
Hover []string
// Focus is emitted under :focus-visible. Optional; without it the
// component's default focus ring applies.
Focus []string
}
VariantCSS declares the look of a registered custom variant as flat property/value pairs, the same shape style.StyleSheet.Set takes:
ui.VariantCSS{
Props: []string{"background", "{colors.primary}", "color", "#fff"},
Hover: []string{"filter", "none", "opacity", "0.9"},
}
Values may reference theme tokens: "{colors.primary}" resolves to "var(--color-primary)", so registered variants re-skin with the theme like every other component. Button rules are emitted as plain `.fui-button--<name>` class rules, appended after the sheet's built-ins, so Props override the default look by source order without !important; card rules stay marker-scoped (`[data-fui-comp="ui-card"].fui-card--<name>`).
type WidgetMounter ¶
type WidgetMounter interface {
MountWidget(def *widget.Definition)
}
WidgetMounter is the minimal contract for hosting a widget on a router. Apps adapt the framework's *router.Router with a three-line shim (wiring is intentionally pluggable so this package stays router-agnostic):
type routerMounter struct{ r *router.Router }
func (m routerMounter) MountWidget(def *widget.Definition) {
widget.Mount(m.r, def)
}
ui.MountSidebar(routerMounter{app.Router()}, sidebarCfg)
type WorkbenchConfig ¶ added in v0.49.0
type WorkbenchConfig struct {
// RailWidth overrides the rail's fixed inline size. One plain CSS
// length (number + unit, e.g. "480px", or a var(--token)
// reference); anything else drops the custom property and the CSS
// default applies. Defaults to 320px, which fits a label above a
// control comfortably.
RailWidth string
// Rail is the left column. It scrolls independently of the pane, so a
// long control list never pushes the pane off screen.
Rail render.HTML
// Pane is the right column. It fills the remaining space in both axes:
// an <iframe> placed directly inside fills it edge to edge, which is the
// case that motivated the component.
Pane render.HTML
ID string
Class string
// ExtraAttrs forwards additional attributes to the root element.
// Keys the component owns are dropped: class and id (use Class /
// ID), data-fui-*, and style (RailWidth owns the inline custom
// property).
ExtraAttrs html.Attrs
}
WorkbenchConfig configures a Workbench.
Source Files
¶
- agents.go
- anchored_rail.go
- animatedcounter.go
- auth_card.go
- avatargroup.go
- backtotop.go
- banner.go
- barchart.go
- breadcrumbs.go
- card.go
- carousel.go
- chart_empty.go
- codetabs.go
- collapsible.go
- colorfield.go
- colorpicker.go
- combobox.go
- commandpalette.go
- componentoptions.go
- components.go
- conditionalfield.go
- confirmaction.go
- container.go
- content_row.go
- control.go
- copybutton.go
- counter.go
- datatable.go
- detail_list.go
- diffviewer.go
- divider.go
- doc.go
- dropzone.go
- fact_box.go
- fileupload.go
- filterchipbar.go
- filtertoolbar.go
- form.go
- form_fields.go
- form_inputs.go
- formrepeater.go
- gallery.go
- globalsearch.go
- helpers.go
- hero.go
- hero_split.go
- highlight.go
- icon.go
- image.go
- image_placeholder.go
- inputgroup.go
- jsonviewer.go
- layout.go
- lightbox.go
- linechart.go
- link.go
- list_detail.go
- markdown.go
- menu.go
- multiselect.go
- muted.go
- networkretrybanner.go
- notification.go
- notificationbell.go
- numberinput.go
- optimisticaction.go
- pagination.go
- panehost.go
- passwordinput.go
- piechart.go
- pipeline_image.go
- pollingindicator.go
- pricing.go
- progress.go
- progresssteps.go
- rangeslider.go
- rating.go
- record_summary.go
- repeater.go
- responsive.go
- safety.go
- screen_cache.go
- searchinput.go
- segmented.go
- select.go
- shortcuthint.go
- sidebar.go
- sign_out.go
- signal_toggle.go
- skeletonpresets.go
- slider.go
- sortablelist.go
- sparkline.go
- spinner.go
- status_pill.go
- step_rail.go
- stepwizard.go
- strings.go
- styles_anchored_rail.go
- styles_components.go
- styles_pageheader.go
- styles_primitives.go
- tabs.go
- tag.go
- taginput.go
- terminal_block.go
- textarea.go
- themed.go
- themetoggle.go
- timeline.go
- timepicker.go
- toast.go
- toc.go
- toggle.go
- toggleaction.go
- toolbar.go
- tooltip.go
- tree.go
- variants.go
- workbench.go
Directories
¶
| Path | Synopsis |
|---|---|
|
Package resource renders CRUD-backed list, detail, and form screens from Config.
|
Package resource renders CRUD-backed list, detail, and form screens from Config. |
|
Package theme is the canonical home for the framework's visual design system.
|
Package theme is the canonical home for the framework's visual design system. |