compose.add_cta_button

compose.add_cta_button(label, url, bg_color='#007bff', text_color='#ffffff')

Create a call-to-action button.

Parameters

label : str

Button text.

url : str

Target URL.

bg_color : str = '#007bff'

Button background color (hex). Default is "#007bff".

text_color : str = '#ffffff'

Button text color (hex). Default is "#ffffff".

Returns

: str

HTML button element that can be embedded in emails.

Examples

from nbmail.compose import add_cta_button, block_text, compose_email

button_html = add_cta_button("Learn More", "https://example.com")

compose_email(
    body=block_text(f"Ready?\n\n{button_html}")
)