duck.html.components.footer¶
Footer component module.
Module Contents¶
Classes¶
Premium, flexible site footer. |
|
A single footer column: a heading plus a list of link/text elements. |
|
Small-caps section heading used inside a footer block. |
|
Main container laying out footer blocks in a responsive grid. |
|
Just plain simple footer without anything. |
|
Row of social/contact icon links with a premium hover treatment. |
Data¶
API¶
- duck.html.components.footer.DEFAULT_SOCIAL_ICONS¶
None
- duck.html.components.footer.DUCK_URL¶
- 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.InnerComponentPremium, flexible site footer.
- Parameters:
footer_items – Mapping of footer block headings to their list of html components.
social_links – See
SocialLinksfor 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.
- build_copyright() → duck.html.components.Component[source]¶
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.
- build_duck_link() → duck.html.components.link.Link[source]¶
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.
- 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.FlexContainerA 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.
- class duck.html.components.footer.FooterHeading(type: str, text: str = None, *args, **kwargs)[source]¶
Bases:
duck.html.components.heading.HeadingSmall-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.
- 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.GridContainerMain 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.
- duck.html.components.footer.GITHUB_URL¶
- 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.InnerComponentJust 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.
- class duck.html.components.footer.SocialLinks(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.FlexContainerRow 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.
- build_icon_link(entry: dict[str, Any]) → duck.html.components.link.Link[source]¶
Builds a single circular icon link from a social link entry.
- Parameters:
entry – A social link entry, see
social_linksabove.- Returns:
A Link component wrapping the platform’s icon.
- build_icon_links() → list[duck.html.components.link.Link][source]¶
Builds one circular icon link per configured social entry.
- Returns:
List of Link components, each wrapping a social platform icon.