money

package
v0.0.21 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: MIT Imports: 6 Imported by: 0

Documentation

Overview

templ: version: v0.3.977

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FormatDecimal

func FormatDecimal(d decimal.Decimal, precision int) string

FormatDecimal formats a decimal with thousands separators and fixed precision. Example: 1234.56, 2 -> "1,234.56"

func Money

func Money(p Props) templ.Component

Money displays a monetary value with currency and precision. If Precision is nil, it defaults to 2.

func P

func P(v int) *int

P returns a pointer to an int. Useful for setting the Precision prop in Money component. Example: Money(Props{Precision: money.P(0)})

Types

type Props

type Props struct {
	ID         string
	Class      string
	Attributes templ.Attributes
	Amount     any
	Currency   string
	Precision  *int
}

Jump to

Keyboard shortcuts

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