Search Apps Documentation Source Content File Folder Download Copy Actions Download State String Boolean Number Struct Map Slice Pointer Function Closure Reference Nil Package Type Interface Unknown

svgbtn source pure

Package svgbtn provides utilities for generating SVG-styled buttons as Markdown image links.

Overview

Package svgbtn provides utilities for generating SVG-styled buttons as Markdown image links.

Buttons are rendered as SVG images with customizable size, colors, labels, and links. This package includes preconfigured styles such as Primary, Danger, Success, Small, Wide, Text-like, and Icon buttons, as well as a factory method for dynamic button creation.

Example usage:

Example
1func Render(_ string) string {
2	btn := svgbtn.PrimaryButton(120, 40, "Click Me", "https://example.com")
3	return btn
4}

See more examples at gno.land/r/leon:buttons

All buttons are returned as Markdown-compatible strings: [svg_data](link).

Functions 10

func Button

1func Button(width, height int, btnColor, textColor, text, link string) string
source

Button creates a base SVG button with given size, colors, label, and link. - `width`, `height`: size in pixels - `btnColor`: background color (e.g. "#007BFF") - `textColor`: label color (e.g. "#FFFFFF") - `text`: visible button label - `link`: URL to wrap the image in markdown-style svg(link)

func ButtonFactory

1func ButtonFactory(kind string, width, height int, text, link string) string
source

ButtonFactory provides a named-style constructor for buttons. Supported kinds: "primary", "danger", "success", "small", "wide", "text", "icon".

func ButtonWithRadius

1func ButtonWithRadius(width, height, radius int, btnColor, textColor, text, link string) string
source

ButtonWithRadius creates a base SVG button with custom border radius. - `width`, `height`: size in pixels - `radius`: border radius in pixels - `btnColor`: background color (e.g. "#007BFF") - `textColor`: label color (e.g. "#FFFFFF") - `text`: visible button label - `link`: URL to wrap the image in markdown-style svg(link)

func DangerButton

1func DangerButton(width, height int, text, link string) string
source

DangerButton renders a red button with white text.

func IconButton

1func IconButton(width, height int, icon, link string) string
source

IconButton renders a square button with an icon character (e.g. emoji).

func PrimaryButton

1func PrimaryButton(width, height int, text, link string) string
source

PrimaryButton renders a blue button with white text.

func SmallButton

1func SmallButton(width, height int, text, link string) string
source

SmallButton renders a compact gray button with white text.

func SuccessButton

1func SuccessButton(width, height int, text, link string) string
source

SuccessButton renders a green button with white text.

func TextButton

1func TextButton(width, height int, text, link string) string
source

TextButton renders a white button with colored text, like a hyperlink.

func WideButton

1func WideButton(width, height int, text, link string) string
source

WideButton renders a wider cyan button with white text.

Imports 2

Source Files 2