Focused overlay content with Modal and AlertDialog primitives, plus optional HTMX or JavaScript actions.
DefaultRendered example
Special Offer
As a token of appreciation, we have an exclusive offer just for you. Upgrade your account now to unlock premium features and enjoy a seamless experience.
Usage Example
@modal.Modal(modal.Config{ID:"offer",Title:"Special Offer",Body:"Upgrade your account now to unlock premium features.",TriggerLabel:"Open Modal",PrimaryLabel:"Upgrade Now",SecondaryLabel:"Remind me later",})
Alert Dialogs
AlertDialog renders a compact, icon-led alert dialog with one action and a semantic Tone.
Alert DialogsRendered example
Transaction Complete
Your funds transfer was successful. Check your balance for confirmation.
New Update Available
A new version of the application is ready for download. Enhance your experience with the latest features and improvements.
Forgot your password?
Your account will be locked after three unsuccessful login attempts.
Update Required
You are missing critical security updates, putting your system at risk of potential vulnerabilities.
Alert Dialogs
@modal.AlertDialog(modal.AlertDialogConfig{ID:"txComplete",Title:"Transaction Complete",Body:"Your funds transfer was successful.",TriggerLabel:"Success Modal",ActionLabel:"Go to My Balance",Tone:modal.ToneSuccess,})
With HTMX Action
Give a button a PrimaryAction with hx-* fields to fire a server request on confirm.
With HTMX ActionRendered example
Confirm Action
Clicking confirm will send a POST request to the server via HTMX.
With HTMX Action
@modal.Modal(modal.Config{ID:"htmxDemo",Title:"Confirm Action",Body:"This will send a request to the server.",TriggerLabel:"HTMX Modal",PrimaryLabel:"Confirm",SecondaryLabel:"Cancel",PrimaryAction:&modal.ButtonAction{HTMX:&modal.HTMXConfig{Post:"/api/hello",Target:"#modal-htmx-result",Swap:"innerHTML"},},})
With JavaScript Action
Use PrimaryAction.OnClick for a client-side handler.
With JavaScript ActionRendered example
Confirm Delete
Are you sure you want to delete this item? This action cannot be undone.
With JavaScript Action
@modal.Modal(modal.Config{ID:"jsDemo",Title:"Confirm Delete",Body:"Are you sure? This cannot be undone.",TriggerLabel:"JS Action Modal",PrimaryLabel:"Delete",SecondaryLabel:"Cancel",PrimaryAction:&modal.ButtonAction{OnClick:"alert('Deleted!')"},})
Go API
v0.2.7
The examples above cover behavior and composition. pkg.go.dev is the canonical reference for exported types, functions, methods, and Go documentation.
Goshtoso can store preferences and demo state in your browser. Some examples use cookies and IndexedDB to persist local demo state. There is no analytics, advertising, or third-party tracking. You can use the site without storage, but preferences and some examples will reset or stop persisting. Details in our Privacy Policy.