Documentation
¶
Overview ¶
Package shorthand provides a mixed-argument companion surface for html.
The parent html package keeps the stable typed builders such as html.Div and html.Button. This package reuses the same option helpers and child normalization, but exposes host-tag functions that accept a single shared argument list of prop options and children:
return shorthand.Div(
shorthand.ClassStr("panel"),
shorthand.H2("Counter"),
shorthand.Button(shorthand.OnClick(increment), "Increment"),
)
Strings and other text-like child values are normalized through html.Text, and option helpers keep the same last-write-wins semantics as html.PropsOf. The supported path for full-struct props is shorthand.FromProps(...), which preserves explicit zero values before later options are applied.
Index ¶
- func A(parseArgs ...any) ui.Node
- func Abbr(parseArgs ...any) ui.Node
- func Article(parseArgs ...any) ui.Node
- func Aside(parseArgs ...any) ui.Node
- func Audio(parseArgs ...any) ui.Node
- func B(parseArgs ...any) ui.Node
- func Blockquote(parseArgs ...any) ui.Node
- func Body(parseArgs ...any) ui.Node
- func Br(parseArgs ...any) ui.Node
- func Button(parseArgs ...any) ui.Node
- func Canvas(parseArgs ...any) ui.Node
- func Caption(parseArgs ...any) ui.Node
- func Children(parseValues ...any) []ui.Node
- func Circle(parseArgs ...any) ui.Node
- func ClassMap(parseValues map[string]bool) string
- func ClassNames(parseParts ...any) string
- func ClipPath(parseArgs ...any) ui.Node
- func Coalesce[T any](parseValues ...*T) *T
- func Code(parseArgs ...any) ui.Node
- func Col(parseArgs ...any) ui.Node
- func Colgroup(parseArgs ...any) ui.Node
- func Cond(parseBranches ...CondBranch) ui.Node
- func Datalist(parseArgs ...any) ui.Node
- func Debounce(parseDelay time.Duration, parseCallback any) any
- func Defer(shown bool, placeholder ui.Node, content func() ui.Node) ui.Node
- func Defs(parseArgs ...any) ui.Node
- func Del(parseArgs ...any) ui.Node
- func Details(parseArgs ...any) ui.Node
- func Dialog(parseArgs ...any) ui.Node
- func Div(parseArgs ...any) ui.Node
- func Ellipse(parseArgs ...any) ui.Node
- func Em(parseArgs ...any) ui.Node
- func Fieldset(parseArgs ...any) ui.Node
- func Figcaption(parseArgs ...any) ui.Node
- func Figure(parseArgs ...any) ui.Node
- func FilterMap[T any](parseItems []T, render func(T) (ui.Node, bool)) []ui.Node
- func FlatMap[T any](parseItems []T, render func(T) []ui.Node) []ui.Node
- func Footer(parseArgs ...any) ui.Node
- func ForeignObject(parseArgs ...any) ui.Node
- func Form(parseArgs ...any) ui.Node
- func Fragment(parseArgs ...any) ui.Node
- func FromProps(parseProps Props) any
- func G(parseArgs ...any) ui.Node
- func GradientStop(parseArgs ...any) ui.Node
- func H1(parseArgs ...any) ui.Node
- func H2(parseArgs ...any) ui.Node
- func H3(parseArgs ...any) ui.Node
- func H4(parseArgs ...any) ui.Node
- func H5(parseArgs ...any) ui.Node
- func H6(parseArgs ...any) ui.Node
- func Head(parseArgs ...any) ui.Node
- func Header(parseArgs ...any) ui.Node
- func HiddenInput(parseName string, parseValue string) ui.Node
- func Hr(parseArgs ...any) ui.Node
- func Html(parseArgs ...any) ui.Node
- func I(parseArgs ...any) ui.Node
- func If(isCondition bool, parseNode ui.Node) ui.Node
- func IfElse(isCondition bool, parseWhenTrue ui.Node, parseWhenFalse ui.Node) ui.Node
- func Iframe(parseArgs ...any) ui.Node
- func Img(parseArgs ...any) ui.Node
- func Index[T any](parseItems []T, render func(parseIndex int, parseItem T) ui.Node) []ui.Node
- func Input(parseArgs ...any) ui.Node
- func Ins(parseArgs ...any) ui.Node
- func Join(parseSeparator ui.Node, parseNodes ...ui.Node) []ui.Node
- func Kbd(parseArgs ...any) ui.Node
- func Label(parseArgs ...any) ui.Node
- func Legend(parseArgs ...any) ui.Node
- func Li(parseArgs ...any) ui.Node
- func Line(parseArgs ...any) ui.Node
- func LinearGradient(parseArgs ...any) ui.Node
- func Main(parseArgs ...any) ui.Node
- func Map[T any](parseItems []T, render func(T) ui.Node) []ui.Node
- func MapIndexed[T any](parseItems []T, render func(parseIndex int, parseItem T) ui.Node) []ui.Node
- func MapKeyed[T any](parseItems []T, parseKey func(T) any, render func(T) ui.Node) []ui.Node
- func MapKeyedComponent[T any](parseItems []T, parseKey func(T) any, render func(T) ui.Node) []ui.Node
- func MapKeyedIndexed[T any](parseItems []T, parseKey func(parseIndex int, parseItem T) any, ...) []ui.Node
- func MapKeyedOr[T any](parseItems []T, parseKey func(T) any, render func(T) ui.Node, ...) ui.Node
- func MapOr[T any](parseItems []T, render func(T) ui.Node, parseFallback ui.Node) ui.Node
- func Mark(parseArgs ...any) ui.Node
- func Markdown(parseSource string, parseOptions ...MarkdownRenderOptions) []ui.Node
- func Marker(parseArgs ...any) ui.Node
- func Mask(parseArgs ...any) ui.Node
- func Maybe[T any](parseValue *T, render func(T) ui.Node) ui.Node
- func MaybeOr[T any](parseValue *T, render func(T) ui.Node, parseFallback ui.Node) ui.Node
- func Meta(parseArgs ...any) ui.Node
- func Meter(parseArgs ...any) ui.Node
- func Nav(parseArgs ...any) ui.Node
- func NoScript(parseArgs ...any) ui.Node
- func Ol(parseArgs ...any) ui.Node
- func Optgroup(parseArgs ...any) ui.Node
- func Option(parseArgs ...any) ui.Node
- func OrElse[T any](parseValue *T, parseFallback T) T
- func Output(parseArgs ...any) ui.Node
- func P(parseArgs ...any) ui.Node
- func Passive(parseCallback any) any
- func Path(parseArgs ...any) ui.Node
- func Picture(parseArgs ...any) ui.Node
- func Polygon(parseArgs ...any) ui.Node
- func Polyline(parseArgs ...any) ui.Node
- func Pre(parseArgs ...any) ui.Node
- func Prevent(parseCallback any) any
- func Progress(parseArgs ...any) ui.Node
- func RadialGradient(parseArgs ...any) ui.Node
- func Range(parseCount int, render func(parseIndex int) ui.Node) []ui.Node
- func RawHTML(parseMarkup string) []ui.Node
- func RawHTMLUnsafe(parseMarkup string) []ui.Node
- func RawHTMLWith(parseMarkup string, parsePolicy sanitize.Policy) []ui.Node
- func Rect(parseArgs ...any) ui.Node
- func Repeat(parseCount int, parseNode ui.Node) []ui.Node
- func Script(parseArgs ...any) ui.Node
- func Section(parseArgs ...any) ui.Node
- func Select(parseArgs ...any) ui.Node
- func Show(isCondition bool, parseNode ui.Node) ui.Node
- func Small(parseArgs ...any) ui.Node
- func Source(parseArgs ...any) ui.Node
- func Span(parseArgs ...any) ui.Node
- func Stop(parseCallback any) any
- func Strong(parseArgs ...any) ui.Node
- func Sub(parseArgs ...any) ui.Node
- func Summary(parseArgs ...any) ui.Node
- func Sup(parseArgs ...any) ui.Node
- func Svg(parseArgs ...any) ui.Node
- func SvgImage(parseArgs ...any) ui.Node
- func SvgPattern(parseArgs ...any) ui.Node
- func Switch(parseValue any, parseBranches ...SwitchBranch) ui.Node
- func Symbol(parseArgs ...any) ui.Node
- func TSpan(parseArgs ...any) ui.Node
- func Table(parseArgs ...any) ui.Node
- func Tag(parseName string, parseArgs ...any) ui.Node
- func Tbody(parseArgs ...any) ui.Node
- func Td(parseArgs ...any) ui.Node
- func Text(parseContent any) ui.Node
- func TextIf(isCondition bool, parseContent any) ui.Node
- func TextLines(parseText string) []ui.Node
- func Textarea(parseArgs ...any) ui.Node
- func Textf(format string, parseArgs ...any) ui.Node
- func Tfoot(parseArgs ...any) ui.Node
- func Th(parseArgs ...any) ui.Node
- func Thead(parseArgs ...any) ui.Node
- func Throttle(parseInterval time.Duration, parseCallback any) any
- func Time(parseArgs ...any) ui.Node
- func Tr(parseArgs ...any) ui.Node
- func Track(parseArgs ...any) ui.Node
- func U(parseArgs ...any) ui.Node
- func Ul(parseArgs ...any) ui.Node
- func Unless(isCondition bool, parseNode ui.Node) ui.Node
- func Use(parseArgs ...any) ui.Node
- func Video(parseArgs ...any) ui.Node
- func When(isCondition bool, parseClassName string) string
- func WithChildren(parseNode ui.Node, parseChildren ...ui.Node) ui.Node
- func WithKey(parseNode ui.Node, parseKey any) ui.Node
- type CondBranch
- type MarkdownRenderOptions
- type NamedSlot
- type PropOption
- func Accept(parseValue string) PropOption
- func Alt(parseValue string) PropOption
- func Aria(parseName string, parseValue string) PropOption
- func AriaSet(parseValues map[string]string) PropOption
- func Attr(parseKey string, parseValue any) PropOption
- func AttrIf(isCondition bool, parseKey string, parseValue any) PropOption
- func Attrs(parseValues map[string]any) PropOption
- func AutoComplete(parseValue string) PropOption
- func AutoFocus(parseValues ...bool) PropOption
- func Bind(parseState ui.State[string]) PropOption
- func BindFunc(parseGet func() string, parseSet func(string)) PropOption
- func BindTo(parseTarget html.Binding) PropOption
- func Checked(parseValues ...bool) PropOption
- func ClassIf(isCondition bool, parseClass string) PropOption
- func ClassStr(parseValue string) PropOption
- func ColSpan(parseValue int) PropOption
- func Cols(parseValue int) PropOption
- func Data(parseName string, parseValue string) PropOption
- func Dataset(parseValues map[string]string) PropOption
- func Dir(parseValue string) PropOption
- func Disabled(parseValues ...bool) PropOption
- func DisabledIf(isCondition bool) PropOption
- func For(parseValue string) PropOption
- func Height(parseValue string) PropOption
- func Hidden(parseValues ...bool) PropOption
- func Href(parseValue string) PropOption
- func ID(parseValue string) PropOption
- func Lang(parseValue string) PropOption
- func Loading(parseValue string) PropOption
- func Max(parseValue string) PropOption
- func MaxLength(parseValue int) PropOption
- func Min(parseValue string) PropOption
- func MinLength(parseValue int) PropOption
- func Multiple(parseValues ...bool) PropOption
- func Name(parseValue string) PropOption
- func OnAnimationEnd(parseCallback any) PropOption
- func OnBlur(parseCallback any) PropOption
- func OnChange(parseCallback any) PropOption
- func OnClick(parseCallback any) PropOption
- func OnClickParallel(parseSlotID string, parseCallback any) PropOption
- func OnContextMenu(parseCallback any) PropOption
- func OnDoubleClick(parseCallback any) PropOption
- func OnDragEnd(parseCallback any) PropOption
- func OnDragOver(parseCallback any) PropOption
- func OnDragStart(parseCallback any) PropOption
- func OnDrop(parseCallback any) PropOption
- func OnError(parseCallback any) PropOption
- func OnFocus(parseCallback any) PropOption
- func OnInput(parseCallback any) PropOption
- func OnKeyDown(parseCallback any) PropOption
- func OnKeyUp(parseCallback any) PropOption
- func OnLoad(parseCallback any) PropOption
- func OnMouseDown(parseCallback any) PropOption
- func OnMouseEnter(parseCallback any) PropOption
- func OnMouseLeave(parseCallback any) PropOption
- func OnMouseUp(parseCallback any) PropOption
- func OnPointerDown(parseCallback any) PropOption
- func OnPointerMove(parseCallback any) PropOption
- func OnPointerUp(parseCallback any) PropOption
- func OnScroll(parseCallback any) PropOption
- func OnSubmit(parseCallback any) PropOption
- func OnTouchEnd(parseCallback any) PropOption
- func OnTouchMove(parseCallback any) PropOption
- func OnTouchStart(parseCallback any) PropOption
- func OnTransitionEnd(parseCallback any) PropOption
- func OnWheel(parseCallback any) PropOption
- func Open(parseValues ...bool) PropOption
- func Pattern(parseValue string) PropOption
- func Placeholder(parseValue string) PropOption
- func ReadOnly(parseValues ...bool) PropOption
- func ReadOnlyIf(isCondition bool) PropOption
- func Ref(parseRef ui.DOMRef) PropOption
- func Rel(parseValue string) PropOption
- func Required(parseValues ...bool) PropOption
- func Role(parseValue string) PropOption
- func RowSpan(parseValue int) PropOption
- func Rows(parseValue int) PropOption
- func Selected(parseValues ...bool) PropOption
- func SelectedIf(isCondition bool) PropOption
- func Src(parseValue string) PropOption
- func Step(parseValue string) PropOption
- func Style(parseValues map[string]string) PropOption
- func StyleIf(isCondition bool, parseValues map[string]string) PropOption
- func StyleVar(parseName string, parseValue string) PropOption
- func TabIndex(parseValue int) PropOption
- func Target(parseValue string) PropOption
- func Title(parseValue string) PropOption
- func Type(parseValue string) PropOption
- func Value(parseValue string) PropOption
- func Width(parseValue string) PropOption
- type Props
- type Slots
- type SwitchBranch
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func Blockquote ¶
Blockquote delegates to html.Blockquote.
func ClassMap ¶
ClassMap delegates to html.ClassMap.
func ClassNames ¶
ClassNames delegates to html.ClassNames.
func Debounce ¶
Debounce delegates to html.Debounce.
func Defer ¶
Defer renders placeholder until shown is true, then builds and renders content. content is a thunk invoked ONLY when shown — so the deferred (often expensive) subtree is never constructed until it is actually needed. This is the rendering half of deferrable views (Angular `@defer` / React lazy): pair shown with a viewport/idle/interaction trigger latched via ui.UseDefer to keep heavy off-screen views out of the render path until they matter.
shorthand.Defer(ui.UseDefer(visible), Spinner(), func() ui.Node { return HeavyChart(data) })
func Figcaption ¶
Figcaption delegates to html.Figcaption.
func FilterMap ¶
FilterMap delegates to html.FilterMap.
func FlatMap ¶
FlatMap delegates to html.FlatMap.
func ForeignObject ¶
ForeignObject is the SVG <foreignObject> element (G8).
func GradientStop ¶
GradientStop is the SVG <stop> gradient color stop. Named GradientStop to avoid colliding with the Stop event-propagation helper (G8).
func HiddenInput ¶
HiddenInput creates a hidden input element with the given name and value, delegating to html.HiddenInput.
func IfElse ¶
IfElse delegates to html.IfElse.
func Index ¶
Index renders a list keyed by POSITION rather than value — Solid's `<Index>`. The node at each slot is reused as that position's value changes (instead of being torn down/rebuilt on reorder), which is the right choice for lists of primitives or inputs where identity follows position, not content. Contrast Map (value order) and MapKeyed (value identity).
func LinearGradient ¶
LinearGradient is the SVG <linearGradient> element (G8).
func MapIndexed ¶
MapIndexed delegates to html.MapIndexed.
func MapKeyed ¶
MapKeyed delegates to html.MapKeyed.
func MapKeyedComponent ¶
func MapKeyedComponent[T any](parseItems []T, parseKey func(T) any, render func(T) ui.Node) []ui.Node
MapKeyedComponent delegates to html.MapKeyedComponent: renders each item as its own keyed component so the render func may use hooks and On* handlers directly (G1).
func MapKeyedIndexed ¶
func MapKeyedIndexed[T any](parseItems []T, parseKey func(parseIndex int, parseItem T) any, render func(parseIndex int, parseItem T) ui.Node) []ui.Node
MapKeyedIndexed delegates to html.MapKeyedIndexed.
func MapKeyedOr ¶
func MapKeyedOr[T any](parseItems []T, parseKey func(T) any, render func(T) ui.Node, parseFallback ui.Node) ui.Node
MapKeyedOr delegates to html.MapKeyedOr.
func MapOr ¶
MapOr delegates to html.MapOr.
func Markdown ¶
func Markdown(parseSource string, parseOptions ...MarkdownRenderOptions) []ui.Node
Markdown delegates to html.Markdown.
func Maybe ¶
Maybe delegates to html.Maybe.
func MaybeOr ¶
MaybeOr delegates to html.MaybeOr.
func RadialGradient ¶
RadialGradient is the SVG <radialGradient> element (G8).
func Range ¶
Range delegates to html.Range.
func RawHTML ¶
RawHTML parses sanitized markup into nodes (safe for untrusted input). Delegates to html.RawHTML.
func RawHTMLUnsafe ¶
RawHTMLUnsafe parses trusted markup without sanitization (still a real node tree, never innerHTML). Delegates to html.RawHTMLUnsafe.
func RawHTMLWith ¶
RawHTMLWith parses markup under a caller-provided sanitize policy.
func Repeat ¶
Repeat delegates to html.Repeat.
func SvgImage ¶
SvgImage is the SVG <image> element (named SvgImage to avoid colliding with a potential HTML image helper) (G8).
func SvgPattern ¶
SvgPattern is the SVG <pattern> element (named SvgPattern to avoid colliding with the Pattern helper) (G8).
func Switch ¶
func Switch(parseValue any, parseBranches ...SwitchBranch) ui.Node
Switch delegates to html.Switch.
func TextIf ¶
TextIf delegates to html.TextIf.
func Throttle ¶
Throttle delegates to html.Throttle.
func Unless ¶
Unless delegates to html.Unless.
func WithChildren ¶
WithChildren delegates to html.WithChildren.
Types ¶
type CondBranch ¶
type CondBranch = html.CondBranch
CondBranch aliases html.CondBranch.
func Match ¶
func Match(isCondition bool, parseNode ui.Node) CondBranch
Match delegates to html.Match.
func Otherwise ¶
func Otherwise(parseNode ui.Node) CondBranch
Otherwise delegates to html.Otherwise.
type MarkdownRenderOptions ¶
type MarkdownRenderOptions = html.MarkdownRenderOptions
MarkdownRenderOptions aliases html.MarkdownRenderOptions.
type NamedSlot ¶
NamedSlot is a group of children tagged with a slot name, produced by Slot and collected into a Slots set.
type PropOption ¶
type PropOption = html.PropOption
func AriaSet ¶
func AriaSet(parseValues map[string]string) PropOption
AriaSet delegates to html.AriaSet.
func AttrIf ¶
func AttrIf(isCondition bool, parseKey string, parseValue any) PropOption
AttrIf delegates to html.AttrIf.
func AutoComplete ¶
func AutoComplete(parseValue string) PropOption
AutoComplete delegates to html.AutoComplete.
func AutoFocus ¶
func AutoFocus(parseValues ...bool) PropOption
AutoFocus delegates to html.AutoFocus.
func Bind ¶
func Bind(parseState ui.State[string]) PropOption
Bind delegates to html.Bind: two-way binds a controlled input to a ui.State[string] in one call (value + oninput).
func BindFunc ¶
func BindFunc(parseGet func() string, parseSet func(string)) PropOption
BindFunc delegates to html.BindFunc: two-way binds an input through an explicit getter and setter, for sources that are not a single handle.
func BindTo ¶
func BindTo(parseTarget html.Binding) PropOption
BindTo delegates to html.BindTo: two-way binds a controlled input to any Get()/Set() string handle — including a state.Signal[string] or atom handle.
func ClassIf ¶
func ClassIf(isCondition bool, parseClass string) PropOption
ClassIf delegates to html.ClassIf.
func Dataset ¶
func Dataset(parseValues map[string]string) PropOption
Dataset delegates to html.Dataset.
func DisabledIf ¶
func DisabledIf(isCondition bool) PropOption
DisabledIf delegates to html.DisabledIf.
func OnAnimationEnd ¶
func OnAnimationEnd(parseCallback any) PropOption
OnAnimationEnd delegates to html.OnAnimationEnd.
func OnClickParallel ¶
func OnClickParallel(parseSlotID string, parseCallback any) PropOption
OnClickParallel delegates to html.OnClickParallel.
func OnContextMenu ¶
func OnContextMenu(parseCallback any) PropOption
OnContextMenu delegates to html.OnContextMenu.
func OnDoubleClick ¶
func OnDoubleClick(parseCallback any) PropOption
OnDoubleClick delegates to html.OnDoubleClick.
func OnDragEnd ¶
func OnDragEnd(parseCallback any) PropOption
OnDragEnd delegates to html.OnDragEnd.
func OnDragOver ¶
func OnDragOver(parseCallback any) PropOption
OnDragOver delegates to html.OnDragOver.
func OnDragStart ¶
func OnDragStart(parseCallback any) PropOption
OnDragStart delegates to html.OnDragStart.
func OnKeyDown ¶
func OnKeyDown(parseCallback any) PropOption
OnKeyDown delegates to html.OnKeyDown.
func OnMouseDown ¶
func OnMouseDown(parseCallback any) PropOption
func OnMouseEnter ¶
func OnMouseEnter(parseCallback any) PropOption
OnMouseEnter delegates to html.OnMouseEnter.
func OnMouseLeave ¶
func OnMouseLeave(parseCallback any) PropOption
OnMouseLeave delegates to html.OnMouseLeave.
func OnMouseUp ¶
func OnMouseUp(parseCallback any) PropOption
OnMouseUp delegates to html.OnMouseUp.
func OnPointerDown ¶
func OnPointerDown(parseCallback any) PropOption
OnPointerDown delegates to html.OnPointerDown.
func OnPointerMove ¶
func OnPointerMove(parseCallback any) PropOption
OnPointerMove delegates to html.OnPointerMove.
func OnPointerUp ¶
func OnPointerUp(parseCallback any) PropOption
OnPointerUp delegates to html.OnPointerUp.
func OnTouchEnd ¶
func OnTouchEnd(parseCallback any) PropOption
OnTouchEnd delegates to html.OnTouchEnd.
func OnTouchMove ¶
func OnTouchMove(parseCallback any) PropOption
OnTouchMove delegates to html.OnTouchMove.
func OnTouchStart ¶
func OnTouchStart(parseCallback any) PropOption
OnTouchStart delegates to html.OnTouchStart.
func OnTransitionEnd ¶
func OnTransitionEnd(parseCallback any) PropOption
OnTransitionEnd delegates to html.OnTransitionEnd.
func Placeholder ¶
func Placeholder(parseValue string) PropOption
Placeholder delegates to html.Placeholder.
func ReadOnlyIf ¶
func ReadOnlyIf(isCondition bool) PropOption
ReadOnlyIf delegates to html.ReadOnlyIf.
func Ref ¶
func Ref(parseRef ui.DOMRef) PropOption
Ref binds a ui.DOMRef to an element so its live DOM node is published into the ref on mount. Delegates to html.Ref.
func SelectedIf ¶
func SelectedIf(isCondition bool) PropOption
SelectedIf delegates to html.SelectedIf.
func StyleIf ¶
func StyleIf(isCondition bool, parseValues map[string]string) PropOption
StyleIf delegates to html.StyleIf.
func StyleVar ¶
func StyleVar(parseName string, parseValue string) PropOption
StyleVar delegates to html.StyleVar.
type Props ¶
func DefaultProps ¶
DefaultProps delegates to html.DefaultProps.
func MergeProps ¶
MergeProps delegates to html.MergeProps.
func WithProps ¶
func WithProps(parseBase Props, parseOptions ...PropOption) Props
WithProps delegates to html.WithProps.
type Slots ¶
Slots is a named collection of child node groups a component renders into labeled regions — explicit, typed named slots (Vue's named slots / React render-children-by-name) without magic. A component takes a Slots in its props and places each region with Render/Or.
func NewSlots ¶
NewSlots collects named slots into a Slots set. A later entry with the same name replaces an earlier one, so callers get last-wins override semantics.
type SwitchBranch ¶
type SwitchBranch = html.SwitchBranch