Documentation
¶
Index ¶
- Constants
- Variables
- type AttachmentBlock
- type AttachmentOption
- type BadgeBlock
- type Block
- type Builder
- func (builder *Builder) Add(block Block) *Builder
- func (builder *Builder) AddAttachment(filename, meta, url, cta string, options ...AttachmentOption) *Builder
- func (builder *Builder) AddBadge(tone Tone, text string) *Builder
- func (builder *Builder) AddButton(label, url string, options ...ButtonOption) *Builder
- func (builder *Builder) AddButtonGroup(buttons []ButtonGroupButton, options ...ButtonGroupOption) *Builder
- func (builder *Builder) AddCallout(tone Tone, title, body string, options ...CalloutOption) *Builder
- func (builder *Builder) AddCardList(cards []CardItem, options ...CardListOption) *Builder
- func (builder *Builder) AddColumns(leftGroup, rightGroup *Group, options ...ColumnsOption) *Builder
- func (builder *Builder) AddDistribution(header string, buckets []DistributionBucket, options ...DistributionOption) *Builder
- func (builder *Builder) AddDivider(options ...DividerOption) *Builder
- func (builder *Builder) AddEmptyState(title, body, actionLabel, actionURL string, options ...EmptyStateOption) *Builder
- func (builder *Builder) AddFooterLinks(links []FooterLink, note string) *Builder
- func (builder *Builder) AddFreeMarkdown(markdown string) *Builder
- func (builder *Builder) AddGrid(items []GridItem, options ...GridOption) *Builder
- func (builder *Builder) AddGridGroups(groups []*Group, options ...GridOption) *Builder
- func (builder *Builder) AddHeading(text string, options ...HeadingOption) *Builder
- func (builder *Builder) AddHero(title, body, ctaLabel, ctaURL string, options ...HeroOption) *Builder
- func (builder *Builder) AddHorizontalBarChart(header string, items []HorizontalBarChartItem, ...) *Builder
- func (builder *Builder) AddImage(src, alt string, opts ...ImageOption) *Builder
- func (builder *Builder) AddKeyValue(header string, pairs []KeyValuePair, options ...KeyValueOption) *Builder
- func (builder *Builder) AddLegal(companyName, address, manageURL, unsubscribeURL string) *Builder
- func (builder *Builder) AddList(items []string, ordered bool, options ...ListOption) *Builder
- func (builder *Builder) AddMessage(message MessageBlock, options ...MessageOption) *Builder
- func (builder *Builder) AddMessageDigest(messages []MessageBlock, options ...MessageDigestOption) *Builder
- func (builder *Builder) AddPanel(content Block, options ...PanelOption) *Builder
- func (builder *Builder) AddPriceSummary(header string, items []PriceLine, totalLabel, totalValue string, ...) *Builder
- func (builder *Builder) AddProgress(header string, items []ProgressItem, options ...ProgressOption) *Builder
- func (builder *Builder) AddQuote(text, author string, options ...QuoteOption) *Builder
- func (builder *Builder) AddSpacer(options ...SpacerOption) *Builder
- func (builder *Builder) AddSparkline(header, label, value string, points []int, options ...SparklineOption) *Builder
- func (builder *Builder) AddStackedBar(header string, rows []StackedBarRow, options ...StackedBarOption) *Builder
- func (builder *Builder) AddStatsRow(header string, stats []StatItem) *Builder
- func (builder *Builder) AddSummaryCard(title, body, footer string, options ...SummaryCardOption) *Builder
- func (builder *Builder) AddTable(columns []string, rows [][]string, options ...TableOption) *Builder
- func (builder *Builder) AddText(text string, options ...TextOption) *Builder
- func (builder *Builder) AddTiles(entries []TileEntry, options ...TilesOption) *Builder
- func (builder *Builder) AddTimeline(header string, items []TimelineItem, options ...TimelineOption) *Builder
- func (builder *Builder) AddVerificationCode(label, code string, options ...VerificationCodeOption) *Builder
- func (builder *Builder) AddVerticalBarChart(axisLabels []string, series []VerticalBarChartSeries, ...) *Builder
- func (builder *Builder) Build() *Email
- func (builder *Builder) Clone() *Builder
- func (builder *Builder) Footer(value FooterSection) *Builder
- func (builder *Builder) Header(value HeaderSection) *Builder
- func (builder *Builder) NoFooter() *Builder
- func (builder *Builder) NoHeader() *Builder
- func (builder *Builder) WithDirection(value theme.Direction) *Builder
- func (builder *Builder) WithFooter(block Block, options ...FooterOption) *Builder
- func (builder *Builder) WithHeader(block Block, options ...HeaderOption) *Builder
- func (builder *Builder) WithPreheader(value string, options ...PreheaderOption) *Builder
- func (builder *Builder) WithoutFooter() *Builder
- func (builder *Builder) WithoutHeader() *Builder
- type BuilderOption
- func WithDirection(value theme.Direction) BuilderOption
- func WithFooter(block Block, options ...FooterOption) BuilderOption
- func WithFooterMode(mode FooterMode) BuilderOption
- func WithFooterOptions(block Block, options ...FooterOption) BuilderOption
- func WithHeader(block Block, options ...HeaderOption) BuilderOption
- func WithHeaderMode(mode HeaderMode) BuilderOption
- func WithHeaderOptions(block Block, options ...HeaderOption) BuilderOption
- func WithMSOCompatibility(value theme.MSOCompatibilityMode) BuilderOption
- func WithOutlookCompatibility(enabled bool) BuilderOption
- func WithStyles(value theme.Styles) BuilderOption
- type ButtonAlignmentValue
- type ButtonBlock
- type ButtonGroupBlock
- type ButtonGroupButton
- type ButtonGroupOption
- type ButtonOption
- type ButtonSizeValue
- type ButtonStyleValue
- type CalloutBlock
- type CalloutOption
- type CalloutVariant
- type CardItem
- type CardListBlock
- type CardListOption
- type ColumnsBlock
- type ColumnsOption
- type ColumnsVerticalAlign
- type DistributionBlock
- type DistributionBucket
- type DistributionOption
- type DividerBlock
- type DividerOption
- type DividerVariant
- type Email
- type EmptyStateBlock
- type EmptyStateOption
- type FooterLink
- type FooterLinksBlock
- type FooterMode
- type FooterOption
- type FooterPlacementValue
- type FooterSection
- type FreeMarkdownBlock
- type GridBlock
- type GridItem
- type GridOption
- type Group
- func (group *Group) Add(block Block) *Group
- func (group *Group) AddAttachment(filename, meta, url, cta string, options ...AttachmentOption) *Group
- func (group *Group) AddBadge(tone Tone, text string) *Group
- func (group *Group) AddButton(label, url string, options ...ButtonOption) *Group
- func (group *Group) AddButtonGroup(buttons []ButtonGroupButton, options ...ButtonGroupOption) *Group
- func (group *Group) AddCallout(tone Tone, title, body string, options ...CalloutOption) *Group
- func (group *Group) AddCardList(cards []CardItem, options ...CardListOption) *Group
- func (group *Group) AddColumns(leftGroup, rightGroup *Group, options ...ColumnsOption) *Group
- func (group *Group) AddDistribution(header string, buckets []DistributionBucket, options ...DistributionOption) *Group
- func (group *Group) AddDivider(options ...DividerOption) *Group
- func (group *Group) AddEmptyState(title, body, actionLabel, actionURL string, options ...EmptyStateOption) *Group
- func (group *Group) AddFooterLinks(links []FooterLink, note string) *Group
- func (group *Group) AddFreeMarkdown(markdown string) *Group
- func (group *Group) AddGrid(items []GridItem, options ...GridOption) *Group
- func (group *Group) AddGridGroups(groups []*Group, options ...GridOption) *Group
- func (group *Group) AddHeading(text string, options ...HeadingOption) *Group
- func (group *Group) AddHero(title, body, ctaLabel, ctaURL string, options ...HeroOption) *Group
- func (group *Group) AddHorizontalBarChart(header string, items []HorizontalBarChartItem, ...) *Group
- func (group *Group) AddImage(src, alt string, opts ...ImageOption) *Group
- func (group *Group) AddKeyValue(header string, pairs []KeyValuePair, options ...KeyValueOption) *Group
- func (group *Group) AddLegal(companyName, address, manageURL, unsubscribeURL string) *Group
- func (group *Group) AddList(items []string, ordered bool, options ...ListOption) *Group
- func (group *Group) AddMessage(message MessageBlock, options ...MessageOption) *Group
- func (group *Group) AddMessageDigest(messages []MessageBlock, options ...MessageDigestOption) *Group
- func (group *Group) AddPanel(content Block, options ...PanelOption) *Group
- func (group *Group) AddPriceSummary(header string, items []PriceLine, totalLabel, totalValue string, ...) *Group
- func (group *Group) AddProgress(header string, items []ProgressItem, options ...ProgressOption) *Group
- func (group *Group) AddQuote(text, author string, options ...QuoteOption) *Group
- func (group *Group) AddSpacer(options ...SpacerOption) *Group
- func (group *Group) AddSparkline(header, label, value string, points []int, options ...SparklineOption) *Group
- func (group *Group) AddStackedBar(header string, rows []StackedBarRow, options ...StackedBarOption) *Group
- func (group *Group) AddStatsRow(header string, stats []StatItem) *Group
- func (group *Group) AddSummaryCard(title, body, footer string, options ...SummaryCardOption) *Group
- func (group *Group) AddTable(columns []string, rows [][]string, options ...TableOption) *Group
- func (group *Group) AddText(text string, options ...TextOption) *Group
- func (group *Group) AddTiles(entries []TileEntry, options ...TilesOption) *Group
- func (group *Group) AddTimeline(header string, items []TimelineItem, options ...TimelineOption) *Group
- func (group *Group) AddVerificationCode(label, code string, options ...VerificationCodeOption) *Group
- func (group *Group) AddVerticalBarChart(axisLabels []string, series []VerticalBarChartSeries, ...) *Group
- func (group *Group) Blocks() []Block
- func (group *Group) Kind() theme.BlockKind
- func (group *Group) LayoutSpec() LayoutSpec
- func (group *Group) RenderText(context RenderContext) (string, error)
- func (group *Group) TemplateData() any
- type HeaderMode
- type HeaderOption
- type HeaderPlacementValue
- type HeaderSection
- type HeadingBlock
- type HeadingOption
- type HeroBlock
- type HeroOption
- type HorizontalBarChartBlock
- type HorizontalBarChartItem
- type HorizontalBarChartOption
- func HorizontalBarChartInsetMode(value InsetMode) HorizontalBarChartOption
- func HorizontalBarChartLabelsInsideBars(value bool) HorizontalBarChartOption
- func HorizontalBarChartThickness(value int) HorizontalBarChartOption
- func HorizontalBarChartTone(value Tone) HorizontalBarChartOption
- func HorizontalBarChartTransparentBackground(value bool) HorizontalBarChartOption
- type ImageAlignment
- type ImageBlock
- type ImageCornerMode
- type ImageOption
- func ImageAlign(align ImageAlignment) ImageOption
- func ImageAllCorners() ImageOption
- func ImageBottomCorners() ImageOption
- func ImageBottomSpacing(px int) ImageOption
- func ImageCorners(value ImageCornerMode) ImageOption
- func ImageFullWidth() ImageOption
- func ImageHref(href string) ImageOption
- func ImageInsetMode(value InsetMode) ImageOption
- func ImageNoCorners() ImageOption
- func ImageTopCorners() ImageOption
- func ImageTopSpacing(px int) ImageOption
- func ImageWidth(px int) ImageOption
- type InsetMode
- type KeyValueBlock
- type KeyValueOption
- type KeyValuePair
- type LayoutSpec
- type LegalBlock
- type ListBlock
- type ListOption
- type MessageBlock
- type MessageDigestBlock
- type MessageDigestOption
- func MessageDigestEmptyText(value string) MessageDigestOption
- func MessageDigestFooter(value string) MessageDigestOption
- func MessageDigestInsetMode(value InsetMode) MessageDigestOption
- func MessageDigestMaxItems(value int) MessageDigestOption
- func MessageDigestSubtitle(value string) MessageDigestOption
- func MessageDigestTitle(value string) MessageDigestOption
- type MessageOption
- type PanelBlock
- type PanelOption
- func PanelBorder(value bool) PanelOption
- func PanelCategory(value string) PanelOption
- func PanelHeaderless(value bool) PanelOption
- func PanelInsetMode(value InsetMode) PanelOption
- func PanelPadding(value int) PanelOption
- func PanelSubtitle(value string) PanelOption
- func PanelTitle(value string) PanelOption
- type PreheaderOption
- type PriceLine
- type PriceSummaryBlock
- type PriceSummaryOption
- type ProgressBlock
- type ProgressItem
- type ProgressOption
- type QuoteBlock
- type QuoteOption
- type RenderContext
- type SpacerBlock
- type SpacerOption
- type SparklineBlock
- type SparklineOption
- type StackedBarBlock
- type StackedBarOption
- type StackedBarRow
- type StackedBarSegment
- type StatDeltaSemantic
- type StatItem
- type StatsRowBlock
- type SummaryCardBlock
- type SummaryCardOption
- type TableBlock
- type TableBorderStyleValue
- type TableColumnAlignmentValue
- type TableDensityValue
- type TableHeaderToneValue
- type TableOption
- func TableBorderStyle(value TableBorderStyleValue) TableOption
- func TableColumnAlignments(value map[int]TableColumnAlignmentValue) TableOption
- func TableCompact(value bool) TableOption
- func TableDensity(value TableDensityValue) TableOption
- func TableEmphasizeTotalRow(value bool) TableOption
- func TableHeaderTone(value TableHeaderToneValue) TableOption
- func TableInsetMode(value InsetMode) TableOption
- func TableLegendSwatches(value []string) TableOption
- func TableRightAlignNumericColumns(value bool) TableOption
- func TableTitle(value string) TableOption
- func TableZebraRows(value bool) TableOption
- type TextAlignmentValue
- type TextBlock
- type TextOption
- func TextAlign(value TextAlignmentValue) TextOption
- func TextMarkdown() TextOption
- func TextNoMargin(value bool) TextOption
- func TextSize(value TextSizeValue) TextOption
- func TextSpacing(value TextSpacingValue) TextOption
- func TextTone(value Tone) TextOption
- func TextTransform(value TextTransformValue) TextOption
- func TextWeight(value TextWeightValue) TextOption
- type TextSizeValue
- type TextSpacingValue
- type TextTransformValue
- type TextWeightValue
- type TileAlignment
- type TileEntry
- type TileVariant
- type TilesBlock
- type TilesOption
- type TimelineBlock
- type TimelineItem
- type TimelineOption
- type Tone
- type VerificationCodeBlock
- type VerificationCodeOption
- type VerticalBarChartAxis
- type VerticalBarChartAxisLabelFormatValue
- type VerticalBarChartBlock
- type VerticalBarChartColumnView
- type VerticalBarChartLegendConfig
- type VerticalBarChartLegendItem
- type VerticalBarChartLegendPlacementValue
- type VerticalBarChartMagnitudeSuffixValue
- type VerticalBarChartNegativeFormatValue
- type VerticalBarChartOption
- func VerticalBarChartAxisConfig(value VerticalBarChartAxis) VerticalBarChartOption
- func VerticalBarChartAxisDrawYAxisLine(value bool) VerticalBarChartOption
- func VerticalBarChartAxisLabelFormat(value VerticalBarChartAxisLabelFormatValue) VerticalBarChartOption
- func VerticalBarChartAxisMax(value float64) VerticalBarChartOption
- func VerticalBarChartAxisMin(value float64) VerticalBarChartOption
- func VerticalBarChartAxisShowBaseline(value bool) VerticalBarChartOption
- func VerticalBarChartAxisShowCategoryLabels(value bool) VerticalBarChartOption
- func VerticalBarChartAxisShowYTicks(value bool) VerticalBarChartOption
- func VerticalBarChartCategoryGap(value int) VerticalBarChartOption
- func VerticalBarChartColumnGap(value int) VerticalBarChartOption
- func VerticalBarChartHeight(value int) VerticalBarChartOption
- func VerticalBarChartInsetMode(value InsetMode) VerticalBarChartOption
- func VerticalBarChartLegend(items []VerticalBarChartLegendItem) VerticalBarChartOption
- func VerticalBarChartLegendConfigOption(value VerticalBarChartLegendConfig) VerticalBarChartOption
- func VerticalBarChartLegendPlacement(value VerticalBarChartLegendPlacementValue) VerticalBarChartOption
- func VerticalBarChartNormalize(value bool) VerticalBarChartOption
- func VerticalBarChartOuterGap(value int) VerticalBarChartOption
- func VerticalBarChartSubtitle(value string) VerticalBarChartOption
- func VerticalBarChartTitle(value string) VerticalBarChartOption
- func VerticalBarChartTone(value Tone) VerticalBarChartOption
- func VerticalBarChartTransparentBackground(value bool) VerticalBarChartOption
- func VerticalBarChartValueFormatterOption(value VerticalBarChartValueFormatter) VerticalBarChartOption
- func VerticalBarChartValueLabelsOption(value VerticalBarChartValueLabels) VerticalBarChartOption
- type VerticalBarChartSegmentView
- type VerticalBarChartSeries
- type VerticalBarChartTemplateData
- type VerticalBarChartTickView
- type VerticalBarChartValueFormatter
- type VerticalBarChartValueLabels
Constants ¶
const ( ButtonStyleFilled ButtonStyleValue = "filled" ButtonStyleOutline ButtonStyleValue = "outline" ButtonStyleGhost ButtonStyleValue = "ghost" ButtonAlignmentStart ButtonAlignmentValue = "start" ButtonAlignmentCenter ButtonAlignmentValue = "center" ButtonAlignmentEnd ButtonAlignmentValue = "end" ButtonSizeSmall ButtonSizeValue = "small" ButtonSizeMedium ButtonSizeValue = "medium" ButtonSizeLarge ButtonSizeValue = "large" )
const ( // TableColumnAlignmentStart aligns cell content to the logical start edge. TableColumnAlignmentStart TableColumnAlignmentValue = "start" // TableColumnAlignmentCenter centers cell content. TableColumnAlignmentCenter TableColumnAlignmentValue = "center" // TableColumnAlignmentEnd aligns cell content to the logical end edge. TableColumnAlignmentEnd TableColumnAlignmentValue = "end" // TableDensityCompact uses tighter row spacing. TableDensityCompact TableDensityValue = "compact" // TableDensityNormal uses default row spacing. TableDensityNormal TableDensityValue = "normal" // TableDensityRelaxed uses looser row spacing. TableDensityRelaxed TableDensityValue = "relaxed" // TableHeaderTonePrimary uses primary header styling. TableHeaderTonePrimary TableHeaderToneValue = "primary" // TableHeaderToneMuted uses muted header styling. TableHeaderToneMuted TableHeaderToneValue = "muted" // TableHeaderTonePlain uses plain/unaccented header styling. TableHeaderTonePlain TableHeaderToneValue = "plain" // TableBorderStyleSolid renders solid borders. TableBorderStyleSolid TableBorderStyleValue = "solid" // TableBorderStyleDashed renders dashed borders. TableBorderStyleDashed TableBorderStyleValue = "dashed" // TableBorderStyleDotted renders dotted borders. TableBorderStyleDotted TableBorderStyleValue = "dotted" )
Variables ¶
var ErrThemeCannotRenderBlock = errors.New("myrtle: theme cannot render block")
ErrThemeCannotRenderBlock is returned when neither a block-provided renderer nor the active theme can render a block kind.
Functions ¶
This section is empty.
Types ¶
type AttachmentBlock ¶
type AttachmentBlock struct {
Filename string
Meta string
URL string
CTA string
InsetMode InsetMode
}
AttachmentBlock renders file attachment metadata with a CTA link.
func (AttachmentBlock) Kind ¶
func (block AttachmentBlock) Kind() theme.BlockKind
func (AttachmentBlock) LayoutSpec ¶
func (block AttachmentBlock) LayoutSpec() LayoutSpec
func (AttachmentBlock) RenderText ¶
func (block AttachmentBlock) RenderText(_ RenderContext) (string, error)
func (AttachmentBlock) TemplateData ¶
func (block AttachmentBlock) TemplateData() any
type AttachmentOption ¶
type AttachmentOption func(*AttachmentBlock)
AttachmentOption configures an AttachmentBlock.
func AttachmentInsetMode ¶
func AttachmentInsetMode(value InsetMode) AttachmentOption
AttachmentInsetMode sets the inset mode of the attachment block.
type BadgeBlock ¶
BadgeBlock renders a short status label with semantic tone.
func (BadgeBlock) Kind ¶
func (block BadgeBlock) Kind() theme.BlockKind
func (BadgeBlock) LayoutSpec ¶
func (block BadgeBlock) LayoutSpec() LayoutSpec
func (BadgeBlock) RenderText ¶
func (block BadgeBlock) RenderText(_ RenderContext) (string, error)
func (BadgeBlock) TemplateData ¶
func (block BadgeBlock) TemplateData() any
type Block ¶
type Block interface {
// Kind returns the theme block kind used to select the HTML template for this block.
Kind() theme.BlockKind
// TemplateData returns the normalized data payload passed into the block's HTML template.
TemplateData() any
// RenderText returns the plain-text representation of the block for text-only email output.
RenderText(context RenderContext) (string, error)
// LayoutSpec returns layout metadata, such as inset behavior, used by theme layout templates.
LayoutSpec() LayoutSpec
}
Block is the core content unit in an email, with HTML template data and text fallback rendering behavior.
func NewCustomBlock ¶
func NewCustomBlock[T any]( kind theme.BlockKind, data T, renderHTML func(T, theme.Values) (string, error), renderText func(T, RenderContext) (string, error), ) Block
NewCustomBlock creates a block backed by caller-provided HTML and plain-text renderers.
Use this when you need to add a one-off or app-specific block without modifying Myrtle's built-in block types or theme template sets. The same typed `data` value is passed to both renderers, so you can keep custom rendering logic cohesive while still supporting text-only clients.
Type parameter `T` is the custom payload type used by both callbacks. Myrtle wraps the callbacks in a runtime type-checking adapter so the block fails with a clear error if a renderer ever receives an unexpected payload type.
Both `renderHTML` and `renderText` are required and this function panics if either callback is nil. Errors returned by either callback are propagated during email rendering.
The resulting block uses the default layout spec (normal content inset behavior). See NewCustomBlockWithLayoutSpec if you need to customize layout metadata.
func NewCustomBlockWithLayoutSpec ¶
func NewCustomBlockWithLayoutSpec[T any]( kind theme.BlockKind, data T, layoutSpec LayoutSpec, renderHTML func(T, theme.Values) (string, error), renderText func(T, RenderContext) (string, error), ) Block
NewCustomBlockWithLayoutSpec creates a custom block with explicit layout metadata.
It behaves like NewCustomBlock, but lets callers control inset behavior used by theme layouts (for example InsetModeNone for full-width content or InsetModeCustom with CustomInset for per-block horizontal padding).
type Builder ¶
type Builder struct {
// contains filtered or unexported fields
}
Builder composes email content and rendering configuration before Build is called.
func NewBuilder ¶
func NewBuilder(themeImpl theme.Theme, options ...BuilderOption) *Builder
NewBuilder creates a new email builder for the given theme. Optional BuilderOption values can set initial header, footer, and styling.
func (*Builder) Add ¶
Add appends a block to the builder. Use this for custom or preconstructed block instances.
func (*Builder) AddAttachment ¶
func (builder *Builder) AddAttachment(filename, meta, url, cta string, options ...AttachmentOption) *Builder
AddAttachment appends an attachment block to the builder. Attachment blocks describe downloadable files with metadata and CTA.
func (*Builder) AddBadge ¶
AddBadge appends a badge block to the builder. Badges highlight short status labels with visual tone.
func (*Builder) AddButton ¶
func (builder *Builder) AddButton(label, url string, options ...ButtonOption) *Builder
AddButton appends a button block to the builder. Button blocks render a primary call-to-action link.
func (*Builder) AddButtonGroup ¶
func (builder *Builder) AddButtonGroup(buttons []ButtonGroupButton, options ...ButtonGroupOption) *Builder
AddButtonGroup appends a grouped button block to the builder. Button groups place multiple CTAs in one aligned row or stack.
func (*Builder) AddCallout ¶
func (builder *Builder) AddCallout(tone Tone, title, body string, options ...CalloutOption) *Builder
AddCallout appends a callout block to the builder. Callout blocks surface important notices with semantic styling.
func (*Builder) AddCardList ¶
func (builder *Builder) AddCardList(cards []CardItem, options ...CardListOption) *Builder
AddCardList appends a card list block to the builder. Card list blocks render repeated card entries in columns.
func (*Builder) AddColumns ¶
func (builder *Builder) AddColumns(leftGroup, rightGroup *Group, options ...ColumnsOption) *Builder
AddColumns appends a two-column layout block to the builder. Columns blocks render two side-by-side groups with configurable widths.
func (*Builder) AddDistribution ¶
func (builder *Builder) AddDistribution(header string, buckets []DistributionBucket, options ...DistributionOption) *Builder
AddDistribution appends a distribution block to the builder. Distribution blocks visualize bucketed values across ranges.
func (*Builder) AddDivider ¶
func (builder *Builder) AddDivider(options ...DividerOption) *Builder
AddDivider appends a divider block to the builder. Divider blocks separate sections with a horizontal rule or label.
func (*Builder) AddEmptyState ¶
func (builder *Builder) AddEmptyState(title, body, actionLabel, actionURL string, options ...EmptyStateOption) *Builder
AddEmptyState appends an empty-state block to the builder. Empty state blocks explain missing data and suggest next actions.
func (*Builder) AddFooterLinks ¶
func (builder *Builder) AddFooterLinks(links []FooterLink, note string) *Builder
AddFooterLinks appends a footer links block to the builder. Footer links blocks provide secondary navigation and policy links.
func (*Builder) AddFreeMarkdown ¶
AddFreeMarkdown appends a markdown-rendered content block to the builder. Free markdown blocks allow direct authoring of rich text snippets.
func (*Builder) AddGrid ¶
func (builder *Builder) AddGrid(items []GridItem, options ...GridOption) *Builder
AddGrid appends a grid block to the builder. Grid blocks lay out heterogeneous items across multiple columns.
func (*Builder) AddGridGroups ¶
func (builder *Builder) AddGridGroups(groups []*Group, options ...GridOption) *Builder
AddGridGroups appends groups as a grid block. Each group becomes one grid cell with its own nested content.
func (*Builder) AddHeading ¶
func (builder *Builder) AddHeading(text string, options ...HeadingOption) *Builder
AddHeading appends a heading block to the builder. Heading blocks introduce and structure content sections.
func (*Builder) AddHero ¶
func (builder *Builder) AddHero(title, body, ctaLabel, ctaURL string, options ...HeroOption) *Builder
AddHero appends a hero block to the builder. Hero blocks present high-impact title, body, and optional CTA.
func (*Builder) AddHorizontalBarChart ¶
func (builder *Builder) AddHorizontalBarChart(header string, items []HorizontalBarChartItem, options ...HorizontalBarChartOption) *Builder
AddHorizontalBarChart appends a horizontal bar chart block to the builder. This block compares categories with left-to-right bars.
func (*Builder) AddImage ¶
func (builder *Builder) AddImage(src, alt string, opts ...ImageOption) *Builder
AddImage adds an image block to the email with options. Image blocks render visual media with alignment and corner controls.
func (*Builder) AddKeyValue ¶
func (builder *Builder) AddKeyValue(header string, pairs []KeyValuePair, options ...KeyValueOption) *Builder
AddKeyValue appends a key-value block to the builder. Key-value blocks present compact labeled facts and values.
func (*Builder) AddLegal ¶
AddLegal appends a legal/compliance block to the builder. Legal blocks include company address and subscription management links.
func (*Builder) AddList ¶
func (builder *Builder) AddList(items []string, ordered bool, options ...ListOption) *Builder
AddList appends a list block to the builder. List blocks render ordered or unordered bullet content.
func (*Builder) AddMessage ¶
func (builder *Builder) AddMessage(message MessageBlock, options ...MessageOption) *Builder
AddMessage appends a message block to the builder. Message blocks render conversational items in a digest/thread style.
func (*Builder) AddMessageDigest ¶
func (builder *Builder) AddMessageDigest(messages []MessageBlock, options ...MessageDigestOption) *Builder
AddMessageDigest appends a message digest block to the builder. Digest blocks group multiple messages under a shared header/footer.
func (*Builder) AddPanel ¶
func (builder *Builder) AddPanel(content Block, options ...PanelOption) *Builder
AddPanel appends a panel block wrapping optional content. Panels provide a bordered container to group related content.
func (*Builder) AddPriceSummary ¶
func (builder *Builder) AddPriceSummary(header string, items []PriceLine, totalLabel, totalValue string, options ...PriceSummaryOption) *Builder
AddPriceSummary appends a price summary block to the builder. AddPriceSummary appends a price summary block to the builder. Price summary blocks itemize charges and present an order total.
func (*Builder) AddProgress ¶
func (builder *Builder) AddProgress(header string, items []ProgressItem, options ...ProgressOption) *Builder
AddProgress appends a progress block to the builder. Progress blocks communicate completion toward one or more goals.
func (*Builder) AddQuote ¶
func (builder *Builder) AddQuote(text, author string, options ...QuoteOption) *Builder
AddQuote appends a quote block to the builder. Quote blocks emphasize testimonial or attribution-style text.
func (*Builder) AddSpacer ¶
func (builder *Builder) AddSpacer(options ...SpacerOption) *Builder
AddSpacer appends a spacer block to the builder. Spacer blocks create vertical rhythm between nearby sections.
func (*Builder) AddSparkline ¶
func (builder *Builder) AddSparkline(header, label, value string, points []int, options ...SparklineOption) *Builder
AddSparkline appends a sparkline block to the builder. Sparkline blocks summarize a short trend inline with key values.
func (*Builder) AddStackedBar ¶
func (builder *Builder) AddStackedBar(header string, rows []StackedBarRow, options ...StackedBarOption) *Builder
AddStackedBar appends a stacked bar block to the builder. Stacked bars show part-to-whole composition per row.
func (*Builder) AddStatsRow ¶
AddStatsRow appends a stats row block to the builder. Stats rows present multiple compact KPI values in one line.
func (*Builder) AddSummaryCard ¶
func (builder *Builder) AddSummaryCard(title, body, footer string, options ...SummaryCardOption) *Builder
AddSummaryCard appends a summary card block to the builder. Summary cards combine a title, message, and optional footer note.
func (*Builder) AddTable ¶
func (builder *Builder) AddTable(columns []string, rows [][]string, options ...TableOption) *Builder
AddTable appends a table block to the builder. Table blocks present structured rows and columns of data.
func (*Builder) AddText ¶
func (builder *Builder) AddText(text string, options ...TextOption) *Builder
AddText appends a text block to the builder. Text blocks render paragraph-style body copy.
func (*Builder) AddTiles ¶
func (builder *Builder) AddTiles(entries []TileEntry, options ...TilesOption) *Builder
AddTiles appends a tiles block to the builder. Tiles blocks show small metric cards in a compact grid.
func (*Builder) AddTimeline ¶
func (builder *Builder) AddTimeline(header string, items []TimelineItem, options ...TimelineOption) *Builder
AddTimeline appends a timeline block to the builder. Timeline blocks show ordered milestones or process steps.
func (*Builder) AddVerificationCode ¶
func (builder *Builder) AddVerificationCode(label, code string, options ...VerificationCodeOption) *Builder
AddVerificationCode appends a verification code block to the builder. Verification code blocks highlight short one-time passcodes.
func (*Builder) AddVerticalBarChart ¶
func (builder *Builder) AddVerticalBarChart(axisLabels []string, series []VerticalBarChartSeries, options ...VerticalBarChartOption) *Builder
AddVerticalBarChart appends a vertical bar chart block to the builder. This block compares categories with bottom-to-top columns.
func (*Builder) Build ¶
Build materializes an immutable Email snapshot from the current builder state. Subsequent builder mutations do not affect the returned Email.
func (*Builder) Clone ¶
Clone returns a new builder initialized with the current builder state. It is useful for deriving variants from a shared baseline configuration.
The returned builder can be mutated independently, making it suitable for per-goroutine customization based on a shared prototype builder.
func (*Builder) Footer ¶
func (builder *Builder) Footer(value FooterSection) *Builder
Footer replaces the current footer configuration. It accepts a fully configured FooterSection value.
func (*Builder) Header ¶
func (builder *Builder) Header(value HeaderSection) *Builder
Header replaces the current header configuration. It accepts a fully configured HeaderSection value.
func (*Builder) NoFooter ¶
NoFooter disables the footer section. The rendered email will omit any footer content.
func (*Builder) NoHeader ¶
NoHeader disables the header section. The rendered email will omit any header content.
func (*Builder) WithDirection ¶
WithDirection sets text direction for rendered email content. Use RTL for right-to-left scripts and LTR for default left-to-right text.
func (*Builder) WithFooter ¶
func (builder *Builder) WithFooter(block Block, options ...FooterOption) *Builder
WithFooter enables a footer block and applies optional footer settings. This is a convenience helper when starting from a plain block.
func (*Builder) WithHeader ¶
func (builder *Builder) WithHeader(block Block, options ...HeaderOption) *Builder
WithHeader enables a header block and applies optional header settings. This is a convenience helper when starting from a plain block.
func (*Builder) WithPreheader ¶
func (builder *Builder) WithPreheader(value string, options ...PreheaderOption) *Builder
WithPreheader sets the preheader text shown by email clients in inbox previews. This text appears near the subject line in many inbox list views.
func (*Builder) WithoutFooter ¶
WithoutFooter is an alias for NoFooter. It provides a fluent alternative naming style.
func (*Builder) WithoutHeader ¶
WithoutHeader is an alias for NoHeader. It provides a fluent alternative naming style.
type BuilderOption ¶
type BuilderOption func(*Builder)
BuilderOption configures a Builder instance at creation time.
func WithDirection ¶
func WithDirection(value theme.Direction) BuilderOption
WithDirection sets the email direction (LTR or RTL) for builder output.
func WithFooter ¶
func WithFooter(block Block, options ...FooterOption) BuilderOption
WithFooter sets a footer block and applies footer options.
func WithFooterMode ¶
func WithFooterMode(mode FooterMode) BuilderOption
WithFooterMode controls automatic footer behavior for the builder.
func WithFooterOptions ¶
func WithFooterOptions(block Block, options ...FooterOption) BuilderOption
WithFooterOptions is an alias for WithFooter.
func WithHeader ¶
func WithHeader(block Block, options ...HeaderOption) BuilderOption
WithHeader sets a header block and applies header options.
func WithHeaderMode ¶
func WithHeaderMode(mode HeaderMode) BuilderOption
WithHeaderMode controls automatic header behavior for the builder.
func WithHeaderOptions ¶
func WithHeaderOptions(block Block, options ...HeaderOption) BuilderOption
WithHeaderOptions is an alias for WithHeader.
func WithMSOCompatibility ¶
func WithMSOCompatibility(value theme.MSOCompatibilityMode) BuilderOption
WithMSOCompatibility sets Outlook-specific compatibility fallback behavior for rendered HTML.
func WithOutlookCompatibility ¶
func WithOutlookCompatibility(enabled bool) BuilderOption
WithOutlookCompatibility enables or disables Outlook-specific compatibility fallbacks.
func WithStyles ¶
func WithStyles(value theme.Styles) BuilderOption
WithStyles overrides theme style tokens for the builder.
type ButtonAlignmentValue ¶
type ButtonAlignmentValue string
type ButtonBlock ¶
type ButtonBlock struct {
Label string
URL string
Tone Tone
Style ButtonStyleValue
Alignment ButtonAlignmentValue
Size ButtonSizeValue
NoWrap bool
FullWidth bool
}
ButtonBlock renders a single call-to-action button.
func (ButtonBlock) Kind ¶
func (block ButtonBlock) Kind() theme.BlockKind
func (ButtonBlock) LayoutSpec ¶
func (block ButtonBlock) LayoutSpec() LayoutSpec
func (ButtonBlock) RenderText ¶
func (block ButtonBlock) RenderText(_ RenderContext) (string, error)
func (ButtonBlock) TemplateData ¶
func (block ButtonBlock) TemplateData() any
type ButtonGroupBlock ¶
type ButtonGroupBlock struct {
Buttons []ButtonGroupButton
Alignment ButtonAlignmentValue
Joined bool
Gap int
StackOnMobile bool
FullWidthOnMobile bool
}
ButtonGroupBlock renders multiple related buttons as one responsive group.
func (ButtonGroupBlock) Kind ¶
func (block ButtonGroupBlock) Kind() theme.BlockKind
func (ButtonGroupBlock) LayoutSpec ¶
func (block ButtonGroupBlock) LayoutSpec() LayoutSpec
func (ButtonGroupBlock) RenderText ¶
func (block ButtonGroupBlock) RenderText(_ RenderContext) (string, error)
func (ButtonGroupBlock) TemplateData ¶
func (block ButtonGroupBlock) TemplateData() any
type ButtonGroupButton ¶
type ButtonGroupButton struct {
Label string
URL string
Tone Tone
Style ButtonStyleValue
}
ButtonGroupButton is one button entry inside a ButtonGroupBlock.
type ButtonGroupOption ¶
type ButtonGroupOption func(*ButtonGroupBlock)
ButtonGroupOption configures a ButtonGroupBlock.
func ButtonGroupAlign ¶
func ButtonGroupAlign(value ButtonAlignmentValue) ButtonGroupOption
ButtonGroupAlign sets the alignment of buttons in the group.
func ButtonGroupFullWidthOnMobile ¶
func ButtonGroupFullWidthOnMobile(value bool) ButtonGroupOption
ButtonGroupFullWidthOnMobile toggles full-width grouped buttons on mobile.
func ButtonGroupGap ¶
func ButtonGroupGap(value int) ButtonGroupOption
ButtonGroupGap sets the horizontal gap between grouped buttons.
func ButtonGroupJoined ¶
func ButtonGroupJoined(value bool) ButtonGroupOption
ButtonGroupJoined toggles joined rendering for grouped buttons.
func ButtonGroupStackOnMobile ¶
func ButtonGroupStackOnMobile(value bool) ButtonGroupOption
ButtonGroupStackOnMobile toggles stacking grouped buttons on mobile.
type ButtonOption ¶
type ButtonOption func(*ButtonBlock)
ButtonOption configures a ButtonBlock.
func ButtonAlign ¶
func ButtonAlign(value ButtonAlignmentValue) ButtonOption
ButtonAlign sets the alignment of a button.
func ButtonFullWidth ¶
func ButtonFullWidth(value bool) ButtonOption
ButtonFullWidth toggles full-width rendering for a button.
func ButtonNoWrap ¶
func ButtonNoWrap(value bool) ButtonOption
ButtonNoWrap toggles label wrapping for a button.
func ButtonSize ¶
func ButtonSize(value ButtonSizeValue) ButtonOption
ButtonSize sets the size of a button.
func ButtonStyle ¶
func ButtonStyle(value ButtonStyleValue) ButtonOption
ButtonStyle sets the style of a button.
type ButtonSizeValue ¶
type ButtonSizeValue string
type ButtonStyleValue ¶
type ButtonStyleValue string
type CalloutBlock ¶
type CalloutBlock struct {
Tone Tone
Variant CalloutVariant
Title string
Body string
LinkLabel string
LinkURL string
InsetMode InsetMode
// Markdown renders Body as inline markdown: [label](url) becomes a link in
// HTML and "label (url)" in plaintext; emphasis markers are stripped. Enable
// only for authored strings; link targets are not sanitized.
Markdown bool
}
CalloutBlock renders an emphasized informational or alert callout.
func (CalloutBlock) Kind ¶
func (block CalloutBlock) Kind() theme.BlockKind
func (CalloutBlock) LayoutSpec ¶
func (block CalloutBlock) LayoutSpec() LayoutSpec
func (CalloutBlock) RenderText ¶
func (block CalloutBlock) RenderText(_ RenderContext) (string, error)
func (CalloutBlock) TemplateData ¶
func (block CalloutBlock) TemplateData() any
type CalloutOption ¶
type CalloutOption func(*CalloutBlock)
CalloutOption configures a CalloutBlock.
func CalloutInsetMode ¶
func CalloutInsetMode(value InsetMode) CalloutOption
CalloutInsetMode sets the inset mode of the callout.
func CalloutLink ¶
func CalloutLink(label, url string) CalloutOption
CalloutLink sets the callout link label and URL.
func CalloutMarkdown ¶ added in v0.2.0
func CalloutMarkdown() CalloutOption
CalloutMarkdown renders the callout Body as inline markdown (see CalloutBlock.Markdown).
func CalloutStyle ¶
func CalloutStyle(variant CalloutVariant) CalloutOption
CalloutStyle sets the callout variant.
type CalloutVariant ¶
type CalloutVariant string
CalloutVariant defines the visual treatment used for a callout block.
const ( // CalloutVariantSoft renders a subtle filled callout. CalloutVariantSoft CalloutVariant = "soft" // CalloutVariantOutline renders a bordered callout. CalloutVariantOutline CalloutVariant = "outline" // CalloutVariantSolid renders a strong filled callout. CalloutVariantSolid CalloutVariant = "solid" )
type CardListBlock ¶
CardListBlock renders a multi-column list of simple cards.
func (CardListBlock) Kind ¶
func (block CardListBlock) Kind() theme.BlockKind
func (CardListBlock) LayoutSpec ¶
func (block CardListBlock) LayoutSpec() LayoutSpec
func (CardListBlock) RenderText ¶
func (block CardListBlock) RenderText(_ RenderContext) (string, error)
func (CardListBlock) TemplateData ¶
func (block CardListBlock) TemplateData() any
type CardListOption ¶
type CardListOption func(*CardListBlock)
CardListOption configures a CardListBlock.
func CardListBorder ¶
func CardListBorder(value bool) CardListOption
CardListBorder toggles borders around cards.
func CardListColumns ¶
func CardListColumns(value int) CardListOption
CardListColumns sets the number of columns in a card list.
func CardListGap ¶
func CardListGap(value int) CardListOption
CardListGap sets the gap between card list items in pixels.
func CardListInsetMode ¶
func CardListInsetMode(value InsetMode) CardListOption
CardListInsetMode sets the inset mode of the card list.
type ColumnsBlock ¶
type ColumnsBlock struct {
Left []Block
Right []Block
LeftWidth int
RightWidth int
Gap int
VerticalAlign ColumnsVerticalAlign
InsetMode InsetMode
}
ColumnsBlock renders two side-by-side block columns with configurable widths.
func (ColumnsBlock) Kind ¶
func (block ColumnsBlock) Kind() theme.BlockKind
func (ColumnsBlock) LayoutSpec ¶
func (block ColumnsBlock) LayoutSpec() LayoutSpec
func (ColumnsBlock) RenderText ¶
func (block ColumnsBlock) RenderText(context RenderContext) (string, error)
func (ColumnsBlock) TemplateData ¶
func (block ColumnsBlock) TemplateData() any
type ColumnsOption ¶
type ColumnsOption func(*ColumnsBlock)
ColumnsOption configures a ColumnsBlock when building content.
func ColumnsAlign ¶
func ColumnsAlign(value ColumnsVerticalAlign) ColumnsOption
ColumnsAlign sets vertical alignment for both columns.
func ColumnsGap ¶
func ColumnsGap(value int) ColumnsOption
ColumnsGap sets the horizontal gap between columns.
func ColumnsInsetMode ¶
func ColumnsInsetMode(value InsetMode) ColumnsOption
ColumnsInsetMode sets the layout inset mode for a columns block.
func ColumnsWidths ¶
func ColumnsWidths(leftWidth, rightWidth int) ColumnsOption
ColumnsWidths sets relative left/right column widths using percentage normalization.
type ColumnsVerticalAlign ¶
type ColumnsVerticalAlign string
ColumnsVerticalAlign controls vertical alignment of content inside each columns cell.
const ( // ColumnsVerticalAlignTop aligns column content to the top. ColumnsVerticalAlignTop ColumnsVerticalAlign = "top" // ColumnsVerticalAlignMiddle aligns column content to the vertical middle. ColumnsVerticalAlignMiddle ColumnsVerticalAlign = "middle" // ColumnsVerticalAlignBottom aligns column content to the bottom. ColumnsVerticalAlignBottom ColumnsVerticalAlign = "bottom" )
type DistributionBlock ¶
type DistributionBlock struct {
Header string
Buckets []DistributionBucket
CountColumnWidthCh int
InsetMode InsetMode
}
DistributionBlock renders bucketed value distributions.
func (DistributionBlock) Kind ¶
func (block DistributionBlock) Kind() theme.BlockKind
func (DistributionBlock) LayoutSpec ¶
func (block DistributionBlock) LayoutSpec() LayoutSpec
func (DistributionBlock) RenderText ¶
func (block DistributionBlock) RenderText(_ RenderContext) (string, error)
func (DistributionBlock) TemplateData ¶
func (block DistributionBlock) TemplateData() any
type DistributionBucket ¶
DistributionBucket is one bucket entry in a DistributionBlock.
type DistributionOption ¶
type DistributionOption func(*DistributionBlock)
DistributionOption configures a DistributionBlock.
func DistributionInsetMode ¶
func DistributionInsetMode(value InsetMode) DistributionOption
DistributionInsetMode sets the inset mode of the distribution block.
type DividerBlock ¶
type DividerBlock struct {
Variant DividerVariant
Thickness int
Inset int
Label string
InsetMode InsetMode
}
DividerBlock renders a horizontal divider line with optional label.
func (DividerBlock) Kind ¶
func (block DividerBlock) Kind() theme.BlockKind
func (DividerBlock) LayoutSpec ¶
func (block DividerBlock) LayoutSpec() LayoutSpec
func (DividerBlock) RenderText ¶
func (block DividerBlock) RenderText(_ RenderContext) (string, error)
func (DividerBlock) TemplateData ¶
func (block DividerBlock) TemplateData() any
type DividerOption ¶
type DividerOption func(*DividerBlock)
DividerOption configures a DividerBlock.
func DividerInset ¶
func DividerInset(value int) DividerOption
DividerInset sets divider inset in pixels.
func DividerInsetMode ¶
func DividerInsetMode(value InsetMode) DividerOption
DividerInsetMode sets the inset mode of the divider.
func DividerLabel ¶
func DividerLabel(value string) DividerOption
DividerLabel sets divider label text.
func DividerStyle ¶
func DividerStyle(value DividerVariant) DividerOption
DividerStyle sets the divider variant.
func DividerThickness ¶
func DividerThickness(value int) DividerOption
DividerThickness sets divider thickness in pixels.
type DividerVariant ¶
type DividerVariant string
DividerVariant defines the line style used by a divider.
const ( // DividerVariantSolid renders a continuous divider line. DividerVariantSolid DividerVariant = "solid" // DividerVariantDashed renders a dashed divider line. DividerVariantDashed DividerVariant = "dashed" // DividerVariantDotted renders a dotted divider line. DividerVariantDotted DividerVariant = "dotted" )
type Email ¶
type Email struct {
// contains filtered or unexported fields
}
Email is an immutable rendered message composed from header metadata, values, and blocks.
func (*Email) HTML ¶
HTML renders the email into themed HTML by rendering each block then composing the full layout.
type EmptyStateBlock ¶
type EmptyStateBlock struct {
Title string
Body string
ActionLabel string
ActionURL string
Tone Tone
InsetMode InsetMode
// Markdown renders Body as inline markdown: [label](url) becomes a link in
// HTML and "label (url)" in plaintext; emphasis markers are stripped. Enable
// only for authored strings; link targets are not sanitized.
Markdown bool
}
EmptyStateBlock renders placeholder content when data is unavailable.
func (EmptyStateBlock) Kind ¶
func (block EmptyStateBlock) Kind() theme.BlockKind
func (EmptyStateBlock) LayoutSpec ¶
func (block EmptyStateBlock) LayoutSpec() LayoutSpec
func (EmptyStateBlock) RenderText ¶
func (block EmptyStateBlock) RenderText(_ RenderContext) (string, error)
func (EmptyStateBlock) TemplateData ¶
func (block EmptyStateBlock) TemplateData() any
type EmptyStateOption ¶
type EmptyStateOption func(*EmptyStateBlock)
EmptyStateOption configures an EmptyStateBlock.
func EmptyStateInsetMode ¶
func EmptyStateInsetMode(value InsetMode) EmptyStateOption
EmptyStateInsetMode sets the inset mode of the empty state block.
func EmptyStateMarkdown ¶ added in v0.2.0
func EmptyStateMarkdown() EmptyStateOption
EmptyStateMarkdown renders the empty-state Body as inline markdown (see EmptyStateBlock.Markdown).
func EmptyStateTone ¶
func EmptyStateTone(value Tone) EmptyStateOption
EmptyStateTone sets the visual tone of the empty state block.
type FooterLink ¶
type FooterLink struct {
}
FooterLink is one label/URL pair rendered by FooterLinksBlock.
type FooterLinksBlock ¶
type FooterLinksBlock struct {
}
FooterLinksBlock renders navigational links and an optional footer note.
func (FooterLinksBlock) Kind ¶
func (block FooterLinksBlock) Kind() theme.BlockKind
func (FooterLinksBlock) LayoutSpec ¶
func (block FooterLinksBlock) LayoutSpec() LayoutSpec
func (FooterLinksBlock) RenderText ¶
func (block FooterLinksBlock) RenderText(_ RenderContext) (string, error)
func (FooterLinksBlock) TemplateData ¶
func (block FooterLinksBlock) TemplateData() any
type FooterMode ¶
type FooterMode int
FooterMode controls whether an email footer is auto-rendered, forced, or disabled.
const ( FooterModeAuto FooterMode = iota FooterModeEnabled FooterModeDisabled )
type FooterOption ¶
type FooterOption func(*FooterSection)
FooterOption configures a FooterSection.
func FooterPlacement ¶
func FooterPlacement(value FooterPlacementValue) FooterOption
FooterPlacement sets whether the footer renders inside or outside the main container.
func FooterRenderInText ¶
func FooterRenderInText(value bool) FooterOption
FooterRenderInText controls whether the footer is included in text output.
type FooterPlacementValue ¶
type FooterPlacementValue string
FooterPlacementValue controls whether the footer renders inside or outside the main container.
const ( FooterPlacementInside FooterPlacementValue = "inside" FooterPlacementOutside FooterPlacementValue = "outside" )
type FooterSection ¶
type FooterSection struct {
}
FooterSection stores footer content and placement settings for an email.
type FreeMarkdownBlock ¶
type FreeMarkdownBlock struct {
Markdown string
}
FreeMarkdownBlock renders raw markdown content.
func (FreeMarkdownBlock) Kind ¶
func (block FreeMarkdownBlock) Kind() theme.BlockKind
func (FreeMarkdownBlock) LayoutSpec ¶
func (block FreeMarkdownBlock) LayoutSpec() LayoutSpec
func (FreeMarkdownBlock) RenderText ¶
func (block FreeMarkdownBlock) RenderText(_ RenderContext) (string, error)
func (FreeMarkdownBlock) TemplateData ¶
func (block FreeMarkdownBlock) TemplateData() any
type GridBlock ¶
GridBlock renders grid items in configurable columns.
func (GridBlock) LayoutSpec ¶
func (block GridBlock) LayoutSpec() LayoutSpec
func (GridBlock) RenderText ¶
func (block GridBlock) RenderText(context RenderContext) (string, error)
func (GridBlock) TemplateData ¶
type GridItem ¶
type GridItem struct {
Content Block
}
GridItem is one content cell in a GridBlock.
func GridItemGroup ¶
GridItemGroup wraps a Group as a GridItem.
type GridOption ¶
type GridOption func(*GridBlock)
GridOption configures a GridBlock.
func GridColumns ¶
func GridColumns(value int) GridOption
GridColumns sets the number of columns in a grid.
func GridGap ¶
func GridGap(value int) GridOption
GridGap sets the gap between grid items in pixels.
func GridInsetMode ¶
func GridInsetMode(value InsetMode) GridOption
GridInsetMode sets the inset mode of the grid.
type Group ¶
type Group struct {
// contains filtered or unexported fields
}
Group is a reusable collection of blocks that can be composed and rendered as one block.
func NewGroup ¶
func NewGroup() *Group
NewGroup creates an empty reusable block group. Groups can be composed independently and embedded in columns or grids.
func (*Group) Add ¶
Add appends a block to the group. Use this for custom or preconstructed block instances.
func (*Group) AddAttachment ¶
func (group *Group) AddAttachment(filename, meta, url, cta string, options ...AttachmentOption) *Group
AddAttachment appends an attachment block to the group. Attachment blocks describe downloadable files with metadata and CTA.
func (*Group) AddBadge ¶
AddBadge appends a badge block to the group. Badges highlight short status labels with visual tone.
func (*Group) AddButton ¶
func (group *Group) AddButton(label, url string, options ...ButtonOption) *Group
AddButton appends a button block to the group. Button blocks render a primary call-to-action link.
func (*Group) AddButtonGroup ¶ added in v0.2.0
func (group *Group) AddButtonGroup(buttons []ButtonGroupButton, options ...ButtonGroupOption) *Group
AddButtonGroup appends a grouped button block to the group. Button groups place multiple CTAs in one aligned row or stack.
func (*Group) AddCallout ¶
func (group *Group) AddCallout(tone Tone, title, body string, options ...CalloutOption) *Group
AddCallout appends a callout block to the group. Callout blocks surface important notices with semantic styling.
func (*Group) AddCardList ¶ added in v0.2.0
func (group *Group) AddCardList(cards []CardItem, options ...CardListOption) *Group
AddCardList appends a card list block to the group. Card list blocks render repeated card entries in columns.
func (*Group) AddColumns ¶ added in v0.2.0
func (group *Group) AddColumns(leftGroup, rightGroup *Group, options ...ColumnsOption) *Group
AddColumns appends a two-column layout block to the group. Columns blocks render two side-by-side groups with configurable widths.
func (*Group) AddDistribution ¶ added in v0.2.0
func (group *Group) AddDistribution(header string, buckets []DistributionBucket, options ...DistributionOption) *Group
AddDistribution appends a distribution block to the group. Distribution blocks visualize bucketed values across ranges.
func (*Group) AddDivider ¶
func (group *Group) AddDivider(options ...DividerOption) *Group
AddDivider appends a divider block to the group. Divider blocks separate sections with a horizontal rule or label.
func (*Group) AddEmptyState ¶ added in v0.2.0
func (group *Group) AddEmptyState(title, body, actionLabel, actionURL string, options ...EmptyStateOption) *Group
AddEmptyState appends an empty-state block to the group. Empty state blocks explain missing data and suggest next actions.
func (*Group) AddFooterLinks ¶ added in v0.2.0
func (group *Group) AddFooterLinks(links []FooterLink, note string) *Group
AddFooterLinks appends a footer links block to the group. Footer links blocks provide secondary navigation and policy links.
func (*Group) AddFreeMarkdown ¶
AddFreeMarkdown appends a free-markdown block to the group. Free markdown blocks allow direct authoring of rich text snippets.
func (*Group) AddGrid ¶ added in v0.2.0
func (group *Group) AddGrid(items []GridItem, options ...GridOption) *Group
AddGrid appends a grid block to the group. Grid blocks lay out heterogeneous items across multiple columns.
func (*Group) AddGridGroups ¶ added in v0.2.0
func (group *Group) AddGridGroups(groups []*Group, options ...GridOption) *Group
AddGridGroups appends groups as a grid block to the group. Each group becomes one grid cell with its own nested content.
func (*Group) AddHeading ¶
func (group *Group) AddHeading(text string, options ...HeadingOption) *Group
AddHeading appends a heading block to the group. Heading blocks introduce and structure content sections.
func (*Group) AddHero ¶ added in v0.2.0
func (group *Group) AddHero(title, body, ctaLabel, ctaURL string, options ...HeroOption) *Group
AddHero appends a hero block to the group. Hero blocks present high-impact title, body, and optional CTA.
func (*Group) AddHorizontalBarChart ¶
func (group *Group) AddHorizontalBarChart(header string, items []HorizontalBarChartItem, options ...HorizontalBarChartOption) *Group
AddHorizontalBarChart appends a horizontal bar chart block to the group. This block compares categories with left-to-right bars.
func (*Group) AddImage ¶
func (group *Group) AddImage(src, alt string, opts ...ImageOption) *Group
AddImage appends an image block to the group. Image blocks render visual media with alignment and corner controls.
func (*Group) AddKeyValue ¶
func (group *Group) AddKeyValue(header string, pairs []KeyValuePair, options ...KeyValueOption) *Group
AddKeyValue appends a key-value block to the group. Key-value blocks present compact labeled facts and values.
func (*Group) AddLegal ¶
AddLegal appends a legal/footer-compliance block to the group. Legal blocks include company address and subscription management links.
func (*Group) AddList ¶
func (group *Group) AddList(items []string, ordered bool, options ...ListOption) *Group
AddList appends a list block to the group. List blocks render ordered or unordered bullet content.
func (*Group) AddMessage ¶
func (group *Group) AddMessage(message MessageBlock, options ...MessageOption) *Group
AddMessage appends a single message block to the group. Message blocks render conversational items in a digest/thread style.
func (*Group) AddMessageDigest ¶
func (group *Group) AddMessageDigest(messages []MessageBlock, options ...MessageDigestOption) *Group
AddMessageDigest appends a digest block containing multiple messages. Digest blocks group multiple messages under a shared header/footer.
func (*Group) AddPanel ¶ added in v0.2.0
func (group *Group) AddPanel(content Block, options ...PanelOption) *Group
AddPanel appends a panel block wrapping optional content to the group. Panels provide a bordered container to group related content.
func (*Group) AddPriceSummary ¶ added in v0.2.0
func (group *Group) AddPriceSummary(header string, items []PriceLine, totalLabel, totalValue string, options ...PriceSummaryOption) *Group
AddPriceSummary appends a price summary block to the group. Price summary blocks itemize charges and present an order total.
func (*Group) AddProgress ¶ added in v0.2.0
func (group *Group) AddProgress(header string, items []ProgressItem, options ...ProgressOption) *Group
AddProgress appends a progress block to the group. Progress blocks communicate completion toward one or more goals.
func (*Group) AddQuote ¶
func (group *Group) AddQuote(text, author string, options ...QuoteOption) *Group
AddQuote appends a quote block to the group. Quote blocks emphasize testimonial or attribution-style text.
func (*Group) AddSpacer ¶
func (group *Group) AddSpacer(options ...SpacerOption) *Group
AddSpacer appends a spacer block to the group. Spacer blocks create vertical rhythm between nearby sections.
func (*Group) AddSparkline ¶ added in v0.2.0
func (group *Group) AddSparkline(header, label, value string, points []int, options ...SparklineOption) *Group
AddSparkline appends a sparkline block to the group. Sparkline blocks summarize a short trend inline with key values.
func (*Group) AddStackedBar ¶ added in v0.2.0
func (group *Group) AddStackedBar(header string, rows []StackedBarRow, options ...StackedBarOption) *Group
AddStackedBar appends a stacked bar block to the group. Stacked bars show part-to-whole composition per row.
func (*Group) AddStatsRow ¶
AddStatsRow appends a stats row block to the group. Stats rows present multiple compact KPI values in one line.
func (*Group) AddSummaryCard ¶
func (group *Group) AddSummaryCard(title, body, footer string, options ...SummaryCardOption) *Group
AddSummaryCard appends a summary card block to the group. Summary cards combine a title, message, and optional footer note.
func (*Group) AddTable ¶
func (group *Group) AddTable(columns []string, rows [][]string, options ...TableOption) *Group
AddTable appends a table block to the group. Table blocks present structured rows and columns of data.
func (*Group) AddText ¶
func (group *Group) AddText(text string, options ...TextOption) *Group
AddText appends a text block to the group. Text blocks render paragraph-style body copy.
func (*Group) AddTiles ¶ added in v0.2.0
func (group *Group) AddTiles(entries []TileEntry, options ...TilesOption) *Group
AddTiles appends a tiles block to the group. Tiles blocks show small metric cards in a compact grid.
func (*Group) AddTimeline ¶
func (group *Group) AddTimeline(header string, items []TimelineItem, options ...TimelineOption) *Group
AddTimeline appends a timeline block to the group. Timeline blocks show ordered milestones or process steps.
func (*Group) AddVerificationCode ¶
func (group *Group) AddVerificationCode(label, code string, options ...VerificationCodeOption) *Group
AddVerificationCode appends a verification code block to the group. Verification code blocks highlight short one-time passcodes.
func (*Group) AddVerticalBarChart ¶
func (group *Group) AddVerticalBarChart(axisLabels []string, series []VerticalBarChartSeries, options ...VerticalBarChartOption) *Group
AddVerticalBarChart appends a vertical bar chart block to the group. This block compares categories with bottom-to-top columns.
func (*Group) Blocks ¶
Blocks returns a shallow copy of the group's blocks. Returning a copy prevents callers from mutating internal group state.
func (*Group) LayoutSpec ¶
func (group *Group) LayoutSpec() LayoutSpec
func (*Group) RenderText ¶
func (group *Group) RenderText(context RenderContext) (string, error)
func (*Group) TemplateData ¶
type HeaderMode ¶
type HeaderMode int
HeaderMode controls whether an email header is auto-rendered, forced, or disabled.
const ( // HeaderModeAuto includes a header only when one is configured. HeaderModeAuto HeaderMode = iota // HeaderModeEnabled forces header rendering even when empty defaults apply. HeaderModeEnabled // HeaderModeDisabled suppresses header rendering. HeaderModeDisabled )
type HeaderOption ¶
type HeaderOption func(*HeaderSection)
HeaderOption configures a HeaderSection.
func HeaderPlacement ¶
func HeaderPlacement(value HeaderPlacementValue) HeaderOption
HeaderPlacement sets whether the header renders inside or outside the main container.
func HeaderRenderInText ¶
func HeaderRenderInText(value bool) HeaderOption
HeaderRenderInText controls whether the header is included in text output.
type HeaderPlacementValue ¶
type HeaderPlacementValue string
HeaderPlacementValue controls whether the header renders inside or outside the main container.
const ( // HeaderPlacementInside renders the header within the main content container. HeaderPlacementInside HeaderPlacementValue = "inside" // HeaderPlacementOutside renders the header outside the main content container. HeaderPlacementOutside HeaderPlacementValue = "outside" )
type HeaderSection ¶
type HeaderSection struct {
Block Block
RenderInText bool
Placement HeaderPlacementValue
}
HeaderSection stores header content and placement settings for an email.
type HeadingBlock ¶
HeadingBlock renders a section heading.
func (HeadingBlock) Kind ¶
func (block HeadingBlock) Kind() theme.BlockKind
func (HeadingBlock) LayoutSpec ¶
func (block HeadingBlock) LayoutSpec() LayoutSpec
func (HeadingBlock) RenderText ¶
func (block HeadingBlock) RenderText(_ RenderContext) (string, error)
func (HeadingBlock) TemplateData ¶
func (block HeadingBlock) TemplateData() any
type HeadingOption ¶
type HeadingOption func(*HeadingBlock)
HeadingOption configures a HeadingBlock when building content.
func HeadingLevel ¶
func HeadingLevel(value int) HeadingOption
HeadingLevel sets the heading level on a HeadingBlock.
type HeroBlock ¶
type HeroBlock struct {
Eyebrow string
Title string
Body string
CTALabel string
CTAURL string
ImageURL string
ImageAlt string
Tone Tone
InsetMode InsetMode
// Markdown renders Body as inline markdown: [label](url) becomes a link in
// HTML and "label (url)" in plaintext; emphasis markers are stripped. Enable
// only for authored strings; link targets are not sanitized.
Markdown bool
}
HeroBlock renders a high-impact marketing hero section.
func (HeroBlock) LayoutSpec ¶
func (block HeroBlock) LayoutSpec() LayoutSpec
func (HeroBlock) RenderText ¶
func (block HeroBlock) RenderText(_ RenderContext) (string, error)
func (HeroBlock) TemplateData ¶
type HeroOption ¶
type HeroOption func(*HeroBlock)
HeroOption configures a HeroBlock.
func HeroEyebrow ¶
func HeroEyebrow(value string) HeroOption
HeroEyebrow sets the eyebrow text of the hero block.
func HeroImage ¶
func HeroImage(url, alt string) HeroOption
HeroImage sets the hero image URL and alt text.
func HeroInsetMode ¶
func HeroInsetMode(value InsetMode) HeroOption
HeroInsetMode sets the inset mode of the hero block.
func HeroMarkdown ¶ added in v0.2.0
func HeroMarkdown() HeroOption
HeroMarkdown renders the hero Body as inline markdown (see HeroBlock.Markdown).
func HeroTone ¶
func HeroTone(value Tone) HeroOption
HeroTone sets the visual tone of the hero block.
type HorizontalBarChartBlock ¶
type HorizontalBarChartBlock struct {
Header string
Items []HorizontalBarChartItem
Thickness int
ShowLabelsInsideBars bool
TransparentBackground bool
Tone Tone
InsetMode InsetMode
}
HorizontalBarChartBlock renders a horizontal category comparison chart.
func (HorizontalBarChartBlock) Kind ¶
func (block HorizontalBarChartBlock) Kind() theme.BlockKind
func (HorizontalBarChartBlock) LayoutSpec ¶
func (block HorizontalBarChartBlock) LayoutSpec() LayoutSpec
func (HorizontalBarChartBlock) RenderText ¶
func (block HorizontalBarChartBlock) RenderText(_ RenderContext) (string, error)
func (HorizontalBarChartBlock) TemplateData ¶
func (block HorizontalBarChartBlock) TemplateData() any
type HorizontalBarChartItem ¶
HorizontalBarChartItem is one category/value row in a HorizontalBarChartBlock.
type HorizontalBarChartOption ¶
type HorizontalBarChartOption func(*HorizontalBarChartBlock)
HorizontalBarChartOption configures a HorizontalBarChartBlock.
func HorizontalBarChartInsetMode ¶
func HorizontalBarChartInsetMode(value InsetMode) HorizontalBarChartOption
HorizontalBarChartInsetMode sets the inset mode of the horizontal bar chart.
func HorizontalBarChartLabelsInsideBars ¶
func HorizontalBarChartLabelsInsideBars(value bool) HorizontalBarChartOption
HorizontalBarChartLabelsInsideBars toggles labels inside bars.
func HorizontalBarChartThickness ¶
func HorizontalBarChartThickness(value int) HorizontalBarChartOption
HorizontalBarChartThickness sets bar thickness in pixels.
func HorizontalBarChartTone ¶
func HorizontalBarChartTone(value Tone) HorizontalBarChartOption
HorizontalBarChartTone sets the tone of the horizontal bar chart.
func HorizontalBarChartTransparentBackground ¶
func HorizontalBarChartTransparentBackground(value bool) HorizontalBarChartOption
HorizontalBarChartTransparentBackground toggles transparent chart background.
type ImageAlignment ¶
type ImageAlignment string
ImageAlignment controls image horizontal alignment and width behavior.
const ( ImageAlignmentDefault ImageAlignment = "" ImageAlignmentCenter ImageAlignment = "center" ImageAlignmentStart ImageAlignment = "start" ImageAlignmentEnd ImageAlignment = "end" ImageAlignmentFull ImageAlignment = "full" )
type ImageBlock ¶
type ImageBlock struct {
Src string
Alt string
Href string
Width int // px, 0 means auto
Align ImageAlignment // "center", "start", "end", "full", "" (default)
HasTopSpacing bool
TopSpacing int
HasBottomSpacing bool
BottomSpacing int
CornerMode ImageCornerMode
InsetMode InsetMode
}
ImageBlock renders an image with optional link and spacing controls.
func (ImageBlock) Kind ¶
func (block ImageBlock) Kind() theme.BlockKind
func (ImageBlock) LayoutSpec ¶
func (block ImageBlock) LayoutSpec() LayoutSpec
func (ImageBlock) RenderText ¶
func (block ImageBlock) RenderText(_ RenderContext) (string, error)
func (ImageBlock) TemplateData ¶
func (block ImageBlock) TemplateData() any
type ImageCornerMode ¶
type ImageCornerMode string
ImageCornerMode controls how image corner radii are applied.
const ( ImageCornerModeAuto ImageCornerMode = "auto" ImageCornerModeNone ImageCornerMode = "none" ImageCornerModeAll ImageCornerMode = "all" ImageCornerModeTop ImageCornerMode = "top" ImageCornerModeBottom ImageCornerMode = "bottom" )
type ImageOption ¶
type ImageOption func(*ImageBlock)
ImageOption configures an ImageBlock.
func ImageAlign ¶
func ImageAlign(align ImageAlignment) ImageOption
ImageAlign sets the alignment of the image.
func ImageAllCorners ¶
func ImageAllCorners() ImageOption
ImageAllCorners enables corner radius on all image corners.
func ImageBottomCorners ¶
func ImageBottomCorners() ImageOption
ImageBottomCorners enables corner radius only on bottom corners.
func ImageBottomSpacing ¶
func ImageBottomSpacing(px int) ImageOption
ImageBottomSpacing sets the bottom spacing (in px) for the image block.
func ImageCorners ¶
func ImageCorners(value ImageCornerMode) ImageOption
ImageCorners controls which image corners receive radius.
func ImageFullWidth ¶
func ImageFullWidth() ImageOption
ImageFullWidth sets the image to full width.
func ImageInsetMode ¶
func ImageInsetMode(value InsetMode) ImageOption
ImageInsetMode sets the inset mode of the image block.
func ImageNoCorners ¶
func ImageNoCorners() ImageOption
ImageNoCorners disables corner radius on all image corners.
func ImageTopCorners ¶
func ImageTopCorners() ImageOption
ImageTopCorners enables corner radius only on top corners.
func ImageTopSpacing ¶
func ImageTopSpacing(px int) ImageOption
ImageTopSpacing sets the top spacing (in px) for the image block.
func ImageWidth ¶
func ImageWidth(px int) ImageOption
ImageWidth sets the width (in px) of the image.
type InsetMode ¶
type InsetMode string
InsetMode controls how a block is horizontally inset within the main content container. For example, an image with InsetModeDefault keeps the theme's normal side padding, InsetModeNone spans edge-to-edge inside the container, and InsetModeCustom uses LayoutSpec.CustomInset as the per-block inset value.
const ( // InsetModeDefault uses the theme default content inset for the block. InsetModeDefault InsetMode = "default" // InsetModeNone removes side insets so the block renders full-bleed within the container. InsetModeNone InsetMode = "none" // InsetModeCustom uses LayoutSpec.CustomInset to set a custom side inset for the block. InsetModeCustom InsetMode = "custom" )
type KeyValueBlock ¶
type KeyValueBlock struct {
Header string
Pairs []KeyValuePair
// Markdown renders each pair's Value as inline markdown: [label](url) becomes
// a link in HTML and "label (url)" in plaintext; emphasis markers are
// stripped. Enable only for authored strings; link targets are not sanitized.
Markdown bool
}
KeyValueBlock renders labeled key-value pairs.
func (KeyValueBlock) Kind ¶
func (block KeyValueBlock) Kind() theme.BlockKind
func (KeyValueBlock) LayoutSpec ¶
func (block KeyValueBlock) LayoutSpec() LayoutSpec
func (KeyValueBlock) RenderText ¶
func (block KeyValueBlock) RenderText(_ RenderContext) (string, error)
func (KeyValueBlock) TemplateData ¶
func (block KeyValueBlock) TemplateData() any
type KeyValueOption ¶ added in v0.2.0
type KeyValueOption func(*KeyValueBlock)
KeyValueOption configures a KeyValueBlock.
func KeyValueMarkdown ¶ added in v0.2.0
func KeyValueMarkdown() KeyValueOption
KeyValueMarkdown renders each pair's Value as inline markdown (see KeyValueBlock.Markdown).
type KeyValuePair ¶
KeyValuePair is one key/value row rendered by KeyValueBlock.
type LayoutSpec ¶
LayoutSpec describes per-block layout behavior that themes can use when placing the block.
type LegalBlock ¶
LegalBlock renders company and subscription-management compliance text.
func (LegalBlock) Kind ¶
func (block LegalBlock) Kind() theme.BlockKind
func (LegalBlock) LayoutSpec ¶
func (block LegalBlock) LayoutSpec() LayoutSpec
func (LegalBlock) RenderText ¶
func (block LegalBlock) RenderText(_ RenderContext) (string, error)
func (LegalBlock) TemplateData ¶
func (block LegalBlock) TemplateData() any
type ListBlock ¶
type ListBlock struct {
Items []string
Ordered bool
// Markdown renders each item as inline markdown: [label](url) becomes a link
// in HTML and "label (url)" in plaintext; emphasis markers are stripped.
// Enable only for authored strings; link targets are not sanitized.
Markdown bool
}
ListBlock renders an ordered or unordered list.
func (ListBlock) LayoutSpec ¶
func (block ListBlock) LayoutSpec() LayoutSpec
func (ListBlock) RenderText ¶
func (block ListBlock) RenderText(_ RenderContext) (string, error)
func (ListBlock) TemplateData ¶
type ListOption ¶ added in v0.2.0
type ListOption func(*ListBlock)
ListOption configures a ListBlock.
func ListMarkdown ¶ added in v0.2.0
func ListMarkdown() ListOption
ListMarkdown renders each list item as inline markdown (see ListBlock.Markdown).
type MessageBlock ¶
type MessageBlock struct {
SenderName string
SenderHandle string
AvatarURL string
LogoAlt string
LogoHref string
Subject string
Preview string
PreviewMarkdown string
SentAt string
Platform string
URL string
ActionLabel string
ActionURL string
InsetMode InsetMode
}
MessageBlock renders one message item in a conversational digest format.
func (MessageBlock) Kind ¶
func (block MessageBlock) Kind() theme.BlockKind
func (MessageBlock) LayoutSpec ¶
func (block MessageBlock) LayoutSpec() LayoutSpec
func (MessageBlock) RenderText ¶
func (block MessageBlock) RenderText(_ RenderContext) (string, error)
func (MessageBlock) TemplateData ¶
func (block MessageBlock) TemplateData() any
type MessageDigestBlock ¶
type MessageDigestBlock struct {
Title string
Subtitle string
Messages []MessageBlock
EmptyText string
MaxItems int
InsetMode InsetMode
}
MessageDigestBlock renders a grouped list of message items.
func (MessageDigestBlock) Kind ¶
func (block MessageDigestBlock) Kind() theme.BlockKind
func (MessageDigestBlock) LayoutSpec ¶
func (block MessageDigestBlock) LayoutSpec() LayoutSpec
func (MessageDigestBlock) RenderText ¶
func (block MessageDigestBlock) RenderText(_ RenderContext) (string, error)
func (MessageDigestBlock) TemplateData ¶
func (block MessageDigestBlock) TemplateData() any
type MessageDigestOption ¶
type MessageDigestOption func(*MessageDigestBlock)
MessageDigestOption configures a MessageDigestBlock.
func MessageDigestEmptyText ¶
func MessageDigestEmptyText(value string) MessageDigestOption
MessageDigestEmptyText sets empty-state text for a message digest.
func MessageDigestFooter ¶
func MessageDigestFooter(value string) MessageDigestOption
MessageDigestFooter sets the footer text of a message digest block.
func MessageDigestInsetMode ¶
func MessageDigestInsetMode(value InsetMode) MessageDigestOption
MessageDigestInsetMode sets the inset mode of the message digest block.
func MessageDigestMaxItems ¶
func MessageDigestMaxItems(value int) MessageDigestOption
MessageDigestMaxItems sets the maximum number of digest items to render.
func MessageDigestSubtitle ¶
func MessageDigestSubtitle(value string) MessageDigestOption
MessageDigestSubtitle sets the subtitle of a message digest block.
func MessageDigestTitle ¶
func MessageDigestTitle(value string) MessageDigestOption
MessageDigestTitle sets the title of a message digest block.
type MessageOption ¶
type MessageOption func(*MessageBlock)
MessageOption configures a MessageBlock.
func MessageInsetMode ¶
func MessageInsetMode(value InsetMode) MessageOption
MessageInsetMode sets the inset mode of the message block.
type PanelBlock ¶
type PanelBlock struct {
Title string
Subtitle string
Category string
Headerless bool
ShowHeader bool
Padding int
Border bool
Blocks []Block
InsetMode InsetMode
}
PanelBlock renders a bordered container around nested blocks.
func (PanelBlock) Kind ¶
func (block PanelBlock) Kind() theme.BlockKind
func (PanelBlock) LayoutSpec ¶
func (block PanelBlock) LayoutSpec() LayoutSpec
func (PanelBlock) RenderText ¶
func (block PanelBlock) RenderText(context RenderContext) (string, error)
func (PanelBlock) TemplateData ¶
func (block PanelBlock) TemplateData() any
type PanelOption ¶
type PanelOption func(*PanelBlock)
PanelOption configures a PanelBlock.
func PanelCategory ¶
func PanelCategory(value string) PanelOption
PanelCategory sets the panel category label.
func PanelHeaderless ¶
func PanelHeaderless(value bool) PanelOption
PanelHeaderless toggles rendering the panel without its header section.
func PanelInsetMode ¶
func PanelInsetMode(value InsetMode) PanelOption
PanelInsetMode sets the inset mode of the panel.
func PanelPadding ¶
func PanelPadding(value int) PanelOption
PanelPadding sets panel content padding in pixels.
func PanelSubtitle ¶
func PanelSubtitle(value string) PanelOption
PanelSubtitle sets the panel subtitle.
type PreheaderOption ¶
type PreheaderOption func(*preheaderConfig)
PreheaderOption configures preheader rendering behavior.
func PreheaderPaddingRepeat ¶
func PreheaderPaddingRepeat(value int) PreheaderOption
PreheaderPaddingRepeat sets how many hidden " ‌" pairs are appended to the HTML preheader. Values below zero are clamped to zero.
type PriceSummaryBlock ¶
type PriceSummaryBlock struct {
Header string
Items []PriceLine
TotalLabel string
TotalValue string
InsetMode InsetMode
}
PriceSummaryBlock renders a line-item pricing summary with totals.
func (PriceSummaryBlock) Kind ¶
func (block PriceSummaryBlock) Kind() theme.BlockKind
func (PriceSummaryBlock) LayoutSpec ¶
func (block PriceSummaryBlock) LayoutSpec() LayoutSpec
func (PriceSummaryBlock) RenderText ¶
func (block PriceSummaryBlock) RenderText(_ RenderContext) (string, error)
func (PriceSummaryBlock) TemplateData ¶
func (block PriceSummaryBlock) TemplateData() any
type PriceSummaryOption ¶
type PriceSummaryOption func(*PriceSummaryBlock)
PriceSummaryOption configures a PriceSummaryBlock.
func PriceSummaryInsetMode ¶
func PriceSummaryInsetMode(value InsetMode) PriceSummaryOption
PriceSummaryInsetMode sets the inset mode of the price summary block.
type ProgressBlock ¶
type ProgressBlock struct {
Header string
Items []ProgressItem
InsetMode InsetMode
}
ProgressBlock renders one or more progress indicators.
func (ProgressBlock) Kind ¶
func (block ProgressBlock) Kind() theme.BlockKind
func (ProgressBlock) LayoutSpec ¶
func (block ProgressBlock) LayoutSpec() LayoutSpec
func (ProgressBlock) RenderText ¶
func (block ProgressBlock) RenderText(_ RenderContext) (string, error)
func (ProgressBlock) TemplateData ¶
func (block ProgressBlock) TemplateData() any
type ProgressItem ¶
ProgressItem is one progress entry rendered by ProgressBlock.
type ProgressOption ¶
type ProgressOption func(*ProgressBlock)
ProgressOption configures a ProgressBlock.
func ProgressInsetMode ¶
func ProgressInsetMode(value InsetMode) ProgressOption
ProgressInsetMode sets the inset mode of the progress block.
type QuoteBlock ¶
type QuoteBlock struct {
Text string
Author string
// Markdown renders Text as inline markdown: [label](url) becomes a link in
// HTML and "label (url)" in plaintext; emphasis markers are stripped. Enable
// only for authored strings; link targets are not sanitized.
Markdown bool
}
QuoteBlock renders quoted text with optional attribution.
func (QuoteBlock) Kind ¶
func (block QuoteBlock) Kind() theme.BlockKind
func (QuoteBlock) LayoutSpec ¶
func (block QuoteBlock) LayoutSpec() LayoutSpec
func (QuoteBlock) RenderText ¶
func (block QuoteBlock) RenderText(_ RenderContext) (string, error)
func (QuoteBlock) TemplateData ¶
func (block QuoteBlock) TemplateData() any
type QuoteOption ¶ added in v0.2.0
type QuoteOption func(*QuoteBlock)
QuoteOption configures a QuoteBlock.
func QuoteMarkdown ¶ added in v0.2.0
func QuoteMarkdown() QuoteOption
QuoteMarkdown renders the quote Text as inline markdown (see QuoteBlock.Markdown).
type RenderContext ¶
RenderContext contains resolved email values available to block text renderers.
type SpacerBlock ¶
type SpacerBlock struct {
Size int
}
SpacerBlock inserts vertical spacing between blocks.
func (SpacerBlock) Kind ¶
func (block SpacerBlock) Kind() theme.BlockKind
func (SpacerBlock) LayoutSpec ¶
func (block SpacerBlock) LayoutSpec() LayoutSpec
func (SpacerBlock) RenderText ¶
func (block SpacerBlock) RenderText(_ RenderContext) (string, error)
func (SpacerBlock) TemplateData ¶
func (block SpacerBlock) TemplateData() any
type SparklineBlock ¶
type SparklineBlock struct {
Header string
Label string
Value string
Delta string
DeltaSemantic StatDeltaSemantic
Tone Tone
Points []int
InsetMode InsetMode
}
SparklineBlock renders a compact inline trend chart with summary values.
func (SparklineBlock) Kind ¶
func (block SparklineBlock) Kind() theme.BlockKind
func (SparklineBlock) LayoutSpec ¶
func (block SparklineBlock) LayoutSpec() LayoutSpec
func (SparklineBlock) RenderText ¶
func (block SparklineBlock) RenderText(_ RenderContext) (string, error)
func (SparklineBlock) TemplateData ¶
func (block SparklineBlock) TemplateData() any
type SparklineOption ¶
type SparklineOption func(*SparklineBlock)
SparklineOption configures a SparklineBlock.
func SparklineDelta ¶
func SparklineDelta(value string) SparklineOption
SparklineDelta sets the delta label shown with the sparkline.
func SparklineDeltaSemantic ¶
func SparklineDeltaSemantic(value StatDeltaSemantic) SparklineOption
SparklineDeltaSemantic sets semantic styling for the sparkline delta value.
func SparklineInsetMode ¶
func SparklineInsetMode(value InsetMode) SparklineOption
SparklineInsetMode sets the inset mode of the sparkline block.
func SparklineTone ¶
func SparklineTone(value Tone) SparklineOption
SparklineTone sets the tone of the sparkline.
type StackedBarBlock ¶
type StackedBarBlock struct {
Header string
TotalLabel string
TotalValue string
Rows []StackedBarRow
InsetMode InsetMode
}
StackedBarBlock renders stacked proportional bars for part-to-whole data.
func (StackedBarBlock) Kind ¶
func (block StackedBarBlock) Kind() theme.BlockKind
func (StackedBarBlock) LayoutSpec ¶
func (block StackedBarBlock) LayoutSpec() LayoutSpec
func (StackedBarBlock) RenderText ¶
func (block StackedBarBlock) RenderText(_ RenderContext) (string, error)
func (StackedBarBlock) TemplateData ¶
func (block StackedBarBlock) TemplateData() any
type StackedBarOption ¶
type StackedBarOption func(*StackedBarBlock)
StackedBarOption configures a StackedBarBlock.
func StackedBarInsetMode ¶
func StackedBarInsetMode(value InsetMode) StackedBarOption
StackedBarInsetMode sets the inset mode of the stacked bar block.
func StackedBarTotal ¶
func StackedBarTotal(label, value string) StackedBarOption
StackedBarTotal sets the summary label and value shown with the stacked bar.
type StackedBarRow ¶
type StackedBarRow struct {
Label string
Segments []StackedBarSegment
}
StackedBarRow is one row of stacked segments in a StackedBarBlock.
type StackedBarSegment ¶
StackedBarSegment is one labeled segment in a stacked bar row.
type StatDeltaSemantic ¶
type StatDeltaSemantic string
StatDeltaSemantic controls semantic styling for stat delta values.
const ( // StatDeltaSemanticNone renders delta text without semantic emphasis. StatDeltaSemanticNone StatDeltaSemantic = "none" // StatDeltaSemanticPositive renders positive/upward delta emphasis. StatDeltaSemanticPositive StatDeltaSemantic = "positive" // StatDeltaSemanticNegative renders negative/downward delta emphasis. StatDeltaSemanticNegative StatDeltaSemantic = "negative" )
type StatItem ¶
type StatItem struct {
Label string
Value string
Delta string
DeltaSemantic StatDeltaSemantic
}
StatItem is one KPI entry rendered in a StatsRowBlock.
type StatsRowBlock ¶
StatsRowBlock renders a row of compact KPI/stat entries.
func (StatsRowBlock) Kind ¶
func (block StatsRowBlock) Kind() theme.BlockKind
func (StatsRowBlock) LayoutSpec ¶
func (block StatsRowBlock) LayoutSpec() LayoutSpec
func (StatsRowBlock) RenderText ¶
func (block StatsRowBlock) RenderText(_ RenderContext) (string, error)
func (StatsRowBlock) TemplateData ¶
func (block StatsRowBlock) TemplateData() any
type SummaryCardBlock ¶
type SummaryCardBlock struct {
Title string
Body string
Tone Tone
InsetMode InsetMode
// Markdown renders Body and Footer as inline markdown: [label](url) becomes
// a link in HTML and "label (url)" in plaintext; emphasis markers are
// stripped. Enable only for authored strings; link targets are not sanitized.
Markdown bool
}
SummaryCardBlock renders a concise title/body/footer summary card.
func (SummaryCardBlock) Kind ¶
func (block SummaryCardBlock) Kind() theme.BlockKind
func (SummaryCardBlock) LayoutSpec ¶
func (block SummaryCardBlock) LayoutSpec() LayoutSpec
func (SummaryCardBlock) RenderText ¶
func (block SummaryCardBlock) RenderText(_ RenderContext) (string, error)
func (SummaryCardBlock) TemplateData ¶
func (block SummaryCardBlock) TemplateData() any
type SummaryCardOption ¶
type SummaryCardOption func(*SummaryCardBlock)
SummaryCardOption configures a SummaryCardBlock.
func SummaryCardInsetMode ¶
func SummaryCardInsetMode(value InsetMode) SummaryCardOption
SummaryCardInsetMode sets the inset mode of the summary card block.
func SummaryCardMarkdown ¶ added in v0.2.0
func SummaryCardMarkdown() SummaryCardOption
SummaryCardMarkdown renders the summary card Body and Footer as inline markdown (see SummaryCardBlock.Markdown).
func SummaryCardTone ¶
func SummaryCardTone(value Tone) SummaryCardOption
SummaryCardTone sets the visual tone of the summary card block.
type TableBlock ¶
type TableBlock struct {
Header string
Columns []string
Rows [][]string
LegendSwatches []string
HasLegendSwatches bool
ZebraRows bool
Compact bool
Density TableDensityValue
HeaderTone TableHeaderToneValue
BorderStyle TableBorderStyleValue
RightAlignNumericColumns bool
EmphasizeTotalRow bool
ColumnAlignments map[int]TableColumnAlignmentValue
InsetMode InsetMode
}
TableBlock renders tabular data with configurable density and styling.
func (TableBlock) Kind ¶
func (block TableBlock) Kind() theme.BlockKind
func (TableBlock) LayoutSpec ¶
func (block TableBlock) LayoutSpec() LayoutSpec
func (TableBlock) RenderText ¶
func (block TableBlock) RenderText(_ RenderContext) (string, error)
func (TableBlock) TemplateData ¶
func (block TableBlock) TemplateData() any
type TableBorderStyleValue ¶
type TableBorderStyleValue string
TableBorderStyleValue defines the border line style used by table separators.
type TableColumnAlignmentValue ¶
type TableColumnAlignmentValue string
TableColumnAlignmentValue defines horizontal alignment for a table column.
type TableDensityValue ¶
type TableDensityValue string
TableDensityValue defines compactness for table row spacing.
type TableHeaderToneValue ¶
type TableHeaderToneValue string
TableHeaderToneValue defines the visual tone used by the table header row.
type TableOption ¶
type TableOption func(*TableBlock)
TableOption configures a TableBlock.
func TableBorderStyle ¶
func TableBorderStyle(value TableBorderStyleValue) TableOption
TableBorderStyle sets the table border style.
func TableColumnAlignments ¶
func TableColumnAlignments(value map[int]TableColumnAlignmentValue) TableOption
TableColumnAlignments sets explicit alignment per table column index.
func TableCompact ¶
func TableCompact(value bool) TableOption
TableCompact toggles compact table spacing.
func TableDensity ¶
func TableDensity(value TableDensityValue) TableOption
TableDensity sets the table density mode.
func TableEmphasizeTotalRow ¶
func TableEmphasizeTotalRow(value bool) TableOption
TableEmphasizeTotalRow toggles emphasized styling for the total row.
func TableHeaderTone ¶
func TableHeaderTone(value TableHeaderToneValue) TableOption
TableHeaderTone sets the table header tone.
func TableInsetMode ¶
func TableInsetMode(value InsetMode) TableOption
TableInsetMode sets the inset mode of the table.
func TableLegendSwatches ¶
func TableLegendSwatches(value []string) TableOption
TableLegendSwatches sets legend swatch colors for the table.
func TableRightAlignNumericColumns ¶
func TableRightAlignNumericColumns(value bool) TableOption
TableRightAlignNumericColumns toggles right alignment for numeric columns.
func TableZebraRows ¶
func TableZebraRows(value bool) TableOption
TableZebraRows toggles zebra striping for table rows.
type TextAlignmentValue ¶
type TextAlignmentValue string
TextAlignmentValue defines logical text alignment.
const ( TextAlignStart TextAlignmentValue = "start" TextAlignCenter TextAlignmentValue = "center" TextAlignEnd TextAlignmentValue = "end" )
type TextBlock ¶
type TextBlock struct {
Text string
Tone Tone
Size TextSizeValue
Align TextAlignmentValue
Weight TextWeightValue
NoMargin bool
Spacing TextSpacingValue
Transform TextTransformValue
// Markdown renders Text as inline markdown: [label](url) becomes a link
// in HTML and "label (url)" in plaintext. Emphasis markers are stripped.
// Enable only for authored strings; user-supplied text is not sanitized
// for markdown link targets (e.g. javascript: URLs).
Markdown bool
}
TextBlock renders styled paragraph text.
func (TextBlock) LayoutSpec ¶
func (block TextBlock) LayoutSpec() LayoutSpec
func (TextBlock) RenderText ¶
func (block TextBlock) RenderText(_ RenderContext) (string, error)
func (TextBlock) TemplateData ¶
type TextOption ¶
type TextOption func(*TextBlock)
TextOption configures a TextBlock.
func TextAlign ¶
func TextAlign(value TextAlignmentValue) TextOption
TextAlign sets logical alignment for a text block.
func TextMarkdown ¶ added in v0.2.0
func TextMarkdown() TextOption
TextMarkdown renders the text as inline markdown (see TextBlock.Markdown).
func TextNoMargin ¶
func TextNoMargin(value bool) TextOption
TextNoMargin toggles paragraph bottom margin for a text block.
func TextSize ¶
func TextSize(value TextSizeValue) TextOption
TextSize sets the size preset for a text block.
func TextSpacing ¶
func TextSpacing(value TextSpacingValue) TextOption
TextSpacing sets line-height spacing preset for a text block.
func TextTone ¶
func TextTone(value Tone) TextOption
TextTone sets the semantic tone for a text block.
func TextTransform ¶
func TextTransform(value TextTransformValue) TextOption
TextTransform sets text transform behavior for a text block.
func TextWeight ¶
func TextWeight(value TextWeightValue) TextOption
TextWeight sets the font weight preset for a text block.
type TextSizeValue ¶
type TextSizeValue string
TextSizeValue defines text size presets.
const ( TextSizeSmall TextSizeValue = "small" TextSizeBase TextSizeValue = "base" TextSizeLarge TextSizeValue = "large" )
type TextSpacingValue ¶
type TextSpacingValue string
TextSpacingValue defines line-height spacing presets.
const ( TextSpacingCompact TextSpacingValue = "compact" TextSpacingNormal TextSpacingValue = "normal" TextSpacingRelaxed TextSpacingValue = "relaxed" )
type TextTransformValue ¶
type TextTransformValue string
TextTransformValue defines text transform behavior.
const ( TextTransformNone TextTransformValue = "none" TextTransformUppercase TextTransformValue = "uppercase" TextTransformLowercase TextTransformValue = "lowercase" TextTransformCapitalize TextTransformValue = "capitalize" )
type TextWeightValue ¶
type TextWeightValue string
TextWeightValue defines text font-weight presets.
const ( TextWeightNormal TextWeightValue = "normal" TextWeightMedium TextWeightValue = "medium" TextWeightSemibold TextWeightValue = "semibold" TextWeightBold TextWeightValue = "bold" )
type TileAlignment ¶
type TileAlignment string
TileAlignment defines content alignment within each tile.
const ( // TileAlignmentCenter centers tile content. TileAlignmentCenter TileAlignment = "center" // TileAlignmentStart aligns tile content to the logical start edge. TileAlignmentStart TileAlignment = "start" // TileAlignmentEnd aligns tile content to the logical end edge. TileAlignmentEnd TileAlignment = "end" )
type TileEntry ¶
type TileEntry struct {
Content string
Title string
Subtitle string
URL string
Variant TileVariant
}
TileEntry is a single tile item rendered inside a TilesBlock.
type TileVariant ¶
type TileVariant string
TileVariant defines semantic styling for a tile.
const ( // TileVariantDefault renders the default tile styling. TileVariantDefault TileVariant = "default" // TileVariantHighlight renders an emphasized highlight style. TileVariantHighlight TileVariant = "highlight" // TileVariantSuccess renders success-oriented styling. TileVariantSuccess TileVariant = "success" // TileVariantWarning renders warning-oriented styling. TileVariantWarning TileVariant = "warning" // TileVariantCritical renders critical/error-oriented styling. TileVariantCritical TileVariant = "critical" )
type TilesBlock ¶
type TilesBlock struct {
Columns int
Border bool
TransparentBackground bool
Alignment TileAlignment
Entries []TileEntry
InsetMode InsetMode
}
TilesBlock renders multiple tile entries in a compact grid.
func (TilesBlock) Kind ¶
func (block TilesBlock) Kind() theme.BlockKind
func (TilesBlock) LayoutSpec ¶
func (block TilesBlock) LayoutSpec() LayoutSpec
func (TilesBlock) RenderText ¶
func (block TilesBlock) RenderText(_ RenderContext) (string, error)
func (TilesBlock) TemplateData ¶
func (block TilesBlock) TemplateData() any
type TilesOption ¶
type TilesOption func(*TilesBlock)
TilesOption configures a TilesBlock.
func TilesAlign ¶
func TilesAlign(value TileAlignment) TilesOption
TilesAlign sets alignment for tile content.
func TilesColumns ¶
func TilesColumns(value int) TilesOption
TilesColumns sets the number of tile columns.
func TilesInsetMode ¶
func TilesInsetMode(value InsetMode) TilesOption
TilesInsetMode sets the inset mode of the tiles block.
func TilesTransparentBackground ¶
func TilesTransparentBackground(value bool) TilesOption
TilesTransparentBackground toggles transparent tile backgrounds.
type TimelineBlock ¶
type TimelineBlock struct {
Header string
AggregateHeader string
HasCurrentIndex bool
CurrentIndex int
Items []TimelineItem
InsetMode InsetMode
// Markdown renders each item's Detail as inline markdown: [label](url)
// becomes a link in HTML and "label (url)" in plaintext; emphasis markers
// are stripped. Enable only for authored strings; targets are not sanitized.
Markdown bool
}
TimelineBlock renders chronological milestones or status updates.
func (TimelineBlock) Kind ¶
func (block TimelineBlock) Kind() theme.BlockKind
func (TimelineBlock) LayoutSpec ¶
func (block TimelineBlock) LayoutSpec() LayoutSpec
func (TimelineBlock) RenderText ¶
func (block TimelineBlock) RenderText(_ RenderContext) (string, error)
func (TimelineBlock) TemplateData ¶
func (block TimelineBlock) TemplateData() any
type TimelineItem ¶
TimelineItem is one timestamped entry in a TimelineBlock.
type TimelineOption ¶
type TimelineOption func(*TimelineBlock)
TimelineOption configures a TimelineBlock.
func TimelineAggregateHeader ¶
func TimelineAggregateHeader(value string) TimelineOption
TimelineAggregateHeader sets the aggregate header text for timeline groups.
func TimelineCurrentIndex ¶
func TimelineCurrentIndex(value int) TimelineOption
TimelineCurrentIndex sets the currently active timeline index.
func TimelineInsetMode ¶
func TimelineInsetMode(value InsetMode) TimelineOption
TimelineInsetMode sets the inset mode of the timeline.
func TimelineMarkdown ¶ added in v0.2.0
func TimelineMarkdown() TimelineOption
TimelineMarkdown renders each timeline item's Detail as inline markdown (see TimelineBlock.Markdown).
type Tone ¶
type Tone string
Tone defines semantic visual emphasis used by tone-aware blocks.
const ( // ToneDefault renders neutral/default styling. ToneDefault Tone = "default" // TonePrimary renders primary accent styling. TonePrimary Tone = "primary" // ToneSecondary renders secondary accent styling. ToneSecondary Tone = "secondary" // ToneMuted renders de-emphasized styling. ToneMuted Tone = "muted" // ToneInfo renders informational semantic styling. ToneInfo Tone = "info" // ToneSuccess renders success semantic styling. ToneSuccess Tone = "success" // ToneWarning renders warning semantic styling. ToneWarning Tone = "warning" // ToneDanger renders danger/error semantic styling. ToneDanger Tone = "danger" // ToneDark renders high-contrast dark styling. ToneDark Tone = "dark" )
type VerificationCodeBlock ¶
type VerificationCodeBlock struct {
Value string
Label string
Tone Tone
UseMonospace bool
CharacterSpacingEm float64
InsetMode InsetMode
// contains filtered or unexported fields
}
VerificationCodeBlock renders a labeled one-time verification code.
func (VerificationCodeBlock) Kind ¶
func (block VerificationCodeBlock) Kind() theme.BlockKind
func (VerificationCodeBlock) LayoutSpec ¶
func (block VerificationCodeBlock) LayoutSpec() LayoutSpec
func (VerificationCodeBlock) RenderText ¶
func (block VerificationCodeBlock) RenderText(_ RenderContext) (string, error)
func (VerificationCodeBlock) TemplateData ¶
func (block VerificationCodeBlock) TemplateData() any
type VerificationCodeOption ¶
type VerificationCodeOption func(*VerificationCodeBlock)
VerificationCodeOption configures a VerificationCodeBlock.
func VerificationCodeInsetMode ¶
func VerificationCodeInsetMode(value InsetMode) VerificationCodeOption
VerificationCodeInsetMode sets the inset mode of the verification code block.
func VerificationCodeMonospace ¶
func VerificationCodeMonospace(value bool) VerificationCodeOption
VerificationCodeMonospace toggles monospace rendering for the code value.
func VerificationCodeSpacing ¶
func VerificationCodeSpacing(value float64) VerificationCodeOption
VerificationCodeSpacing sets the code letter spacing in em units.
func VerificationCodeTone ¶
func VerificationCodeTone(value Tone) VerificationCodeOption
VerificationCodeTone sets the semantic tone of the verification code block.
type VerticalBarChartAxis ¶
type VerticalBarChartAxis struct {
ShowBaseline bool
ShowYTicks bool
HasDrawYAxisLine bool
DrawYAxisLine bool
HasShowCategoryLabels bool
ShowCategoryLabels bool
LabelFormat VerticalBarChartAxisLabelFormatValue
HasMin bool
Min float64
// HasMax enables a configured upper bound hint for the chart range.
// When true, Max is only used to raise the computed max range if needed.
// It does not clamp bars to a lower maximum than the data-derived max.
HasMax bool
// Max is the optional upper bound hint used when HasMax is true.
// Effective max is max(dataDerivedMax, Max).
Max float64
}
VerticalBarChartAxis configures baseline, tick visibility, label formatting, and range hints. Min can force the lower bound, while HasMax/Max can raise the upper bound when needed. Category labels and Y-axis line rendering can be independently toggled.
type VerticalBarChartAxisLabelFormatValue ¶
type VerticalBarChartAxisLabelFormatValue string
VerticalBarChartAxisLabelFormatValue controls axis tick label formatting.
const ( // VerticalBarChartAxisLabelFormatNumber renders numeric axis labels. VerticalBarChartAxisLabelFormatNumber VerticalBarChartAxisLabelFormatValue = "number" // VerticalBarChartAxisLabelFormatPercent renders percent axis labels. VerticalBarChartAxisLabelFormatPercent VerticalBarChartAxisLabelFormatValue = "percent" )
type VerticalBarChartBlock ¶
type VerticalBarChartBlock struct {
Title string
Subtitle string
AxisLabels []string
Series []VerticalBarChartSeries
Height int
Normalize bool
HasColumnGap bool
ColumnGap int
HasOuterGap bool
OuterGap int
TransparentBackground bool
Tone Tone
InsetMode InsetMode
LegendPlacement VerticalBarChartLegendPlacementValue
Legend []VerticalBarChartLegendItem
Axis VerticalBarChartAxis
ValueLabels VerticalBarChartValueLabels
ValueFormatter VerticalBarChartValueFormatter
}
VerticalBarChartBlock renders multi-series vertical columns with axis and legend controls.
func (VerticalBarChartBlock) Kind ¶
func (block VerticalBarChartBlock) Kind() theme.BlockKind
func (VerticalBarChartBlock) LayoutSpec ¶
func (block VerticalBarChartBlock) LayoutSpec() LayoutSpec
func (VerticalBarChartBlock) RenderText ¶
func (block VerticalBarChartBlock) RenderText(_ RenderContext) (string, error)
func (VerticalBarChartBlock) TemplateData ¶
func (block VerticalBarChartBlock) TemplateData() any
type VerticalBarChartColumnView ¶
type VerticalBarChartColumnView struct {
Label string
PositiveSegments []VerticalBarChartSegmentView
NegativeSegments []VerticalBarChartSegmentView
PositiveTopPadding int
PositiveAboveLabel string
PositiveAboveLabelColor string
}
VerticalBarChartColumnView is the normalized render-time representation of one chart column. Positive and negative segments are split to support charts that cross a zero baseline, with separate padding/above-label metadata for positive stacks.
type VerticalBarChartLegendConfig ¶
type VerticalBarChartLegendConfig struct {
Placement VerticalBarChartLegendPlacementValue
Items []VerticalBarChartLegendItem
}
VerticalBarChartLegendConfig controls legend placement and explicit legend items.
type VerticalBarChartLegendItem ¶
VerticalBarChartLegendItem represents a single legend entry for a series color/label pair.
type VerticalBarChartLegendPlacementValue ¶
type VerticalBarChartLegendPlacementValue string
VerticalBarChartLegendPlacementValue controls where the chart legend is rendered.
const ( // VerticalBarChartLegendNone hides the legend. VerticalBarChartLegendNone VerticalBarChartLegendPlacementValue = "none" // VerticalBarChartLegendBottom renders the legend below the chart. VerticalBarChartLegendBottom VerticalBarChartLegendPlacementValue = "bottom" )
type VerticalBarChartMagnitudeSuffixValue ¶
type VerticalBarChartMagnitudeSuffixValue string
VerticalBarChartMagnitudeSuffixValue controls compact magnitude suffix formatting.
const ( // VerticalBarChartMagnitudeSuffixNone disables compact number suffixes. VerticalBarChartMagnitudeSuffixNone VerticalBarChartMagnitudeSuffixValue = "none" // VerticalBarChartMagnitudeSuffixShort enables compact suffixes like K/M/B. VerticalBarChartMagnitudeSuffixShort VerticalBarChartMagnitudeSuffixValue = "short" )
type VerticalBarChartNegativeFormatValue ¶
type VerticalBarChartNegativeFormatValue string
VerticalBarChartNegativeFormatValue controls negative number formatting style.
const ( // VerticalBarChartNegativeFormatMinus renders negatives with a leading minus sign. VerticalBarChartNegativeFormatMinus VerticalBarChartNegativeFormatValue = "minus" // VerticalBarChartNegativeFormatParentheses renders negatives in parentheses. VerticalBarChartNegativeFormatParentheses VerticalBarChartNegativeFormatValue = "parentheses" )
type VerticalBarChartOption ¶
type VerticalBarChartOption func(*VerticalBarChartBlock)
VerticalBarChartOption configures a VerticalBarChartBlock.
func VerticalBarChartAxisConfig ¶
func VerticalBarChartAxisConfig(value VerticalBarChartAxis) VerticalBarChartOption
VerticalBarChartAxisConfig replaces the full axis configuration.
func VerticalBarChartAxisDrawYAxisLine ¶
func VerticalBarChartAxisDrawYAxisLine(value bool) VerticalBarChartOption
VerticalBarChartAxisDrawYAxisLine toggles rendering the Y-axis line.
func VerticalBarChartAxisLabelFormat ¶
func VerticalBarChartAxisLabelFormat(value VerticalBarChartAxisLabelFormatValue) VerticalBarChartOption
VerticalBarChartAxisLabelFormat sets axis label formatting style.
func VerticalBarChartAxisMax ¶
func VerticalBarChartAxisMax(value float64) VerticalBarChartOption
VerticalBarChartAxisMax sets an explicit maximum axis value.
func VerticalBarChartAxisMin ¶
func VerticalBarChartAxisMin(value float64) VerticalBarChartOption
VerticalBarChartAxisMin sets an explicit minimum axis value.
func VerticalBarChartAxisShowBaseline ¶
func VerticalBarChartAxisShowBaseline(value bool) VerticalBarChartOption
VerticalBarChartAxisShowBaseline toggles rendering the baseline.
func VerticalBarChartAxisShowCategoryLabels ¶
func VerticalBarChartAxisShowCategoryLabels(value bool) VerticalBarChartOption
VerticalBarChartAxisShowCategoryLabels toggles category labels on the axis.
func VerticalBarChartAxisShowYTicks ¶
func VerticalBarChartAxisShowYTicks(value bool) VerticalBarChartOption
VerticalBarChartAxisShowYTicks toggles rendering Y-axis ticks.
func VerticalBarChartCategoryGap ¶
func VerticalBarChartCategoryGap(value int) VerticalBarChartOption
VerticalBarChartCategoryGap is kept as a compatibility alias. Prefer VerticalBarChartColumnGap for clarity.
func VerticalBarChartColumnGap ¶
func VerticalBarChartColumnGap(value int) VerticalBarChartOption
VerticalBarChartColumnGap sets spacing between columns in pixels.
func VerticalBarChartHeight ¶
func VerticalBarChartHeight(value int) VerticalBarChartOption
VerticalBarChartHeight sets chart height in pixels.
func VerticalBarChartInsetMode ¶
func VerticalBarChartInsetMode(value InsetMode) VerticalBarChartOption
VerticalBarChartInsetMode sets the inset mode of the vertical bar chart.
func VerticalBarChartLegend ¶
func VerticalBarChartLegend(items []VerticalBarChartLegendItem) VerticalBarChartOption
VerticalBarChartLegend sets legend items for the chart.
func VerticalBarChartLegendConfigOption ¶
func VerticalBarChartLegendConfigOption(value VerticalBarChartLegendConfig) VerticalBarChartOption
VerticalBarChartLegendConfigOption sets legend placement and items together.
func VerticalBarChartLegendPlacement ¶
func VerticalBarChartLegendPlacement(value VerticalBarChartLegendPlacementValue) VerticalBarChartOption
VerticalBarChartLegendPlacement sets where the legend is rendered.
func VerticalBarChartNormalize ¶
func VerticalBarChartNormalize(value bool) VerticalBarChartOption
VerticalBarChartNormalize enables per-column normalization where segment heights fill the available positive/negative region in each column.
For mixed-sign datasets (any negative value present), Myrtle automatically falls back to magnitude scaling to preserve cross-column comparability.
func VerticalBarChartOuterGap ¶
func VerticalBarChartOuterGap(value int) VerticalBarChartOption
VerticalBarChartOuterGap sets outer chart padding in pixels.
func VerticalBarChartSubtitle ¶
func VerticalBarChartSubtitle(value string) VerticalBarChartOption
VerticalBarChartSubtitle sets the chart subtitle.
func VerticalBarChartTitle ¶
func VerticalBarChartTitle(value string) VerticalBarChartOption
VerticalBarChartTitle sets the chart title.
func VerticalBarChartTone ¶
func VerticalBarChartTone(value Tone) VerticalBarChartOption
VerticalBarChartTone sets the tone of the vertical bar chart.
func VerticalBarChartTransparentBackground ¶
func VerticalBarChartTransparentBackground(value bool) VerticalBarChartOption
VerticalBarChartTransparentBackground toggles a transparent chart background.
func VerticalBarChartValueFormatterOption ¶
func VerticalBarChartValueFormatterOption(value VerticalBarChartValueFormatter) VerticalBarChartOption
VerticalBarChartValueFormatterOption sets value formatting rules.
func VerticalBarChartValueLabelsOption ¶
func VerticalBarChartValueLabelsOption(value VerticalBarChartValueLabels) VerticalBarChartOption
VerticalBarChartValueLabelsOption sets value label rendering options.
type VerticalBarChartSegmentView ¶
type VerticalBarChartSegmentView struct {
Series string
Label string
Value float64
Color string
ValueLabelColor string
Display string
SignedDisplay string
Height int
}
VerticalBarChartSegmentView is the normalized render-time representation of one segment.
type VerticalBarChartSeries ¶
type VerticalBarChartSeries struct {
Key string
Label string
Color string
ValueLabelColor string
Values []float64
}
VerticalBarChartSeries defines one stacked series across all chart columns. Values are aligned by index with AxisLabels, and optional Color/ValueLabelColor override theme-derived defaults for segment fills and in-segment value labels.
type VerticalBarChartTemplateData ¶
type VerticalBarChartTemplateData struct {
Title string
Subtitle string
InsetMode InsetMode
Columns []VerticalBarChartColumnView
Legend []VerticalBarChartLegendItem
LegendPlacement VerticalBarChartLegendPlacementValue
Height int
ColumnGap int
OuterGap int
LegendStartOffset int
PositiveHeight int
NegativeHeight int
ShowBaseline bool
ShowCategoryLabels bool
ShowYTicks bool
DrawYAxisLine bool
YAxisWidth int
YAxisMaxLabel string
YAxisZeroLabel string
ShowValueLabels bool
ValueLabelMinHeight int
ValueLabelColor string
Ticks []VerticalBarChartTickView
TransparentBackground bool
Tone Tone
}
VerticalBarChartTemplateData is the fully normalized rendering payload passed to templates. It includes computed geometry (heights, gaps, axis widths), preformatted labels, and pre-split positive/negative column segment data so templates remain mostly presentational.
type VerticalBarChartTickView ¶
type VerticalBarChartTickView struct {
Label string
}
VerticalBarChartTickView is a normalized Y-axis tick label used during template rendering.
type VerticalBarChartValueFormatter ¶
type VerticalBarChartValueFormatter struct {
Prefix string
Suffix string
MagnitudeSuffix VerticalBarChartMagnitudeSuffixValue
NegativeFormat VerticalBarChartNegativeFormatValue
}
VerticalBarChartValueFormatter controls numeric formatting for axis labels and value labels. Prefix and Suffix are applied around formatted values, MagnitudeSuffix enables compact scaling (for example 1200 -> 1.2K), and NegativeFormat controls how negative numbers are rendered.
type VerticalBarChartValueLabels ¶
VerticalBarChartValueLabels controls in-bar value labels for each segment.
Source Files
¶
- blocks_buttons.go
- blocks_content.go
- blocks_core.go
- blocks_dataviz.go
- blocks_layout_advanced.go
- blocks_marketing.go
- blocks_messaging.go
- blocks_table.go
- blocks_tiles.go
- blocks_vertical_bar_chart.go
- builder_blocks.go
- builder_footer.go
- builder_group.go
- builder_header.go
- builder_types.go
- custom_block.go
- email.go
- header_footer.go
Directories
¶
| Path | Synopsis |
|---|---|
|
server/cmd
command
|
|
|
Package themetest contains tests for theme implementations.
|
Package themetest contains tests for theme implementations. |












