duck.html.components.footer

Footer component module.

Module Contents

Classes

Footer

Premium, flexible site footer.

FooterBlock

A single footer column: a heading plus a list of link/text elements.

FooterHeading

Small-caps section heading used inside a footer block.

FooterItems

Main container laying out footer blocks in a responsive grid.

PlainFooter

Just plain simple footer without anything.

SocialLinks

Row of social/contact icon links with a premium hover treatment.

Data

DEFAULT_SOCIAL_ICONS

DUCK_URL

GITHUB_URL

API

duck.html.components.footer.DEFAULT_SOCIAL_ICONS

None

duck.html.components.footer.DUCK_URL

https://duckframework.com

class duck.html.components.footer.Footer(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]

Bases: duck.html.components.InnerComponent

Premium, flexible site footer.

Parameters:
  • footer_items – Mapping of footer block headings to their list of html components.

  • social_links – See SocialLinks for shape.

  • tagline – Short line shown above the footer blocks.

  • copyright – Copyright text. Defaults to a generated “© . All rights reserved.” string built from central site metadata.

  • show_made_with_duck – Whether to show the “made with Duck” badge. Defaults to True.

  • accent – Accent color for the top divider glow. Defaults to Theme.current.accent_color.

  • background – The background for footer. Defaults to Theme.current.surface_color

Example Usage:

Footer(
    tagline="Something here",
    footer_items={
        "Company": [
            Link(text="About Us", url="/about"),
            Link(text="Contact Us", url="/contact"),
        ],
        "Legal": [
            Link(text="Privacy Policy", url="/privacy"),
            Link(text="Terms & Conditions", url="/terms"),
        ],
    },
    social_links=[
        {"platform": "instagram", "url": "https://instagram.com/example"},
        {"platform": "twitter", "url": "https://twitter.com/example"},
    ],
)

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_bottom_bar() duck.html.components.container.FlexContainer[source]

Assembles the badge, social links, and copyright row.

Returns:

A FlexContainer holding the footer’s bottom bar content.

Builds the copyright line, defaulting to generated site metadata.

Returns:

A Component rendering the copyright text.

build_default_background() str[source]

Builds the footer’s default gradient background from the active theme.

Fades from transparent into the theme’s surface color, so the footer blends into whatever sits above it.

Returns:

A CSS linear-gradient string.

Builds the “made with Duck” badge, pointing to the right domain.

Returns:

A Link component wrapping the MadeWithDuck badge.

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

Builds the footer’s scoped and responsive css.

Returns:

A Style component containing the footer’s stylesheet.

build_tagline() duck.html.components.Component[source]

Builds the short tagline paragraph shown above the footer columns.

Returns:

A Component rendering the tagline text.

get_element() str[source]
on_create() None[source]
class duck.html.components.footer.FooterBlock(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]

Bases: duck.html.components.container.FlexContainer

A single footer column: a heading plus a list of link/text elements.

Parameters:
  • heading – The heading for the footer block.

  • elements – Block elements, either raw html strings (e.g. produced by a {% Link %} template tag) or already-built Component instances.

  • heading_color – Optional override for the heading color.

… admonition:: Notes

A footer may render several blocks side by side, each with its own heading and items.

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_children() list[duck.html.components.Component][source]

Builds the heading (if any) followed by the block’s elements.

Returns:

List of Component instances ready to be added as children.

on_create() None[source]
class duck.html.components.footer.FooterHeading(type: str, text: str = None, *args, **kwargs)[source]

Bases: duck.html.components.heading.Heading

Small-caps section heading used inside a footer block.

Parameters:

heading_color – Optional color override for the heading text.

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.

on_create() None[source]
class duck.html.components.footer.FooterItems(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]

Bases: duck.html.components.container.GridContainer

Main container laying out footer blocks in a responsive grid.

Parameters:

footer_items – Mapping of footer block headings to their list of elements.

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_blocks() list[duck.html.components.footer.FooterBlock][source]

Builds one FooterBlock per configured heading.

Returns:

List of FooterBlock components.

on_create() None[source]
duck.html.components.footer.GITHUB_URL

https://github.com/duckframework/duck

class duck.html.components.footer.PlainFooter(element: Optional[str] = None, properties: Optional[Dict[str, str]] = None, props: Optional[Dict[str, str]] = None, style: Optional[Dict[str, str]] = None, inner_html: Optional[Union[str, str, float]] = None, children: Optional[List[duck.html.components.HtmlComponent]] = None, **kwargs)[source]

Bases: duck.html.components.InnerComponent

Just plain simple footer without anything.

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.

get_element()[source]

Bases: duck.html.components.container.FlexContainer

Row of social/contact icon links with a premium hover treatment.

Parameters:

social_links

Each entry supports:

  • platform (str): Key into DEFAULT_SOCIAL_ICONS, e.g. “twitter”.

  • url (str): Destination url.

  • icon (str, optional): Raw svg to use instead of the default.

  • label (str, optional): Accessible label, defaults to platform.

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.

Builds a single circular icon link from a social link entry.

Parameters:

entry – A social link entry, see social_links above.

Returns:

A Link component wrapping the platform’s icon.

Builds one circular icon link per configured social entry.

Returns:

List of Link components, each wrapping a social platform icon.

on_create() None[source]