components

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Sep 3, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package web renders pk-ui component contracts to HTML with gomponents, styled entirely through tw class lists against the PlatformKit design system's role variables.

Every renderer follows the same contract:

  • Props in, gomponents Node out — no hidden state, no template files.
  • Styling comes only from tw ClassLists declared in classlists.go, so an application derives its stylesheet with tw/emission.For(web.ClassLists()...) instead of scanning source. If a renderer used a class its list does not declare, TestRenderedClassesAreDeclared fails.
  • Accessibility is by construction: labels are associated, icons are hidden from assistive tech, and states carry their ARIA attributes.

The set implemented here is the working subset the PlatformKit admin and module pages compose. Contracts without a renderer yet are listed in Unimplemented, and the completeness test keeps that list honest — removing an entry without adding the renderer fails.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Alert

func Alert(p AlertProps) g.Node

Alert renders AlertProps with role="alert" for danger/warning and role="status" otherwise, so severity maps to interruption behavior.

func Badge

func Badge(p BadgeProps) g.Node

Badge renders BadgeProps without adornment slots.

func BadgeWithSlots

func BadgeWithSlots(p BadgeProps, slots BadgeSlots) g.Node

BadgeWithSlots renders a badge with optional leading and trailing content.

func Breadcrumb(p BreadcrumbProps) g.Node

Breadcrumb renders BreadcrumbProps as an aria-labelled trail; the current page is text, not a link, and carries aria-current.

func Button

func Button(p ButtonProps) g.Node

Button renders ButtonProps without trusted Go-composed slots.

func ButtonWithSlots

func ButtonWithSlots(p ButtonProps, slots ButtonSlots) g.Node

ButtonWithSlots renders a native button or, when Href is set, an anchor with button styling and link semantics. The two modes intentionally share one appearance, accessibility, HTMX, and state implementation.

func Card

func Card(p CardProps, children ...g.Node) g.Node

Card renders free-form card children. Call CardWithSlots when header, content, and footer need the canonical section treatment.

func CardWithSlots

func CardWithSlots(p CardProps, slots CardSlots) g.Node

CardWithSlots renders canonical header/content/footer regions without a downstream wrapper or style implementation.

func Checkbox

func Checkbox(p CheckboxProps) g.Node

Checkbox renders CheckboxProps as a labelled native checkbox with a token-owned indicator. The native control remains in the accessibility tree; the shared checkbox controller only synchronizes indeterminate state and the visual projection because HTML has no declarative indeterminate attribute.

func ClassLists

func ClassLists() []style.ClassList

ClassLists is every ClassList the renderers compose, base and variant alike: the shell's and the gallery's together. It is what a completeness check reads — every class any renderer can emit — while an application's stylesheet is composed from the two halves separately. See ShellClassLists.

func ConfirmDialog

func ConfirmDialog(p ConfirmDialogProps) g.Node

ConfirmDialog renders a native <dialog>. Native, so the focus trap, the Escape key, the backdrop and the inertness of the page behind it are the browser's — the controller that opens it is twenty lines and traps nothing.

There is one per page, and the message is written into it at the moment it opens, because a dialog per destructive button is a dialog per row.

func Container

func Container(p ContainerProps, children ...g.Node) g.Node

Container renders ContainerProps: a centered max-width column.

func DetailList

func DetailList(p DetailListProps) g.Node

DetailList renders a governed group of label/value facts as a native description list. SemanticRole is intentionally projected only as a data attribute: it is an adaptive-surface machine key, not an HTML/ARIA role or translated label.

func Divider

func Divider(p DividerProps) g.Node

Divider renders DividerProps as an <hr>, a labelled horizontal separator, or a vertical separator.

func EmptyState

func EmptyState(p EmptyStateProps) g.Node

EmptyState renders EmptyStateProps.

func Flex

func Flex(p FlexProps, children ...g.Node) g.Node

Flex renders FlexProps.

func Form

func Form(p FormProps, children ...g.Node) g.Node

Form renders a POST form as a stack of fields. The method is always post: every write in this application is one, and a form that could GET would be a form that put a password in a URL.

func FormActions

func FormActions(p FormActionsProps, children ...g.Node) g.Node

FormActions renders the row.

func GalleryClassLists

func GalleryClassLists() []style.ClassList

GalleryClassLists are the classes of the components only the gallery page renders: the divider, the empty state, the skeletons, the modal and the tabs. A third of the stylesheet was these, downloaded by every person on every page of an application that renders none of them.

The line is drawn at the component and not at the prop. A component the shell renders keeps every class its props can reach, however unlikely — a class with no rule is unstyled HTML and nothing notices — so what moves here is only what no shell page can produce at all.

func Grid

func Grid(p GridProps, children ...g.Node) g.Node

Grid renders GridProps; Columns outside 1..12 fall back to 1.

func Heading

func Heading(p HeadingProps) g.Node

Heading renders HeadingProps at the given level (clamped 1..6) in the design system's display face.

func Icon

func Icon(p IconProps) g.Node

Icon renders the OSS provider's vector directly into the document. Product and client providers extend the glyph vocabulary behind icon.Resolve while this atom retains sizing, semantic tone, and accessibility ownership.

func Input

func Input(p InputProps) g.Node

Input renders InputProps as a labelled form field. When Error is set the input carries aria-invalid and is described by the error element.

func Label

func Label(p LabelProps) g.Node

Label renders LabelProps; required fields carry a visible marker the screen reader skips (the input's required attribute carries the semantics).

func Link(p LinkProps) g.Node

Link renders LinkProps; external links open safely.

func Modal(p ModalProps) g.Node

Modal renders a portable modal contract.

func ModalCancelButton

func ModalCancelButton(label, class string) g.Node

ModalCancelButton creates a text dismissal action for modal footers.

func ModalCloseButton

func ModalCloseButton(label, class string) g.Node

ModalCloseButton creates the canonical controller-backed icon close action.

func ModalForm

func ModalForm(attrs ...g.Node) g.Node

ModalForm closes its owning modal after a successful HTMX request.

func ModalPanel

func ModalPanel(p ModalProps, body g.Node) g.Node

ModalPanel renders a server-loaded modal panel with one rich body node.

func ModalPanelWithSlots

func ModalPanelWithSlots(p ModalProps, slots ModalSlots) g.Node

ModalPanelWithSlots renders the panel fragment returned by an HTMX endpoint. It is a complete dialog because its deferred parent is only a swap target.

func ModalWithSlots

func ModalWithSlots(p ModalProps, slots ModalSlots) g.Node

ModalWithSlots renders the canonical modal root. Deferred roots deliberately contain no panel: HTMX swaps a ModalPanelWithSlots response into the root and the shared htmx-modal controller opens it after the swap.

func Pagination

func Pagination(p PaginationProps) g.Node

Pagination renders PaginationProps as previous/next plus a sibling window around the current page. Page links append ?page=N to BaseURL; when HTMX props are set they ride along on every link.

func Select

func Select(p SelectProps) g.Node

Select renders SelectProps as a labelled native <select>, styled as an input-family control. A Placeholder renders as an empty leading option so an untouched control has no accidental value; when the field is Required the placeholder is how "nothing chosen yet" stays expressible.

func Shell

func Shell(p ShellProps, slots ShellSlots) g.Node

Shell renders the frame: a skip link, then a row of the sidebar and a column of header, main and footer. The sidebar hides itself below the large breakpoint, so a narrow window is one column and no script decided that.

func ShellClassLists

func ShellClassLists() []style.ClassList

ShellClassLists are the classes every other component can emit — the ones an application's own pages render. ui.Stylesheet is composed from these.

func Sidebar(p SidebarProps) g.Node

Sidebar renders the portable sidebar model.

func SidebarWithSlots

func SidebarWithSlots(p SidebarProps, slots SidebarSlots) g.Node

SidebarWithSlots renders the canonical persistent navigation surface while preserving rich brand and footer composition for trusted Go callers.

func Skeleton

func Skeleton(p SkeletonProps) g.Node

Skeleton renders SkeletonProps. Shapes: "block" (full-width rectangle, the default), "text" (one or more prose lines, last line short), "circle" (avatar-sized disc). Unknown shape or size strings fall back to the defaults, matching the contracts' "data schema, not behavior" stance.

func SkipLink(target, label string) g.Node

SkipLink is the first focusable thing on the page: invisible until it is focused, and then the fastest route past the navigation. It is a component rather than a class string so that its focus treatment is in the stylesheet.

func Spinner

func Spinner(p SpinnerProps) g.Node

Spinner renders SpinnerProps; the label is announced, the rotation is decoration.

func Stack

func Stack(p StackProps, children ...g.Node) g.Node

Stack renders StackProps: a vertical flex column.

func Table

func Table(p TableProps) g.Node

Table renders TableProps. Cell values render via fmt.Sprint; rows are keyed by column order. An empty Rows slice renders EmptyText.

func TableSkeleton

func TableSkeleton(p TableSkeletonProps) g.Node

TableSkeleton renders TableSkeletonProps: the loading rendering of Table, built from Table's own class lists so the swap-in causes no layout shift. Defaults: 4 columns, 3 rows.

func TableWithSlots

func TableWithSlots(p TableProps, slots TableSlots) g.Node

TableWithSlots renders the canonical table while allowing trusted Go composition to project rich cell nodes without creating a second table renderer.

func Tabs

func Tabs(p TabsProps) g.Node

Tabs renders portable navigation tabs. Use TabsWithPanels when each tab owns a panel body on the current page.

func TabsWithPanels

func TabsWithPanels(p TabsProps, tabs ...TabSlot) g.Node

TabsWithPanels is the concise application API for controller-backed tabs.

func TabsWithSlots

func TabsWithSlots(p TabsProps, slots TabsSlots) g.Node

TabsWithSlots renders tabs and their panels from one canonical contract.

func Text

func Text(p TextProps) g.Node

Text renders non-heading body copy with an allow-listed semantic element. Heading levels remain owned by Heading so document hierarchy cannot be smuggled through an untyped tag string.

func Textarea

func Textarea(p TextareaProps) g.Node

Textarea renders TextareaProps as a labelled multi-line field.

func Toolbar

func Toolbar(p ToolbarProps, actions ...g.Node) g.Node

Toolbar renders the row.

Types

type AlertProps

type AlertProps struct {
	ComponentProps

	Message     string `json:"message"`
	Title       string `json:"title,omitempty"`
	Tone        string `json:"tone,omitempty"` // neutral, info, success, warning, danger (default info)
	Dismissible bool   `json:"dismissible,omitempty"`
	Bordered    bool   `json:"bordered,omitempty"`
	Compact     bool   `json:"compact,omitempty"`
}

---- contracts/atoms/alert.go AlertProps defines properties for a persistent inline status message.

type BadgeProps

type BadgeProps struct {
	ComponentProps

	Label       string `json:"label"`
	Variant     string `json:"variant,omitempty"` // primary, secondary, outline
	Tone        string `json:"tone,omitempty"`    // neutral, brand, success, warning, danger, info
	Size        string `json:"size,omitempty"`    // xs, sm, md, lg, xl, 2xl
	Dot         bool   `json:"dot,omitempty"`     // show status dot before the label
	Count       int    `json:"count,omitempty"`   // positive count, visually capped to 99+
	Removable   bool   `json:"removable,omitempty"`
	RemoveLabel string `json:"removeLabel,omitempty"` // localized remove-button label
	Live        bool   `json:"live,omitempty"`        // polite status announcement
}

---- contracts/atoms/badge.go BadgeProps defines the platform-agnostic properties for a Badge component.

type BadgeSlots

type BadgeSlots struct {
	IconStart []g.Node
	IconEnd   []g.Node
}

BadgeSlots carries trusted Go-composed adornments. Portable delivery graphs use the equivalent named iconStart and iconEnd slots.

type BreadcrumbItem struct {
	Label   string `json:"label"`
	Href    string `json:"href,omitempty"` // empty = current page
	Icon    string `json:"icon,omitempty"`
	Current bool   `json:"current,omitempty"`
}

BreadcrumbItem represents a breadcrumb segment.

type BreadcrumbProps struct {
	ComponentProps
	HTMXProps

	Items     []BreadcrumbItem `json:"items"`
	Separator string           `json:"separator,omitempty"` // default "/"
	MaxItems  int              `json:"maxItems,omitempty"`  // collapse middle items
}

BreadcrumbProps defines properties for breadcrumb navigation.

type ButtonProps

type ButtonProps struct {
	ComponentProps
	HTMXProps

	Label     string `json:"label"`
	Href      string `json:"href,omitempty"`    // renders an anchor with button styling when set
	Variant   string `json:"variant,omitempty"` // primary, secondary, outline, ghost, link
	Tone      string `json:"tone,omitempty"`    // neutral, brand, success, warning, danger, info
	Size      string `json:"size,omitempty"`    // xs, sm, md, lg, xl, 2xl
	Type      string `json:"type,omitempty"`    // button, submit, reset
	Loading   bool   `json:"loading,omitempty"`
	FullWidth bool   `json:"fullWidth,omitempty"`
	IconOnly  bool   `json:"iconOnly,omitempty"`
	AriaLabel string `json:"ariaLabel,omitempty"`
}

---- contracts/atoms/button.go ButtonProps defines the platform-agnostic properties for a Button component.

type ButtonSlots

type ButtonSlots struct {
	IconStart []g.Node
	IconEnd   []g.Node
	Content   []g.Node
}

ButtonSlots carries trusted Go-composed content. Portable delivery graphs expose iconStart and iconEnd; Content is reserved for direct composition of compound controls whose accessible name is supplied through props.

type CardProps

type CardProps struct {
	ComponentProps
	HTMXProps

	Title         string `json:"title,omitempty"`
	Description   string `json:"description,omitempty"`
	Image         string `json:"image,omitempty"`
	ImageAlt      string `json:"imageAlt,omitempty"`
	ImagePosition string `json:"imagePosition,omitempty"` // top, bottom, left, right
	Variant       string `json:"variant,omitempty"`       // default, elevated, outlined, plain
	Padding       string `json:"padding,omitempty"`       // none, small, medium, large
	Shadow        string `json:"shadow,omitempty"`        // none, small, medium, large
	Clickable     bool   `json:"clickable,omitempty"`
	Hoverable     bool   `json:"hoverable,omitempty"`
	Href          string `json:"href,omitempty"`
}

CardProps defines platform-agnostic properties for a Card component.

type CardSlots

type CardSlots struct {
	Header  []g.Node
	Content []g.Node
	Footer  []g.Node
}

CardSlots is the trusted Go composition seam for the three structural card regions. Portable title/description/media data remains in CardProps.

type CheckboxProps

type CheckboxProps struct {
	ComponentProps

	Name          string `json:"name"`
	Label         string `json:"label,omitempty"`
	Checked       bool   `json:"checked,omitempty"`
	Indeterminate bool   `json:"indeterminate,omitempty"`
	Value         string `json:"value,omitempty"`
	Required      bool   `json:"required,omitempty"`
	HelpText      string `json:"helpText,omitempty"`
}

---- contracts/atoms/form_controls.go CheckboxProps defines properties for a checkbox input.

type ComponentProps

type ComponentProps struct {
	// ID is supplied by the component-tree transport, not authored as a
	// component property in design manifests or A2UI schemas.
	ID string `json:"id,omitempty" delivery:"internal"`
	// Class is a renderer escape hatch for trusted Go composition. It is not a
	// portable design-system property and is therefore excluded from delivery.
	Class    string `json:"class,omitempty" delivery:"internal"`
	Disabled bool   `json:"disabled,omitempty"`
	Hidden   bool   `json:"hidden,omitempty"`
	// Attrs is restricted to trusted direct-render callers; portable contracts
	// expose explicit typed properties instead of arbitrary HTML attributes.
	Attrs map[string]string `json:"attrs,omitempty" delivery:"internal"`
}

ComponentProps is the base set of properties shared by all components.

type ConfirmDialogProps

type ConfirmDialogProps struct {
	ComponentProps
	Title       string
	AcceptLabel string
	CancelLabel string
}

ConfirmDialogProps is the one dialog on the page that every destructive action is confirmed in.

type ContainerProps

type ContainerProps struct {
	ComponentProps

	MaxWidth string `json:"maxWidth,omitempty"` // sm, md, lg, xl, 2xl, full
	Padding  string `json:"padding,omitempty"`
}

ContainerProps defines properties for a centered container.

type DetailItem

type DetailItem struct {
	Label       string `json:"label"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
	Tone        string `json:"tone,omitempty"` // neutral, brand, success, warning, danger, info
}

DetailItem is one label/value fact in a DetailList.

type DetailListProps

type DetailListProps struct {
	ComponentProps

	Title        string       `json:"title,omitempty"`
	Description  string       `json:"description,omitempty"`
	SemanticRole string       `json:"semanticRole,omitempty"`
	Items        []DetailItem `json:"items"`
}

DetailListProps defines a compact semantic description list. Title and description are visible section copy; SemanticRole is a stable, non-localized machine key that lets adaptive renderers preserve section meaning without interpreting translated labels.

type DividerProps

type DividerProps struct {
	ComponentProps

	Orientation string `json:"orientation,omitempty"` // horizontal, vertical
	Text        string `json:"text,omitempty"`        // optional label (e.g., "OR")
}

DividerProps defines properties for a divider/separator.

type EmptyStateProps

type EmptyStateProps struct {
	ComponentProps

	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Compact     bool   `json:"compact,omitempty"`
	Bordered    bool   `json:"bordered,omitempty"`
}

---- contracts/atoms/empty_state.go EmptyStateProps defines properties for an empty data state placeholder.

type Example

type Example struct {
	// Group is the heading it appears under.
	Group string
	// Name is the component and the variant, "Button / primary".
	Name string
	Node g.Node
}

Example is one entry in the gallery: what it is called and what it renders.

func Gallery() []Example

Gallery is every component this package renders, once each per variant worth distinguishing.

type FlexProps

type FlexProps struct {
	ComponentProps

	Direction string `json:"direction,omitempty"` // row, column
	Wrap      bool   `json:"wrap,omitempty"`
	Gap       string `json:"gap,omitempty"`
	Align     string `json:"align,omitempty"`   // start, center, end, stretch
	Justify   string `json:"justify,omitempty"` // start, center, end, between, around
}

FlexProps defines properties for a flexbox layout.

type FormActionsProps

type FormActionsProps struct{ ComponentProps }

FormActionsProps is the row of buttons at the foot of a form.

type FormProps

type FormProps struct {
	ComponentProps
	HTMXProps
	Action string
	// Label names the form for assistive technology, since a generated form
	// has no visible heading of its own.
	Label string
}

FormProps is a screen's form: where it posts and what it is called.

type GridProps

type GridProps struct {
	ComponentProps

	Columns string `json:"columns,omitempty"` // Tailwind grid-cols value
	Gap     string `json:"gap,omitempty"`
}

---- contracts/layouts/layouts.go GridProps defines properties for a CSS Grid layout.

type HTMXProps

type HTMXProps struct {
	Get         string `json:"hx-get,omitempty"`
	Post        string `json:"hx-post,omitempty"`
	Put         string `json:"hx-put,omitempty"`
	Patch       string `json:"hx-patch,omitempty"`
	Delete      string `json:"hx-delete,omitempty"`
	Target      string `json:"hx-target,omitempty"`
	Swap        string `json:"hx-swap,omitempty"`
	Trigger     string `json:"hx-trigger,omitempty"`
	Include     string `json:"hx-include,omitempty"`
	Confirm     string `json:"hx-confirm,omitempty"`
	Ext         string `json:"hx-ext,omitempty"`
	Indicator   string `json:"hx-indicator,omitempty"`
	DisabledElt string `json:"hx-disabled-elt,omitempty"`
	Vals        string `json:"hx-vals,omitempty"`
	PushURL     string `json:"hx-push-url,omitempty"`
	Select      string `json:"hx-select,omitempty"`
	Boost       bool   `json:"hx-boost,omitempty"`
	Disable     bool   `json:"hx-disable,omitempty"`
}

HTMXProps contains HTMX-specific properties for server-driven interactions.

type HeadingProps

type HeadingProps struct {
	ComponentProps

	Text     string `json:"text"`
	Level    int    `json:"level"`            // 1-6
	Anchor   string `json:"anchor,omitempty"` // optional anchor ID
	Truncate bool   `json:"truncate,omitempty"`
}

HeadingProps defines properties for heading elements (H1-H6).

type IconProps

type IconProps struct {
	ComponentProps

	Name      string `json:"name"`
	Size      string `json:"size,omitempty"`   // xs, sm, md, lg, xl, 2xl
	Tone      string `json:"tone,omitempty"`   // neutral, brand, success, warning, danger, info
	Weight    string `json:"weight,omitempty"` // outline; extension providers may add governed weights
	AriaLabel string `json:"ariaLabel,omitempty"`
}

---- contracts/atoms/visual.go IconProps defines a provider-neutral system glyph.

type InputProps

type InputProps struct {
	ComponentProps
	HTMXProps

	Name string `json:"name"`
	Type string `json:"type,omitempty"` // text, email, password, number, tel, url, search, date, time, file
	// Value is what the control starts with. A file input never carries one:
	// no browser lets a page choose a file for somebody.
	Value        string `json:"value,omitempty"`
	Placeholder  string `json:"placeholder,omitempty"`
	Label        string `json:"label,omitempty"`
	HelpText     string `json:"helpText,omitempty"`
	Error        string `json:"error,omitempty"`
	Invalid      bool   `json:"invalid,omitempty"`
	Required     bool   `json:"required,omitempty"`
	ReadOnly     bool   `json:"readOnly,omitempty"`
	AutoFocus    bool   `json:"autoFocus,omitempty"`
	Min          string `json:"min,omitempty"`
	Max          string `json:"max,omitempty"`
	Step         string `json:"step,omitempty"`
	MinLength    int    `json:"minLength,omitempty"`
	MaxLength    int    `json:"maxLength,omitempty"`
	Pattern      string `json:"pattern,omitempty"`
	Autocomplete string `json:"autocomplete,omitempty"`
	Size         string `json:"size,omitempty"` // sm, md, lg
	Tone         string `json:"tone,omitempty"` // neutral, success, warning, danger
	FullWidth    bool   `json:"fullWidth,omitempty"`

	// Accept and Multiple belong to Type "file" and are ignored elsewhere.
	// Accept is the browser's filter — "image/*", or a comma-separated list of
	// extensions and media types — and it is a courtesy to the person choosing,
	// never a check: what a form actually accepts is decided by whatever reads
	// the upload. Multiple lets them choose more than one.
	Accept   string `json:"accept,omitempty"`
	Multiple bool   `json:"multiple,omitempty"`
}

---- contracts/atoms/input.go InputProps defines the platform-agnostic properties for an Input component.

type LabelProps

type LabelProps struct {
	ComponentProps

	Text     string `json:"text"`
	For      string `json:"for,omitempty"` // associated input ID
	Required bool   `json:"required,omitempty"`
}

LabelProps defines properties for form labels.

type LinkProps

type LinkProps struct {
	ComponentProps
	HTMXProps

	Label    string `json:"label"`
	Href     string `json:"href"`
	External bool   `json:"external,omitempty"` // opens in new tab
	Variant  string `json:"variant,omitempty"`  // primary, secondary, text, underline
	Target   string `json:"target,omitempty"`
	Rel      string `json:"rel,omitempty"`
}

LinkProps defines properties for a hyperlink.

type ModalProps

type ModalProps struct {
	ComponentProps

	Title       string `json:"title,omitempty"`
	Description string `json:"description,omitempty"`
	Body        string `json:"body,omitempty"`
	Footer      string `json:"footer,omitempty"`
	AriaLabel   string `json:"ariaLabel,omitempty"`
	CloseLabel  string `json:"closeLabel,omitempty"`
	Size        string `json:"size,omitempty"` // small, medium, large, xl, full

	// Pointer booleans preserve the intended default-true behavior while still
	// allowing portable clients to explicitly disable an affordance.
	Closable       *bool `json:"closable,omitempty"`
	CloseOnOverlay *bool `json:"closeOnOverlay,omitempty"`
	CloseOnEscape  *bool `json:"closeOnEscape,omitempty"`
	ShowClose      *bool `json:"showClose,omitempty"`
	ShowOverlay    *bool `json:"showOverlay,omitempty"`
	Centered       *bool `json:"centered,omitempty"`
	ClearOnClose   *bool `json:"clearOnClose,omitempty"`
	Open           bool  `json:"open,omitempty"`
	OpenOnSwap     bool  `json:"openOnSwap,omitempty"`
	Deferred       bool  `json:"deferred,omitempty"`
}

ModalProps defines platform-agnostic properties for a Modal component.

type ModalSlots

type ModalSlots struct {
	Header []g.Node
	Body   []g.Node
	Footer []g.Node
}

ModalSlots is the trusted Go composition seam for rich dialog regions. Portable clients use ModalProps body/footer strings; server-rendered Go applications use these slots without recreating modal chrome or behavior.

type PaginationProps

type PaginationProps struct {
	ComponentProps
	HTMXProps

	CurrentPage int `json:"currentPage"`
	TotalPages  int `json:"totalPages"`
	// Siblings is how many pages are shown either side of the current one.
	Siblings int    `json:"siblings,omitempty"`
	BaseURL  string `json:"baseURL,omitempty"`
	// NavigationLabel names this landmark, for a page carrying more than one.
	NavigationLabel string `json:"navigationLabel,omitempty"`
}

PaginationProps defines properties for pagination controls.

type SelectOption

type SelectOption struct {
	Label       string `json:"label"`
	Value       string `json:"value"`
	Description string `json:"description,omitempty"`
	Group       string `json:"group,omitempty"`
	Disabled    bool   `json:"disabled,omitempty"`
}

SelectOption is one choice in a Select.

type SelectProps

type SelectProps struct {
	ComponentProps
	HTMXProps

	Name        string         `json:"name"`
	Label       string         `json:"label,omitempty"`
	Value       string         `json:"value,omitempty"`
	Values      []string       `json:"values,omitempty"`
	Placeholder string         `json:"placeholder,omitempty"` // rendered as a disabled-free empty option
	Options     []SelectOption `json:"options"`
	Required    bool           `json:"required,omitempty"`
	Multiple    bool           `json:"multiple,omitempty"`
	VisibleRows int            `json:"visibleRows,omitempty"`
	FullWidth   bool           `json:"fullWidth,omitempty"`
	HelpText    string         `json:"helpText,omitempty"`
	Error       string         `json:"error,omitempty"`
}

---- contracts/atoms/select.go SelectProps defines platform-agnostic properties for a native single-value Select component. It mirrors InputProps where the concepts overlap so form builders can treat text-like and choice-like fields uniformly.

type ShellProps

type ShellProps struct {
	ComponentProps
	// SkipTarget is the id the skip link jumps to; the main region takes it.
	//
	// There is no SkipLabel beside it. One existed and nothing ever set it: a
	// skip link says "Skip to content" in every application that has one, and a
	// prop nobody writes is a prop every reader of this struct has to rule out.
	SkipTarget string
}

ShellProps is the application frame.

type ShellSlots

type ShellSlots struct {
	Sidebar []g.Node
	Header  []g.Node
	Main    []g.Node
	Footer  []g.Node
}

ShellSlots are the frame's four regions.

type SidebarItem

type SidebarItem struct {
	ID           string            `json:"id,omitempty"`
	Label        string            `json:"label"`
	Href         string            `json:"href,omitempty"`
	Icon         string            `json:"icon,omitempty"`
	Prefix       string            `json:"prefix,omitempty"`
	Badge        string            `json:"badge,omitempty"`
	BadgeVariant string            `json:"badgeVariant,omitempty"`
	Active       bool              `json:"active,omitempty"`
	Disabled     bool              `json:"disabled,omitempty"`
	SearchText   string            `json:"searchText,omitempty"`
	Attrs        map[string]string `json:"-" delivery:"internal"`
	Children     []SidebarItem     `json:"children,omitempty"`
}

SidebarItem represents a sidebar navigation item.

type SidebarProps

type SidebarProps struct {
	ComponentProps

	Items           []SidebarItem    `json:"items,omitempty"`
	Sections        []SidebarSection `json:"sections,omitempty"`
	Current         string           `json:"current,omitempty"`
	Flavor          string           `json:"flavor,omitempty"` // admin, content
	Collapsible     bool             `json:"collapsible,omitempty"`
	Collapsed       bool             `json:"collapsed,omitempty"`
	NavigationLabel string           `json:"navigationLabel,omitempty"`
	BrandLabel      string           `json:"brandLabel,omitempty"`
	BrandHref       string           `json:"brandHref,omitempty"`
}

SidebarProps defines properties for a sidebar navigation.

type SidebarSection

type SidebarSection struct {
	ID         string        `json:"id,omitempty"`
	Label      string        `json:"label,omitempty"`
	Glyph      string        `json:"glyph,omitempty"`
	Tone       string        `json:"tone,omitempty"` // neutral, brand, success, warning, danger, info
	SearchText string        `json:"searchText,omitempty"`
	Items      []SidebarItem `json:"items,omitempty"`
}

SidebarSection groups related sidebar items under an optional heading.

type SidebarSlots

type SidebarSlots struct {
	Brand  []g.Node
	Items  []g.Node
	Footer []g.Node
}

SidebarSlots carries trusted rich composition around the portable navigation model. Items is a compatibility seam for already-rendered navigation nodes; new portable callers should prefer SidebarProps.Items or Sections.

type SkeletonProps

type SkeletonProps struct {
	ComponentProps

	Shape string `json:"shape,omitempty"` // block, text, circle
	Size  string `json:"size,omitempty"`  // sm, md, lg
	Lines int    `json:"lines,omitempty"` // shape=text: placeholder line count (default 1)
}

---- contracts/atoms/skeleton.go SkeletonProps defines properties for a loading placeholder. A skeleton is the loading rendering of content that has not arrived yet: it holds the geometry of the finished component so the layout does not shift when the real content swaps in.

type SpinnerProps

type SpinnerProps struct {
	ComponentProps

	Label string `json:"label,omitempty"` // sr-only text
	Size  string `json:"size,omitempty"`  // xs, sm, md, lg, xl, 2xl
	Tone  string `json:"tone,omitempty"`  // neutral, brand, success, warning, danger, info (default brand)
}

---- contracts/atoms/feedback.go SpinnerProps defines properties for a loading spinner.

type StackProps

type StackProps struct {
	ComponentProps

	Gap   string `json:"gap,omitempty"`
	Align string `json:"align,omitempty"` // start, center, end, stretch
}

StackProps defines properties for a vertical stack layout.

type TabItem

type TabItem struct {
	Key      string `json:"key"`
	Label    string `json:"label"`
	Icon     string `json:"icon,omitempty"`
	Badge    string `json:"badge,omitempty"`
	Disabled bool   `json:"disabled,omitempty"`
	Content  string `json:"content,omitempty"` // static panel content for direct rendering
	URL      string `json:"url,omitempty"`     // navigation target in item mode
	HxGet    string `json:"hxGet,omitempty"`   // lazy-panel endpoint in panel mode
}

TabItem represents a tab.

type TabSlot

type TabSlot struct {
	ID       string
	Label    string
	Icon     string
	Badge    string
	Disabled bool
	HxGet    string
	Content  []g.Node
}

TabSlot is one trusted Go tab-panel composition. Portable navigation-only tabs remain available through TabsProps.Items; rich panel bodies use this slot rather than a second component implementation.

type TableColumn

type TableColumn struct {
	Key      string `json:"key"`
	Label    string `json:"label"`
	Sortable bool   `json:"sortable,omitempty"`
	Primary  bool   `json:"primary,omitempty"` // emphasized identity cell
	Width    string `json:"width,omitempty"`
	Align    string `json:"align,omitempty"` // left, center, right
}

TableColumn defines a table column.

type TableProps

type TableProps struct {
	ComponentProps
	HTMXProps

	Columns    []TableColumn `json:"columns"`
	Rows       []TableRow    `json:"rows,omitempty"`
	Sortable   bool          `json:"sortable,omitempty"`
	Selectable bool          `json:"selectable,omitempty"`
	Striped    bool          `json:"striped,omitempty"`
	Compact    bool          `json:"compact,omitempty"`
	EmptyText  string        `json:"emptyText,omitempty"`
}

---- contracts/molecules/data.go TableProps defines platform-agnostic properties for a Table component.

type TableRow

type TableRow struct {
	ID    string         `json:"id,omitempty"`
	Cells map[string]any `json:"cells"`
}

TableRow represents a table data row.

type TableSkeletonProps

type TableSkeletonProps struct {
	ComponentProps

	Columns int  `json:"columns,omitempty"` // header/cell count (default 4)
	Rows    int  `json:"rows,omitempty"`    // placeholder row count (default 3)
	Compact bool `json:"compact,omitempty"`
}

---- contracts/molecules/skeleton.go TableSkeletonProps defines the loading rendering of a Table: the same wrap, header, and cell classes with pulsing placeholders where data will land.

type TableSlots

type TableSlots struct {
	Cell             func(TableRow, TableColumn) g.Node
	CellAttrs        func(TableRow, TableColumn) []g.Node
	RowAttrs         func(TableRow) []g.Node
	SortURL          func(TableColumn) string
	SortState        func(TableColumn) string
	SortButtonAttrs  func(TableColumn) []g.Node
	SelectAllLabel   string
	SelectRowLabel   func(TableRow) string
	SelectRowChecked func(TableRow) bool
}

TableSlots is the trusted Go composition seam for rich web cells and server-driven sorting. Portable table data remains in TableProps; callers only opt into these callbacks when a cell needs real markup.

type TabsProps

type TabsProps struct {
	ComponentProps

	Items        []TabItem `json:"items,omitempty"`
	ActiveTab    string    `json:"activeTab,omitempty"`
	Orientation  string    `json:"orientation,omitempty"` // horizontal, vertical
	Variant      string    `json:"variant,omitempty"`     // underline, pills
	HxGet        string    `json:"hxGet,omitempty"`       // default lazy-panel endpoint
	LoadingLabel string    `json:"loadingLabel,omitempty"`
}

---- contracts/molecules/navigation.go TabsProps defines properties for a tabbed interface.

type TabsSlots

type TabsSlots struct {
	Tabs []TabSlot
}

TabsSlots carries the ordered tab panels projected into TabsWithSlots.

type TextProps

type TextProps struct {
	ComponentProps

	Content   string `json:"content"`
	Element   string `json:"element,omitempty"`   // p, span, div, strong, em, small, mark, del, ins, sub, sup, blockquote, code, pre, kbd, samp, var
	Size      string `json:"size,omitempty"`      // xs, sm, base, lg, xl, 2xl, 3xl, 4xl, 5xl
	Align     string `json:"align,omitempty"`     // left, center, right, justify
	Weight    string `json:"weight,omitempty"`    // thin, extralight, light, normal, medium, semibold, bold, extrabold, black
	Color     string `json:"color,omitempty"`     // primary, secondary, tertiary, muted, brand, success, warning, danger, info
	Transform string `json:"transform,omitempty"` // none, uppercase, lowercase, capitalize
	Truncate  bool   `json:"truncate,omitempty"`  // truncate with ellipsis
	NoWrap    bool   `json:"nowrap,omitempty"`
	Italic    bool   `json:"italic,omitempty"`
	Underline bool   `json:"underline,omitempty"`
	Lines     int    `json:"lines,omitempty"` // line clamp, 1-6
}

---- contracts/atoms/text.go TextProps defines the platform-agnostic properties for a Text component.

type TextareaProps

type TextareaProps struct {
	ComponentProps
	HTMXProps

	Name         string `json:"name"`
	Placeholder  string `json:"placeholder,omitempty"`
	Value        string `json:"value,omitempty"`
	Label        string `json:"label,omitempty"`
	HelperText   string `json:"helperText,omitempty"`
	ErrorMessage string `json:"errorMessage,omitempty"`
	Required     bool   `json:"required,omitempty"`
	ReadOnly     bool   `json:"readOnly,omitempty"`
	Rows         int    `json:"rows,omitempty"`
	MinRows      int    `json:"minRows,omitempty"`
	MaxRows      int    `json:"maxRows,omitempty"`
	MinLength    int    `json:"minLength,omitempty"`
	MaxLength    int    `json:"maxLength,omitempty"`
	ShowCount    bool   `json:"showCount,omitempty"`
	AutoResize   bool   `json:"autoResize,omitempty"`
	FullWidth    bool   `json:"fullWidth,omitempty"`
}

---- contracts/atoms/textarea.go TextareaProps defines properties for a multi-line text input.

type ToolbarProps

type ToolbarProps struct {
	ComponentProps
	Title    string
	Subtitle string
}

ToolbarProps is the row above a table: a title on the left, actions on the right, and whatever a screen puts between them.

Jump to

Keyboard shortcuts

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