uiStructural

package
v0.2.5 Latest Latest
Warning

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

Go to latest
Published: Oct 8, 2026 License: MIT Imports: 12 Imported by: 1

README

Structural

Structural layer of Infinite UI. It composes form and display components into page-level structures. Part of Infinite UI.

Card

Surface container with an optional header block and content slots.

@uiStructural.Card(uiStructural.CardSettings{
    MiddleContent: CardBody(),

    // OptionalFields
    HeaderTitle:      "Card Title",
    HeaderSubHeading: "Card sub-heading",
    HeaderIcon:       "ph-cube",
    FooterContent:    CardFooter(),
})
  • MiddleContent is the card body. FooterContent sits below it. HeaderContent replaces the whole header block.
  • The optional header block carries HeaderTitle, HeaderSubHeading, HeaderTitleOneWayStatePath, HeaderSubHeadingOneWayStatePath, HeaderTitleColor, HeaderSubHeadingColor, HeaderSize, and the HeaderIcon* icon controls. ActionsContent puts buttons in the header row, right-aligned.
  • BorderRadius accepts CardBorderRadiusNone through CardBorderRadiusXl; the default is CardBorderRadiusLg. Use CardBorderRadiusNone for square edges.
  • PaddingSize accepts CardPaddingSizeNone through CardPaddingSizeXl; the default is CardPaddingSizeMd.
  • GapSize accepts CardGapSizeNone through CardGapSizeXl; the default is CardGapSizeMd, which renders gap-3 between the header, body, and footer.
  • ShadowSize, RingColor, and RingThickness follow the same token scales as Modal and Alert. BackgroundColor and TextColor take color tokens. TextCase takes a uiToolset.TextCase* value and transforms the header title and sub-heading.

@uiStructural.Carousel slides a window of items inside a server page. The server returns a chunk of items; the window moves inside that chunk. The footer pages the chunk with the same Pagination component the DataTable uses, and the filter bar and search box refresh the chunk from your server.

@uiStructural.Carousel(uiStructural.CarouselSettings[Record]{
    ItemRenderer: func(record Record) templ.Component { return CarouselItem(record) },
    Items:        records,
    QueryUrlTemplate: "/records?page=" + uiStructural.CarouselUrlPlaceholderPageNumber +
        "&itemsPerPage=" + uiStructural.CarouselUrlPlaceholderItemsPerPage,

    // OptionalFields
    ItemsPerView:   uiStructural.CarouselItemsPerViewSettings{Base: 1, Sm: 2, Lg: 3},
    IsSwipeEnabled: true,
})
  • ItemRenderer renders one item. Items holds the chunk the server returned.
  • The carousel owns the item width. Each item fills an equal share of the visible area, so the visible count fits at every window size. Do not set a width on the item component; the carousel overrides it.
  • The visible count follows Tailwind's named breakpoints, mobile-first. ItemsPerView is a CarouselItemsPerViewSettings value: Base is the base (one when unset), and Sm (≥640px), Md (≥768px), Lg (≥1024px), Xl (≥1280px), and TwoXl (≥1536px) each raise the count from their width up. A breakpoint you leave unset inherits the lower one, exactly like a missing md: class. The count is measured against the browser window, the same basis the rest of the library uses.
  • ItemsPerPage and ItemsPerPageSizeChoices page the server chunk. ItemsTotal and PagesTotal feed the footer readout and page count, exactly like DataTable.
  • QueryUrlTemplate uses the same placeholders as DataTable: CarouselUrlPlaceholderPageNumber, CarouselUrlPlaceholderItemsPerPage, and CarouselUrlPlaceholderSearch.
  • Filters renders the shared FilterBar below the track, before the pagination. Filter values append to the URL as key=value pairs; number and date ranges append as keyMin and keyMax. The filter bar stays outside the swapped region, so a refresh cannot steal focus from a field you are typing in.
  • A search box renders centered above the track when the query URL template carries the search placeholder. It carries a magnifier icon and stretches to the available space. Pass SearchBox to replace it. IsSearchBoxCompact fixes the box to a narrow width so SearchBoxAlignment can place it left, center (the default), or right. SearchBoxPosition takes CarouselSearchBoxPositionTop (the default) or CarouselSearchBoxPositionBottom and places the bar above or below the track.
  • IsAutoplay advances the window on a timer. AutoplayIntervalMs sets the interval, 4000 when unset. IsAutoplayPausedOnHover stops the timer while the pointer is over the carousel.
  • IsSwipeEnabled moves the window on a horizontal drag or swipe. The threshold is 40 pixels.
  • IsPaginationHiddenWhenSinglePage hides the page-number controls while every item fits on one page. The readout and the items-per-page selector stay.
  • Surface styling: BackgroundColor, TextColor, BorderRadius (CarouselBorderRadiusNone through CarouselBorderRadiusXl), PaddingSize and ItemPaddingSize (CarouselPaddingSizeNone through CarouselPaddingSizeXl), GapSize (CarouselGapSizeNone through CarouselGapSizeXl), ShadowSize (CarouselShadowSizeNone through CarouselShadowSizeXl), and RingColor with RingThickness (CarouselRingThicknessXs through CarouselRingThicknessXl).
  • Arrow styling: ArrowsPosition (CarouselArrowsPositionOutside, the default, or CarouselArrowsPositionInside to overlay the track), ArrowsShape (CarouselArrowsShapeCircular, the default, CarouselArrowsShapeRounded, or CarouselArrowsShapeSquare), ArrowsSize (CarouselArrowsSizeSm/Md/Lg; the arrow is a fixed-size square, 32 pixels on the default), ArrowsBackgroundColor, and ArrowsIconColor. A custom background still brightens on hover.
  • Dot styling: DotsPosition (CarouselDotsPositionBottom, the default, or CarouselDotsPositionTop), DotsSize (CarouselDotsSizeSm/Md/Lg), DotsActiveColor, and DotsInactiveColor.
  • Item styling: ItemBackgroundColor, ItemBorderRadius (CarouselBorderRadiusNone through CarouselBorderRadiusXl), ItemPaddingSize, ItemRingColor, ItemRingThickness, and ItemShadowSize paint the item wrapper, so a plain renderer still gets a card.
  • EmptyState renders when the chunk holds no items. RefreshOnEvents lists window event names; dispatching one refreshes the carousel.
  • The refresh uses htmx.ajax when HTMX is present and falls back to fetch otherwise, and swaps two regions from one response: the carousel body (data-ui-carousel, holding the arrows, track, and dots) and the pagination (data-ui-carousel-pagination). The response must contain both. The pagination carries an id of the component id plus -pagination, and hx-swap-oob targets that id, so HTMX swaps it out of band into the component that refreshed while the body takes the selected swap, and the root carries hx-sync so a new refresh aborts the one in flight.
  • Client state lives in the component root: pageNumber, itemsPerPage, searchQuery, filterValues, windowStart, itemsPerView, and itemsCount. A failed refresh shows an inline error with a retry button.
  • The arrows carry accessible names, the dots carry aria-label and aria-current, off-window items are set inert so they leave the tab order, and the track is keyboard-operable through the prev and next buttons.
  • Pass state paths, the items-per-view values, filter keys, the query URL template, and the class-attribute inputs (BackgroundColor, TextColor, RingColor, ArrowsBackgroundColor, ArrowsIconColor, DotsActiveColor, DotsInactiveColor, ItemBackgroundColor, ItemRingColor, and FilterDropdownBackgroundColor) from code, never from request data. The component embeds them into client-side expressions and class attributes.

CarouselItemTooltip

Wraps one carousel item and shows a tooltip on hover or on focus inside the item.

templ CarouselItem(record Record) {
    @uiStructural.CarouselItemTooltip(uiStructural.CarouselItemTooltipSettings{
        Content: record.Description,

        // OptionalFields
        Position:      uiToolset.TooltipPositionBottom,
        RingColor:     "secondary-500/40",
        RingThickness: uiStructural.CarouselRingThicknessXs,
    }) {
        <div class="flex h-full flex-col gap-2">
            <span class="font-bold">{ record.Name }</span>
            <p class="text-neutral-400">{ record.Description }</p>
        </div>
    }
}
  • Content is the tooltip text. ContentHtml accepts a component instead. Without both, the wrapper renders the item with no tooltip.
  • Position accepts uiToolset.TooltipPositionTop (the default), uiToolset.TooltipPositionBottom, uiToolset.TooltipPositionLeft, or uiToolset.TooltipPositionRight.
  • BackgroundColor and TextColor take color tokens. The defaults render bg-neutral-800/95 on text-neutral-50.
  • RingColor takes a color token and RingThickness takes the CarouselRingThickness* values. The tooltip ring uses the compact ring scale: xs renders ring-0.5 through xl renders ring-2.5.
  • MinWidthClass, MaxWidthClass, MinHeightClass, and MaxHeightClass cap the tooltip size. A long content wraps at the default max-w-96.
  • The tooltip teleports to the document body with fixed coordinates, so the track viewport, a scroll container, or a modal cannot clip it. Alpine removes the teleported node when the item leaves the DOM, so a refresh does not leak tooltips.

DataTable

@uiStructural.DataTable renders rows from your data and refreshes them from your server. Every sort, page, filter, or search change requests the URL template you provide. The table uses htmx.ajax when HTMX is present and falls back to fetch otherwise.

The component requires a server that answers each request. The static demo serves fixed pages, so sorting, filtering, and search update the request only. Serve it over HTTP; browsers block refresh requests from file:// pages.

@uiStructural.DataTable(uiStructural.DataTableSettings[Record]{
    Columns: columns,
    Rows:    records,
    QueryUrlTemplate: "/records?page=" + uiStructural.DataTableUrlPlaceholderPageNumber +
        "&sort=" + uiStructural.DataTableUrlPlaceholderSortKey +
        "&direction=" + uiStructural.DataTableUrlPlaceholderSortDirection +
        "&search=" + uiStructural.DataTableUrlPlaceholderSearch,

    // OptionalFields
    Filters:              filters,
    RowIdResolver:        func(record Record) string { return record.Id },
    RefreshOnEvents:      []string{"refresh:records-table"},
    InitialSortKey:       "name",
    InitialSortDirection: uiStructural.DataTableSortDirectionAsc,
})

Each column takes a Label, a CellRenderer function, and optional SortKey, Alignment, WidthPercent, width classes, and CellClass. Alignment takes a TextAlignment value: TextAlignmentLeft, TextAlignmentCenter, or TextAlignmentRight. TextCase takes a uiToolset.TextCase* value and transforms the header labels. The default, TextCaseNone, leaves them as typed. Density takes a DataTableDensity value: DataTableDensityComfortable (the default) or DataTableDensityDense. InitialSortDirection takes a DataTableSortDirection value: DataTableSortDirectionAsc or DataTableSortDirectionDesc. ItemsPerPage and each entry in ItemsPerPageSizeChoices are uiStructural.ItemsPerPage values. Set PaginationAriaLabel when a page holds more than one table, so each pagination landmark keeps a unique name.

The Initial* fields seed the client state at render time: InitialFilterValues, InitialSearchQuery, InitialSortKey, and InitialSortDirection. The server renders the matching rows. PageNumber and ItemsPerPage also seed the client, but the component reads them to render the pagination readout. PageNumber is zero-based: the first page is 0, and the zero value is the first page. ShouldUseOneBasedPageDisplay changes only the labels, not the state.

HeaderClass adds classes to the header row, CellClass adds classes to one column's cells, RowClassResolver returns classes for each row from its data, and IsStriped adds a zebra stripe. These classes append to elements that already carry base utilities, so when two utilities set the same property the generated stylesheet order decides the winner, not the field order. A cell component that sets its own color wins over the row color, so use RowClassResolver for cells that leave the color to the row. The header pins to the top of the scroll viewport by default and paints its own background, so a HeaderClass background does not show; set IsHeaderStatic to let it scroll with the body. MinWidthClass and MaxWidthClass cap the table surface width. MinHeightClass and MaxHeightClass cap the scroll viewport height; without them the default cap is max-h-128. MaxVisibleRows measures the header and the tallest data row at runtime and caps the viewport to that many rows, so the body scrolls under the header; it wins over both height classes. The table renders a default search box when the query URL template carries the search placeholder; it carries a magnifier icon and stretches to the available space. Pass SearchBox to replace it. IsSearchBoxCompact fixes the box to a narrow width so SearchBoxAlignment can place it left (the default), center, or right within the toolbar. CheckboxShape accepts uiForm.CheckboxInputShapeSquare (the default), uiForm.CheckboxInputShapeRounded, or uiForm.CheckboxInputShapeCircular; CheckboxSize accepts the uiForm.CheckboxInputSize* values and defaults to the medium size; CheckboxCheckedColor and CheckboxUncheckedColor take a color token and default to secondary-500 and neutral-50/20.

The query URL template uses fixed placeholders. Build it from the DataTableUrlPlaceholder* constants and name the query keys:

QueryUrlTemplate: "/records?page=" + uiStructural.DataTableUrlPlaceholderPageNumber +
    "&size=" + uiStructural.DataTableUrlPlaceholderItemsPerPage +
    "&sort=" + uiStructural.DataTableUrlPlaceholderSortKey +
    "&direction=" + uiStructural.DataTableUrlPlaceholderSortDirection +
    "&q=" + uiStructural.DataTableUrlPlaceholderSearch

DataTableUrlPlaceholderPageNumber emits the zero-based page index, where the first page is 0. APIs that treat the first page as 0 receive the value unchanged.

Filter values append to the URL as key=value pairs. Number and date ranges append as keyMin and keyMax. Empty values are omitted. Set QueryParamName on a filter to send a different query key.

The server response must contain one element with the data-ui-data-table attribute. The component swaps only that element, so the filter bar, search box, and selection stay in place.

Client state lives in the component root: pageNumber, itemsPerPage, sortKey, sortDirection, searchQuery, filterValues, and selectedRowIds. The search box and the bulk action slot bind to those paths.

RefreshOnEvents lists window event names. Dispatching one of them refreshes the table. This matches the form-to-display refresh pattern.

A failed refresh shows an inline error row with a retry button. A refresh in flight dims the table and disables the controls.

Pass filter keys, state paths, the query URL template, and Id from code, never from request data. The component embeds them into client-side expressions and the root id. HeaderClass, CellClass, MinWidthClass, MaxWidthClass, the RowClassResolver result, FilterDropdownBackgroundColor, CheckboxCheckedColor, and CheckboxUncheckedColor become HTML class attributes, so keep untrusted data out of them too.

FilterBar

Standalone filter bar. It renders one editor per declared filter and shows active filters as removable chips.

@uiStructural.FilterBar(uiStructural.FilterBarSettings{
    Filters: []uiStructural.FilterSettings{
        {Key: "name", Label: "Name", Kind: uiStructural.FilterKindTextContains},
        {Key: "status", Label: "Status", Kind: uiStructural.FilterKindEnumSelect, Options: statusOptions},
        {Key: "cpu", Label: "CPU", Kind: uiStructural.FilterKindNumberRange},
    },
    ValuesTwoWayStatePath: "filterValues",

    // OptionalFields
    OnChangeFunc: "refreshTable()",
})
  • Kind accepts FilterKindTextContains, FilterKindEnumSelect, FilterKindMultiEnumSelect, FilterKindNumberRange, or FilterKindDateRange.
  • ValuesTwoWayStatePath names a top-level property on the surrounding Alpine scope, for example filterValues.
  • Enum filters read Options. Multi-enum filters read Options and write an array of selected values under the filter key. Range filters write {min, max} objects under the filter key.
  • A chip appears when its filter holds a value. The chip remove button clears that filter.
  • The clear-all button appears when any filter is active.
  • Set EnumSelectRadioGroupNamePrefix when a page holds more than one filter bar with the same enum keys. The prefix keeps each enum dropdown's radio group name unique. The DataTable prefixes it with the table id.

PageHeading

Page and section headings over display.HeaderBlock. One Level setting picks the variant.

@uiStructural.PageHeading(uiStructural.PageHeadingSettings{
    HeaderTitle: "Records",
    Level:       uiStructural.PageHeadingLevelPage,

    // OptionalFields
    Description:    "Manage the server records",
    HeaderIcon:     "ph-table",
    ActionsContent: PageHeadingActions(),
})
  • Level accepts PageHeadingLevelPage or PageHeadingLevelSection; the default is section.
  • PageHeadingLevelPage renders an h1 with page spacing. HeaderSize defaults to HeaderSizeXl. The icon defaults to a bare secondary-500 glyph.
  • PageHeadingLevelSection renders an h2. HeaderSize defaults to HeaderSizeLg. With an icon set and no overrides, the icon renders in a padded rounded chip.
  • Description fills the line under the title. HeaderSubHeading is the legacy name for the same line.
  • ActionsContent puts buttons in the heading row, right-aligned.
  • HeaderTitle and the description support live text through HeaderTitleOneWayStatePath and HeaderSubHeadingOneWayStatePath.
  • HeaderTitleColor, HeaderSubHeadingColor, and TextColor take color tokens.
  • TextCase takes a uiToolset.TextCase* value and transforms the title and description.
  • The HeaderIcon* fields control the icon: HeaderIconPosition (HeaderIconPositionLeft or HeaderIconPositionTop), HeaderIconColor, HeaderIconBackgroundColor, HeaderIconBorderRadius, and HeaderIconPaddingSize.

Pagination

Page controls with a readout, a page-number strip, and an items-per-page selector.

@uiStructural.Pagination(uiStructural.PaginationSettings{
    PageNumberTwoWayStatePath:   "pageNumber",
    ItemsPerPageTwoWayStatePath: "itemsPerPage",
    ItemsTotal:                  240,

    // OptionalFields
    OnChangeFunc: "requestRefresh()",
})
  • The bound page number is zero-based: the first page is 0. The readout shows the current item range and the total, so it starts at 1.
  • ShouldUseOneBasedPageDisplay labels the strip from 1 while the bound state stays zero-based. The default labels the first page 0.
  • The component derives the page count from ItemsTotal and the bound itemsPerPage, so the strip and the controls react when the items-per-page value changes. PagesTotal is an optional fallback used only when ItemsTotal is zero.
  • The strip shows the first page, the last page, the pages around the current one, and ellipses for gaps. The current page carries aria-current="page".
  • ItemsPerPageSizeChoices overrides the default items-per-page choices.
  • Set ItemsPerPageInputName when a page holds more than one pagination bound to the same state path, so the two items-per-page radio groups stay independent.
  • IsDisabledOneWayStatePath disables every control while the path is truthy.
  • IsHiddenWhenSinglePage hides the page-number controls while every record fits on one page. The readout and the items-per-page select stay visible. DataTable forwards it as IsPaginationHiddenWhenSinglePage.
  • AriaLabel names the navigation landmark. Set a distinct label when a page holds more than one pagination.

Sidebar

Vertical navigation panel. It renders inline or fixed, and it can collapse or slide off canvas.

@uiStructural.Sidebar(uiStructural.SidebarSettings{
    MiddleContent: SidebarNavigation(),

    // OptionalFields
    HeaderContent:                 SidebarHeader(),
    FooterContent:                 SidebarFooter(),
    IsCollapsedTwoWayStatePath:    "isSidebarCollapsed",
    AttachmentMode:                uiStructural.SidebarAttachmentModeInline,
    Side:                          uiStructural.SidebarSideLeft,
})
  • BackgroundColor takes a full Tailwind class, for example "bg-neutral-800/50", unlike the color tokens other components take.
  • AttachmentMode accepts SidebarAttachmentModeInline or SidebarAttachmentModeFixed.
  • IsOffCanvas and IsOffCanvasTwoWayStatePath slide the panel over the content.
  • Width sets the expanded width.
  • Pass state paths from code, never from request data. The component embeds them into client-side expressions.

Tabs

Horizontal and vertical tab headers bound to one selected value. Each tab carries a label, a value, and an optional icon and badge count. The panels switch with Alpine x-show.

@uiStructural.Tabs(uiStructural.TabSettings{
    Items: []uiStructural.TabItemSettings{
        {Label: "General", Value: "general", Icon: "ph-gear", Content: GeneralPanel()},
        {Label: "Security", Value: "security", Icon: "ph-shield-check", BadgeCount: 3, Content: SecurityPanel()},
    },
    SelectedValueTwoWayStatePath: "selectedTab",

    // OptionalFields
    Orientation: uiStructural.TabOrientationVertical,
})
  • SelectedValueTwoWayStatePath names the Alpine property that holds the active tab value. Clicking a tab writes its Value to that path.
  • Seed the bound property with one of the item Values. When no value matches, no tab is active; the first tab stays reachable by keyboard so the group never traps focus.
  • Each item's Content renders in a panel with x-show bound to the selected value. Panels stay in the DOM, so their inputs keep state across switches.
  • Orientation accepts TabOrientationHorizontal (the default) or TabOrientationVertical. The vertical variant lays the tab list as a column beside the panels, for sidebar-style layouts.
  • Side accepts TabSideLeft (the default) or TabSideRight, and only applies with TabOrientationVertical. It places the tab list on the right side of the panels.
  • Alignment accepts TabAlignmentTop (the default), TabAlignmentCenter, or TabAlignmentBottom, and only applies with TabOrientationVertical. It aligns the tab list with the tab content.
  • MaxWidthPercent, MinWidthPercent, MaxHeightPercent, and MinHeightPercent bound the tab list on each axis as whole percentages of the tab area, 1 through 100; 100 renders the full class. MaxWidthClass, MinWidthClass, MaxHeightClass, and MinHeightClass take arbitrary Tailwind classes for the same bounds. MaxVisibleTabs measures the tallest tab at runtime and caps the vertical list to that many tabs; it wins over the height bounds and applies only to the vertical orientation. The horizontal list scrolls on the x axis and the vertical list scrolls on the y axis when the tabs exceed the bounds.
  • Each item's Icon renders a Phosphor icon. IconPosition accepts TabIconPositionLeft (the default) or TabIconPositionTop; the top position stacks the icon above the label.
  • BadgeCount renders a static count on the tab. BadgeCountOneWayStatePath renders a count from Alpine state and hides itself at zero. BadgeBackgroundColor, BadgeTextColor, BadgeRingColor, BadgeRingThickness, and BadgeBorderRadius style the badge; the defaults render a neutral badge.
  • IsUrlHashSynced reads the URL hash on load and on every hash change, and writes the hash on click, so a link to #security opens the Security tab.
  • The component follows the ARIA tabs pattern: role="tablist", role="tab", role="tabpanel", aria-selected, aria-controls, and aria-labelledby. Arrow keys move between tabs, Home and End jump to the ends. Horizontal tabs use Left and Right; vertical tabs use Up and Down.
  • AriaLabel names the tab list. Set a distinct label when a page holds more than one tab group.
  • BackgroundColor takes a color token, for example "neutral-50/5", and paints the tab list. BorderRadius accepts TabBorderRadiusNone through TabBorderRadiusXl (the default is TabBorderRadiusMd) and rounds the tab edges. TextColor takes a color token and tints the unselected tab labels.
  • PaddingSize accepts TabPaddingSizeNone through TabPaddingSizeXl and insets the tab list; the default leaves the list flush. GapSize accepts TabGapSizeNone through TabGapSizeXl and sets the gap between the tabs; the default is TabGapSizeXs.
  • RingColor and RingThickness (TabRingThicknessXs through TabRingThicknessXl) frame the tab list when both are set. ShadowSize accepts TabShadowSizeNone through TabShadowSizeXl.
  • The Content* fields style the panel area: ContentBackgroundColor, ContentPaddingSize, ContentBorderRadius, ContentRingColor, ContentRingThickness, ContentShadowSize, and ContentTextColor. They take the same tokens as the tab list settings. ContentPaddingSize replaces the default inset that separates the content from the tab list; the default leaves the content flush.
  • TextCase takes a uiToolset.TextCase* value and transforms the tab labels.
  • Pass state paths, tab values, and the class-attribute inputs (Icon, BackgroundColor, TextColor, and the Badge* color and ring inputs) from code, never from request data. The component embeds them into client-side expressions and class attributes.

Documentation

Overview

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

templ: version: v0.3.1020

Index

Constants

View Source
const (
	CardBorderRadiusNone string = "none"
	CardBorderRadiusXs   string = "xs"
	CardBorderRadiusSm   string = "sm"
	CardBorderRadiusMd   string = "md"
	CardBorderRadiusLg   string = "lg"
	CardBorderRadiusXl   string = "xl"

	CardShadowSizeNone string = "none"
	CardShadowSizeXs   string = "xs"
	CardShadowSizeSm   string = "sm"
	CardShadowSizeMd   string = "md"
	CardShadowSizeLg   string = "lg"
	CardShadowSizeXl   string = "xl"

	CardRingThicknessXs string = "xs"
	CardRingThicknessSm string = "sm"
	CardRingThicknessMd string = "md"
	CardRingThicknessLg string = "lg"
	CardRingThicknessXl string = "xl"

	CardPaddingSizeNone string = "none"
	CardPaddingSizeXs   string = "xs"
	CardPaddingSizeSm   string = "sm"
	CardPaddingSizeMd   string = "md"
	CardPaddingSizeLg   string = "lg"
	CardPaddingSizeXl   string = "xl"

	CardGapSizeNone string = "none"
	CardGapSizeXs   string = "xs"
	CardGapSizeSm   string = "sm"
	CardGapSizeMd   string = "md"
	CardGapSizeLg   string = "lg"
	CardGapSizeXl   string = "xl"
)
View Source
const (
	CarouselUrlPlaceholderPageNumber   string = DataTableUrlPlaceholderPageNumber
	CarouselUrlPlaceholderItemsPerPage string = DataTableUrlPlaceholderItemsPerPage
	CarouselUrlPlaceholderSearch       string = DataTableUrlPlaceholderSearch

	CarouselArrowsPositionInside  string = "inside"
	CarouselArrowsPositionOutside string = "outside"

	CarouselDotsPositionTop    string = "top"
	CarouselDotsPositionBottom string = "bottom"

	CarouselSearchBoxPositionTop    string = "top"
	CarouselSearchBoxPositionBottom string = "bottom"

	CarouselBorderRadiusNone string = "none"
	CarouselBorderRadiusXs   string = "xs"
	CarouselBorderRadiusSm   string = "sm"
	CarouselBorderRadiusMd   string = "md"
	CarouselBorderRadiusLg   string = "lg"
	CarouselBorderRadiusXl   string = "xl"

	CarouselShadowSizeNone string = "none"
	CarouselShadowSizeXs   string = "xs"
	CarouselShadowSizeSm   string = "sm"
	CarouselShadowSizeMd   string = "md"
	CarouselShadowSizeLg   string = "lg"
	CarouselShadowSizeXl   string = "xl"

	CarouselRingThicknessXs string = "xs"
	CarouselRingThicknessSm string = "sm"
	CarouselRingThicknessMd string = "md"
	CarouselRingThicknessLg string = "lg"
	CarouselRingThicknessXl string = "xl"

	CarouselPaddingSizeNone string = "none"
	CarouselPaddingSizeXs   string = "xs"
	CarouselPaddingSizeSm   string = "sm"
	CarouselPaddingSizeMd   string = "md"
	CarouselPaddingSizeLg   string = "lg"
	CarouselPaddingSizeXl   string = "xl"

	CarouselGapSizeNone string = "none"
	CarouselGapSizeXs   string = "xs"
	CarouselGapSizeSm   string = "sm"
	CarouselGapSizeMd   string = "md"
	CarouselGapSizeLg   string = "lg"
	CarouselGapSizeXl   string = "xl"

	CarouselArrowsSizeSm string = "sm"
	CarouselArrowsSizeMd string = "md"
	CarouselArrowsSizeLg string = "lg"

	CarouselArrowsShapeCircular string = "circular"
	CarouselArrowsShapeRounded  string = "rounded"
	CarouselArrowsShapeSquare   string = "square"

	CarouselDotsSizeSm string = "sm"
	CarouselDotsSizeMd string = "md"
	CarouselDotsSizeLg string = "lg"
)
View Source
const (
	DataTableUrlPlaceholderPageNumber    string = "{pageNumber}"
	DataTableUrlPlaceholderItemsPerPage  string = "{itemsPerPage}"
	DataTableUrlPlaceholderSortKey       string = "{sortKey}"
	DataTableUrlPlaceholderSortDirection string = "{sortDirection}"
	DataTableUrlPlaceholderSearch        string = "{search}"
)
View Source
const (
	FilterKindTextContains    string = "textContains"
	FilterKindEnumSelect      string = "enumSelect"
	FilterKindMultiEnumSelect string = "multiEnumSelect"
	FilterKindNumberRange     string = "numberRange"
	FilterKindDateRange       string = "dateRange"
)
View Source
const (
	PageHeadingLevelPage    string = "page"
	PageHeadingLevelSection string = "section"
)
View Source
const (
	SidebarSideLeft  string = "left"
	SidebarSideRight string = "right"

	SidebarAttachmentModeInline string = "inline"
	SidebarAttachmentModeFixed  string = "fixed"
)
View Source
const (
	TabOrientationHorizontal string = "horizontal"
	TabOrientationVertical   string = "vertical"

	TabSideLeft  string = "left"
	TabSideRight string = "right"

	TabAlignmentTop    string = "top"
	TabAlignmentCenter string = "center"
	TabAlignmentBottom string = "bottom"

	TabBorderRadiusNone string = "none"
	TabBorderRadiusXs   string = "xs"
	TabBorderRadiusSm   string = "sm"
	TabBorderRadiusMd   string = "md"
	TabBorderRadiusLg   string = "lg"
	TabBorderRadiusXl   string = "xl"

	TabGapSizeNone string = "none"
	TabGapSizeXs   string = "xs"
	TabGapSizeSm   string = "sm"
	TabGapSizeMd   string = "md"
	TabGapSizeLg   string = "lg"
	TabGapSizeXl   string = "xl"

	TabIconPositionLeft string = "left"
	TabIconPositionTop  string = "top"

	TabPaddingSizeNone string = "none"
	TabPaddingSizeXs   string = "xs"
	TabPaddingSizeSm   string = "sm"
	TabPaddingSizeMd   string = "md"
	TabPaddingSizeLg   string = "lg"
	TabPaddingSizeXl   string = "xl"

	TabRingThicknessXs string = "xs"
	TabRingThicknessSm string = "sm"
	TabRingThicknessMd string = "md"
	TabRingThicknessLg string = "lg"
	TabRingThicknessXl string = "xl"

	TabShadowSizeNone string = "none"
	TabShadowSizeXs   string = "xs"
	TabShadowSizeSm   string = "sm"
	TabShadowSizeMd   string = "md"
	TabShadowSizeLg   string = "lg"
	TabShadowSizeXl   string = "xl"
)

Variables

This section is empty.

Functions

func Card added in v0.2.2

func Card(componentSettings CardSettings) templ.Component
func Carousel[Item any](componentSettings CarouselSettings[Item]) templ.Component

func CarouselDefaultEmptyState added in v0.2.5

func CarouselDefaultEmptyState() templ.Component

func CarouselDefaultSearchBox added in v0.2.5

func CarouselDefaultSearchBox() templ.Component

func CarouselItemTooltip added in v0.2.5

func CarouselItemTooltip(componentSettings CarouselItemTooltipSettings) templ.Component

func DataTable

func DataTable[Row any](componentSettings DataTableSettings[Row]) templ.Component

func DataTableDefaultEmptyState

func DataTableDefaultEmptyState() templ.Component

func DataTableDefaultSearchBox

func DataTableDefaultSearchBox() templ.Component

func FilterBar

func FilterBar(componentSettings FilterBarSettings) templ.Component

func PageHeading added in v0.2.2

func PageHeading(componentSettings PageHeadingSettings) templ.Component

func Pagination

func Pagination(componentSettings PaginationSettings) templ.Component
func Sidebar(componentSettings SidebarSettings) templ.Component

func Tabs added in v0.2.4

func Tabs(componentSettings TabSettings) templ.Component

Types

type CardSettings added in v0.2.2

type CardSettings struct {
	MiddleContent templ.Component

	// OptionalFields
	ActionsContent                  templ.Component
	BackgroundColor                 string
	BorderRadius                    string
	FooterContent                   templ.Component
	GapSize                         string
	HeaderContent                   templ.Component
	HeaderIcon                      string
	HeaderIconBackgroundColor       string
	HeaderIconBorderRadius          string
	HeaderIconColor                 string
	HeaderIconPaddingSize           string
	HeaderIconPosition              string
	HeaderSize                      string
	HeaderSubHeading                string
	HeaderSubHeadingColor           string
	HeaderSubHeadingOneWayStatePath string
	HeaderTitle                     string
	HeaderTitleColor                string
	HeaderTitleOneWayStatePath      string
	PaddingSize                     string
	RingColor                       string
	RingThickness                   string
	ShadowSize                      string
	TextCase                        string
	TextColor                       string
}

type CarouselItemTooltipSettings added in v0.2.5

type CarouselItemTooltipSettings struct {
	Content string
	// OptionalFields
	BackgroundColor string
	ContentHtml     templ.Component
	Position        string
	RingColor       string
	RingThickness   string
	TextColor       string
	MinWidthClass   string
	MaxWidthClass   string
	MinHeightClass  string
	MaxHeightClass  string
}

type CarouselItemsPerViewSettings added in v0.2.5

type CarouselItemsPerViewSettings struct {
	Base  uint `json:"base"`
	Sm    uint `json:"sm"`
	Md    uint `json:"md"`
	Lg    uint `json:"lg"`
	Xl    uint `json:"xl"`
	TwoXl uint `json:"twoXl"`
}

type CarouselSettings added in v0.2.5

type CarouselSettings[Item any] struct {
	ItemRenderer func(item Item) templ.Component
	Items        []Item

	// OptionalFields
	ArrowsBackgroundColor            string
	ArrowsIconColor                  string
	ArrowsPosition                   string
	ArrowsShape                      string
	ArrowsSize                       string
	AutoplayIntervalMs               uint
	BackgroundColor                  string
	BorderRadius                     string
	DotsActiveColor                  string
	DotsInactiveColor                string
	DotsPosition                     string
	DotsSize                         string
	EmptyState                       templ.Component
	FilterDropdownBackgroundColor    string
	Filters                          []FilterSettings
	GapSize                          string
	Id                               string
	InitialFilterValues              map[string]any
	InitialSearchQuery               string
	IsAutoplay                       bool
	IsAutoplayPausedOnHover          bool
	IsPaginationHiddenWhenSinglePage bool
	IsSearchBoxCompact               bool
	IsSwipeEnabled                   bool
	ItemBackgroundColor              string
	ItemBorderRadius                 string
	ItemPaddingSize                  string
	ItemRingColor                    string
	ItemRingThickness                string
	ItemShadowSize                   string
	ItemsPerPage                     ItemsPerPage
	ItemsPerPageSizeChoices          []ItemsPerPage
	ItemsPerView                     CarouselItemsPerViewSettings
	ItemsTotal                       uint
	PageNumber                       uint
	PaddingSize                      string
	PaginationAriaLabel              string
	PagesTotal                       uint
	QueryUrlTemplate                 string
	RefreshDebounceMs                uint
	RefreshOnEvents                  []string
	RingColor                        string
	RingThickness                    string
	SearchBox                        templ.Component
	SearchBoxAlignment               HorizontalAlignment
	SearchBoxPosition                string
	ShadowSize                       string
	ShouldUseOneBasedPageDisplay     bool
	TextColor                        string
}

type DataTableColumnSettings

type DataTableColumnSettings[Row any] struct {
	Label        string
	CellRenderer func(row Row) templ.Component

	// OptionalFields
	Alignment     TextAlignment
	CellClass     string
	MaxWidthClass string
	MinWidthClass string
	SortKey       string
	WidthPercent  uint8
}

type DataTableDensity

type DataTableDensity string
const (
	DataTableDensityComfortable DataTableDensity = "comfortable"
	DataTableDensityDense       DataTableDensity = "dense"
)

type DataTableSettings

type DataTableSettings[Row any] struct {
	Columns []DataTableColumnSettings[Row]
	Rows    []Row

	// OptionalFields
	BulkActions                      templ.Component
	CheckboxCheckedColor             string
	CheckboxShape                    string
	CheckboxSize                     string
	CheckboxUncheckedColor           string
	Density                          DataTableDensity
	EmptyState                       templ.Component
	FilterDropdownBackgroundColor    string
	Filters                          []FilterSettings
	HeaderActions                    templ.Component
	HeaderClass                      string
	Id                               string
	InitialFilterValues              map[string]any
	InitialSearchQuery               string
	InitialSortDirection             DataTableSortDirection
	InitialSortKey                   string
	IsHeaderStatic                   bool
	IsPaginationHiddenWhenSinglePage bool
	IsSearchBoxCompact               bool
	IsStriped                        bool
	ItemsPerPage                     ItemsPerPage
	ItemsPerPageSizeChoices          []ItemsPerPage
	ItemsTotal                       uint
	MaxHeightClass                   string
	MaxVisibleRows                   uint
	MaxWidthClass                    string
	MinHeightClass                   string
	MinWidthClass                    string
	PageNumber                       uint
	PaginationAriaLabel              string
	PagesTotal                       uint
	QueryUrlTemplate                 string
	RefreshDebounceMs                uint
	RefreshOnEvents                  []string
	RowClassResolver                 func(row Row) string
	RowIdResolver                    func(row Row) string
	RowLabelResolver                 func(row Row) string
	SearchBox                        templ.Component
	SearchBoxAlignment               HorizontalAlignment
	ShouldUseOneBasedPageDisplay     bool
	TextCase                         string
}

type DataTableSortDirection

type DataTableSortDirection string
const (
	DataTableSortDirectionAsc  DataTableSortDirection = "asc"
	DataTableSortDirectionDesc DataTableSortDirection = "desc"
)

type FilterBarSettings

type FilterBarSettings struct {
	Filters               []FilterSettings
	ValuesTwoWayStatePath string

	// OptionalFields
	DropdownBackgroundColor        string
	EnumSelectRadioGroupNamePrefix string
	OnChangeFunc                   string
}

type FilterSettings

type FilterSettings struct {
	Key   string
	Label string
	Kind  string

	// OptionalFields
	Options        []uiForm.SelectLabelValueOption
	QueryParamName string
}

type HorizontalAlignment added in v0.2.5

type HorizontalAlignment string
const (
	HorizontalAlignmentLeft   HorizontalAlignment = "left"
	HorizontalAlignmentCenter HorizontalAlignment = "center"
	HorizontalAlignmentRight  HorizontalAlignment = "right"
)

type ItemsPerPage added in v0.2.5

type ItemsPerPage uint

type PageHeadingSettings added in v0.2.2

type PageHeadingSettings struct {
	HeaderTitle string
	Level       string

	// OptionalFields
	ActionsContent                  templ.Component
	Description                     string
	HeaderIcon                      string
	HeaderIconBackgroundColor       string
	HeaderIconBorderRadius          string
	HeaderIconColor                 string
	HeaderIconPaddingSize           string
	HeaderIconPosition              string
	HeaderSize                      string
	HeaderSubHeading                string
	HeaderSubHeadingColor           string
	HeaderSubHeadingOneWayStatePath string
	HeaderTitleColor                string
	HeaderTitleOneWayStatePath      string
	TextCase                        string
	TextColor                       string
}

type PaginationSettings

type PaginationSettings struct {
	PageNumberTwoWayStatePath   string
	ItemsPerPageTwoWayStatePath string
	ItemsTotal                  uint

	// OptionalFields
	AriaLabel                    string
	IsDisabledOneWayStatePath    string
	IsHiddenWhenSinglePage       bool
	ItemsPerPageInputName        string
	ItemsPerPageSizeChoices      []uint
	OnChangeFunc                 string
	PagesTotal                   uint
	ShouldUseOneBasedPageDisplay bool
}

type SidebarSettings

type SidebarSettings struct {
	MiddleContent templ.Component

	// OptionalFields
	HeaderContent                 templ.Component
	FooterContent                 templ.Component
	Width                         string
	BackgroundColor               string
	IsVisibleTwoWayStatePath      string
	IsCollapsed                   bool
	IsCollapsedTwoWayStatePath    string
	AttachmentMode                string
	AttachmentModeTwoWayStatePath string
	Side                          string
	SideTwoWayStatePath           string
	IsOffCanvas                   bool
	IsOffCanvasTwoWayStatePath    string
}

type TabItemSettings added in v0.2.4

type TabItemSettings struct {
	Label string
	Value string

	// OptionalFields
	BadgeBackgroundColor      string
	BadgeBorderRadius         string
	BadgeCount                uint
	BadgeCountOneWayStatePath string
	BadgeRingColor            string
	BadgeRingThickness        string
	BadgeTextColor            string
	Content                   templ.Component
	Icon                      string
	IconPosition              string
}

type TabSettings added in v0.2.4

type TabSettings struct {
	Items                        []TabItemSettings
	SelectedValueTwoWayStatePath string

	// OptionalFields
	Alignment              string
	AriaLabel              string
	BackgroundColor        string
	BorderRadius           string
	ContentBackgroundColor string
	ContentBorderRadius    string
	ContentPaddingSize     string
	ContentRingColor       string
	ContentRingThickness   string
	ContentShadowSize      string
	ContentTextColor       string
	GapSize                string
	IsUrlHashSynced        bool
	MaxHeightClass         string
	MaxHeightPercent       uint
	MaxWidthClass          string
	MaxWidthPercent        uint
	MaxVisibleTabs         uint
	MinHeightClass         string
	MinHeightPercent       uint
	MinWidthClass          string
	MinWidthPercent        uint
	Orientation            string
	PaddingSize            string
	RingColor              string
	RingThickness          string
	ShadowSize             string
	Side                   string
	TextCase               string
	TextColor              string
}

type TextAlignment added in v0.2.5

type TextAlignment string
const (
	TextAlignmentLeft   TextAlignment = "left"
	TextAlignmentCenter TextAlignment = "center"
	TextAlignmentRight  TextAlignment = "right"
)

Jump to

Keyboard shortcuts

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