duck.html.components.duck

Module containing Duck specific components.

Module Contents

Classes

MadeWithDuck

A small clickable badge reading “Made with Duck”.

Data

DEFAULT_LOGO_SRC

DEFAULT_TEXT

DEFAULT_URL

API

duck.html.components.duck.DEFAULT_LOGO_SRC

‘images/duck-logo.png’

duck.html.components.duck.DEFAULT_TEXT

‘Made with Duck’

duck.html.components.duck.DEFAULT_URL

https://duckframework.com

class duck.html.components.duck.MadeWithDuck(url: str = None, text: str = None, *args, **kwargs)[source]

Bases: duck.html.components.link.Link, duck.html.components.container.FlexContainer

A small clickable badge reading “Made with Duck”.

Renders as a pill-shaped chip with the Duck logo, label text, and a trailing arrow. On hover the badge lifts, its border picks up an accent color, the logo gives a small wiggle, and the arrow slides — inviting a click rather than sitting there as a static credit line.

Parameters:
  • url – Link target. Defaults to duckframework.com.

  • text – Label text. Defaults to “Made with Duck”.

  • logo_src – Static path to the logo image.

  • accent_color – Hover border/glow color. Defaults to Theme.current.accent_color.

  • id – Element id, used to scope the hover styling.

Initialization

Initialize an HTML component.

Parameters:
  • element – The HTML element tag name (e.g., textarea, input, button). Can be None, but make sure element is returned by get_element method.

  • accept_inner_html – Whether the HTML component accepts an inner body (e.g., inner-body-here).

  • inner_html – Inner html to add to the HTML component. Defaults to None.

  • properties – Dictionary for properties to initialize the component with.

  • props – Just same as properties argument (added for simplicity).

  • style – Dictionary for style to initialize the component with.

  • event_handlers – Events to automatically bind. Each dictionary maps an event name to its handler and may include additional keyword arguments forwarded to bind(), e.g. event_handlers=[{"click": on_button_click, **extra_kwargs}].

  • **kwargs – Extra keyword arguments

Raises:

HtmlComponentError – If ‘element’ is not a string or ‘inner_html’ is set but ‘accept_inner_html’ is False.

build_arrow()[source]

Builds the trailing arrow that slides on hover.

Returns:

A Component rendering the arrow glyph.

build_children() list[source]

Builds the badge’s logo, label, and trailing arrow.

Returns:

List of components making up the badge content.

build_label() duck.html.components.label.Label[source]

Builds the badge’s label text.

Returns:

A configured Label component.

Builds the small circular Duck logo shown at the start of the badge.

Returns:

A configured Image component.

build_style() duck.html.components.style.Style[source]

Builds the badge’s hover styling, scoped to this instance’s id.

Returns:

A Style component containing the badge’s css rules.

on_create() None[source]