Learn how to install and use PopUI in your projects.
Welcome to PopUI! This guide will help you get started with installing and using PopUI in your projects.
Installation
To install PopUI, you can use the following command:
go get github.com/invopop/popui/go
App
The main application layout component with header, nav, aside, main,
and footer sections. Use this as the base for all popui applications,
and extend as needed.
Basic App
Simple app with a header, main content area, and footer.
Root application container for full-window apps. Sets up the basic HTML structure with head and body, and includes Alpine.js for interactivity. Designed to be standalone or embedded in the Invopop Console.
Name
Type
Default
Description
Title
string
-
Page title displayed in browser tab
Description
string
-
Meta description for SEO
AccentColor
string
-
Accent color for the application
Head
templ.Component
nil
Additional content to include in the <head> section
Data
string
-
Alpine.js x-data attribute value for the application body's contents
HTMX
bool
false
When true, includes the HTMX javascript library for enhanced interactivity
Scripts
[]props.Script
nil
Additional script paths to include in the head (alternative to defining in Head property)
Stylesheets
[]props.Link
nil
Additional stylesheet links to include in the head (alternative to defining in Head property)
Main
Main content area wrapper for apps. Use this outside Header/Footer components. Contains the primary content and provides overflow handling.
Name
Type
Default
Description
ID
string
-
Unique identifier for the main element
Class
string
-
Additional CSS classes to merge with main styles
Cloak
bool
false
Add x-cloak attribute to hide content until Alpine.js initializes
Data
string
-
Alpine.js x-data attribute value for reactive state
Center
bool
false
Center the main content with a maximum width
Attributes
templ.Attributes
-
Additional HTML attributes
Header
Header area for apps with optional breadcrumb navigation. Use directly inside App component, not inside Main. Sticky positioned at top.
Name
Type
Default
Description
ID
string
-
Unique identifier for the header element
Class
string
-
Additional CSS classes to merge with header styles
Title
templ.Component
nil
Custom title component displayed on the left side of the header before breadcrumbs
Data
string
-
Alpine.js x-data attribute value for reactive state
Attributes
templ.Attributes
-
Additional HTML attributes
Breadcrumbs
[]props.Breadcrumb
nil
Navigation breadcrumbs displayed on the left side of header
Footer
Footer component for apps with content justified to the end. Use directly inside App component, not inside Main.
Name
Type
Default
Description
ID
string
-
Unique identifier for the footer element
Class
string
-
Additional CSS classes to merge with footer styles
Data
string
-
Alpine.js x-data attribute value for reactive state
Attributes
templ.Attributes
-
Additional HTML attributes
Article
Article component for app content with optional full-width mode.
Name
Type
Default
Description
ID
string
-
Unique identifier for the article element
Class
string
-
Additional CSS classes to merge with article styles
FullWidth
bool
false
Makes the article take the full width of the main content area while maintaining padding
Attributes
templ.Attributes
-
Additional HTML attributes
Nav
Navigation component for apps.
Name
Type
Default
Description
ID
string
-
Unique identifier for the nav element
Class
string
-
Additional CSS classes to merge with nav styles
Data
string
-
Alpine.js x-data attribute value for reactive state
Attributes
templ.Attributes
-
Additional HTML attributes
Card
Flexible container components for displaying content in a bordered box.
package examples
import (
popui "github.com/invopop/popui/go"
"github.com/invopop/popui/go/props"
)
templ RadioCardExample() {
<div class="space-y-3">
@popui.Radio(props.Radio{
Name: "plan-card",
Value: "starter",
Label: "Starter",
Description: "Perfect for individuals and small projects.",
Variant: "card",
Checked: true,
})
@popui.Radio(props.Radio{
Name: "plan-card",
Value: "professional",
Label: "Professional",
Description: "Best for growing teams and businesses.",
Variant: "card",
})
@popui.Radio(props.Radio{
Name: "plan-card",
Value: "enterprise",
Label: "Enterprise",
Description: "Custom solutions for large organizations.",
Variant: "card",
})
</div>
}
Theme Variant
Circular color theme selector buttons. Use theme color constants (ColorSherwood, ColorOcean, ColorGrape, ColorMetal, ColorCosmos) as the Variant value.
Use Contenteditable for rich text editing with a div element instead of a textarea. It renders as a contenteditable div that can display formatted content.
This is a contenteditable div. You can use formattedtext and it will render properly.
12345678910111213141516171819202122
package examples
import (
popui "github.com/invopop/popui/go"
"github.com/invopop/popui/go/props"
)
templ TextareaContenteditableExample() {
<div class="space-y-4">
@popui.Textarea(props.Textarea{
Label: "Standard Textarea",
Value: "This is plain text in a textarea element. HTML tags like <strong>bold</strong> are displayed as text.",
Rows: 3,
})
@popui.Contenteditable(props.Textarea{
Label: "Contenteditable Div",
Value: "This is a contenteditable div. You can use <strong>formatted</strong> <em>text</em> and it will render properly.",
Rows: 3,
})
</div>
}
API Reference
Textarea
Multi-line text input field with support for labels and validation.
Name
Type
Default
Description
ID
string
-
Unique identifier for the textarea element
Class
string
-
Additional CSS classes to merge with textarea styles
Attributes
templ.Attributes
-
Additional HTML attributes (data-*, aria-*, etc.)
Name
string
-
Name attribute for form submission
Placeholder
string
-
Placeholder text displayed when textarea is empty
Value
string
-
Initial or current value of the textarea
Label
string
-
Simple label text displayed above the textarea
Rows
int
4
Number of visible text rows
Disabled
bool
false
Disables the textarea
Readonly
bool
false
Makes the textarea read-only
Required
bool
false
Marks the textarea as required for form validation
Autofocus
bool
false
Automatically focuses the textarea on page load
Error
props.Error
-
Error configuration to display validation feedback below the textarea
Error
Error configuration for displaying validation feedback.
Name
Type
Default
Description
Error
error
-
Go error object to display (calls .Error() method)
Text
string
-
Text string to display as error message
Class
string
-
Additional CSS classes to merge with error styles
Attributes
templ.Attributes
-
Additional HTML attributes for the error element
Breadcrumbs
Navigation breadcrumbs to show the current page location.
package examples
import (
popui "github.com/invopop/popui/go"
"github.com/invopop/popui/go/props"
)
templ AccordionExample() {
<div class="w-full space-y-2">
@popui.Accordion(props.Accordion{Open: true}) {
@popui.AccordionTrigger() {
Is it accessible?
}
@popui.AccordionContent() {
@popui.Description() {
Yes. It uses native HTML details/summary elements for full keyboard navigation and screen reader support.
}
}
}
@popui.Accordion() {
@popui.AccordionTrigger() {
Is it styled?
}
@popui.AccordionContent() {
@popui.Description() {
Yes. It comes with default styles using Tailwind CSS that you can customize.
}
}
}
</div>
}
API Reference
Accordion
The main accordion container component using HTML details element.
Name
Type
Default
Description
ID
string
-
Unique identifier for the accordion element
Class
string
-
Additional CSS classes to merge with base styles
Attributes
templ.Attributes
-
Additional HTML attributes to apply to the details element
Open
bool
false
Whether the accordion is initially expanded
AccordionTrigger
Clickable trigger element that toggles the accordion item.
Name
Type
Default
Description
ID
string
-
Unique identifier for the trigger element
Class
string
-
Additional CSS classes to merge with base styles
Attributes
templ.Attributes
-
Additional HTML attributes to apply to the summary element
AccordionContent
Collapsible content area of the accordion item.
Name
Type
Default
Description
ID
string
-
Unique identifier for the content element
Class
string
-
Additional CSS classes to merge with base styles
Attributes
templ.Attributes
-
Additional HTML attributes to apply to the content div
Avatar
Display user profile images or initials in circular containers.
Add pagination controls to your table with TablePagination component. Uses AnchorButton with URLs for navigation and supports custom action buttons via children slot.
A table component with automatic styling for borders, spacing, and typography. The table wrapper provides rounded corners and overflow handling.
Name
Type
Default
Description
ID
string
-
Unique identifier for the table element
Class
string
-
Additional CSS classes to merge with base styles. Use Tailwind's arbitrary variants like [&_tr:hover_td]:bg-gray-100 for advanced styling
Attributes
templ.Attributes
-
Additional HTML attributes to apply to the table element
Variant
string
-
Visual style: 'card' adds outer border and rounded corners
TablePagination
Pagination controls for tables with page navigation, rows per page selector, and total count display. Uses AnchorButton for URL-based navigation. Supports a children slot for custom action buttons.
Name
Type
Default
Description
ID
string
-
Unique identifier for the pagination container
Class
string
-
Additional CSS classes to merge with base styles
Attributes
templ.Attributes
-
Additional HTML attributes for the container
CurrentPage
int
1
Current active page number (1-indexed)
TotalPages
int
1
Total number of pages available
TotalItems
int
0
Total count of items across all pages
RowsPerPage
int
100
Number of rows displayed per page
RowsPerPageOptions
[]int
[10, 25, 50, 100]
Available options for rows per page dropdown
ShowRowsPerPage
bool
false
Whether to show the rows per page dropdown
ItemsLabel
string
items
Label for the total count (e.g., 'invoices', 'users')
FirstPageURL
templ.SafeURL
-
URL for the first page navigation button
PrevPageURL
templ.SafeURL
-
URL for the previous page navigation button
NextPageURL
templ.SafeURL
-
URL for the next page navigation button
LastPageURL
templ.SafeURL
-
URL for the last page navigation button
PageInputAttributes
templ.Attributes
-
Additional attributes for the page number input field
Typography
Text components for headings, paragraphs, descriptions, and formatted content.
Headings
Title and Subtitle components for page and section headings.
Standard paragraph and description text components.
This is a standard paragraph with default styling.
This is a description with secondary text color.
12345678910111213
package examples
import (
popui "github.com/invopop/popui/go"
)
templ TypographyParagraphsExample() {
<div class="space-y-2">
@popui.P() { This is a standard paragraph with default styling. }
@popui.Description() { This is a description with secondary text color. }
</div>
}
Inline Text
Mark component for highlighted text.
This paragraph contains highlighted text using the Mark component.
1234567891011121314
package examples
import (
popui "github.com/invopop/popui/go"
)
templ TypographyInlineExample() {
@popui.P() {
<span>This paragraph contains </span>
@popui.Mark() { highlighted text }
<span> using the Mark component.</span>
}
}
Alert Messages
Info and Warning components with icons.
This is an informational message with an icon.
This is a warning message with an alert icon.
12345678910111213
package examples
import (
popui "github.com/invopop/popui/go"
)
templ TypographyAlertsExample() {
<div class="space-y-3">
@popui.Info() { This is an informational message with an icon. }
@popui.Warning() { This is a warning message with an alert icon. }
</div>
}
Prose
Wrapper for raw HTML with Tailwind prose styling.
Prose Heading
This component wraps raw HTML with Tailwind prose styling for consistent typography.
Automatically styled lists
Formatted headings
Consistent spacing
123456789101112131415161718
package examples
import (
popui "github.com/invopop/popui/go"
)
templ TypographyProseExample() {
@popui.Prose() {
<h1>Prose Heading</h1>
<p>This component wraps raw HTML with Tailwind prose styling for consistent typography.</p>
<ul>
<li>Automatically styled lists</li>
<li>Formatted headings</li>
<li>Consistent spacing</li>
</ul>
}
}
API Reference
Title
H1 heading element with bold styling.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Subtitle
H2 subheading element with medium weight.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
P
Standard paragraph element.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Description
Paragraph with secondary text color.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Mark
Inline highlighted text element.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Info
Informational message with icon.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Warning
Warning message with alert icon.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Prose
Container for raw HTML with Tailwind prose styling.
Name
Type
Default
Description
ID
string
-
Unique identifier
Class
string
-
Additional CSS classes
Attributes
templ.Attributes
-
Additional HTML attributes
Button
Trigger actions and events with customizable button components.
Additional CSS classes to merge with flash message styles
Attributes
templ.Attributes
-
Additional HTML attributes (data-*, aria-*, etc.)
Type
string
-
Message type: currently supports 'success'
Message
string
-
Message text to display
Notification
Feedback messages with different severity types and icons.
Info
New feature available
Check out the new reporting dashboard in your settings.
123456789101112131415
package examples
import (
popui "github.com/invopop/popui/go"
"github.com/invopop/popui/go/props"
)
templ NotificationInfoExample() {
@popui.Notification(props.Notification{
Type: "info",
Text: "New feature available",
Description: "Check out the new reporting dashboard in your settings.",
})
}
Warning
Action required
Your payment method will expire soon. Please update it.