duck.etc.blueprints.welcome.ui.components.code_showcase¶
CodeShowcase component — a two-column grid of syntax-highlighted code snippets demonstrating a Duck Framework page and a Lively component.
Module Contents¶
Classes¶
Renders two side-by-side code cards with macOS-style window chrome. |
Data¶
API¶
- class duck.etc.blueprints.welcome.ui.components.code_showcase.CodeShowcase(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.ContainerRenders two side-by-side code cards with macOS-style window chrome.
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.
**kwargs – Extra keyword arguments
- Raises:
HtmlComponentError – If ‘element’ is not a string or ‘inner_html’ is set but ‘accept_inner_html’ is False.
- build_card(title: str, code: str) duck.html.components.container.Container[source]¶
Returns a code card with macOS-style chrome header and syntax body.
- Parameters:
title – Label shown in the card header toolbar.
code – Raw Python source code.
- Returns:
A Container styled as the code card.
- duck.etc.blueprints.welcome.ui.components.code_showcase.DUCK_PAGE_CODE¶
‘strip(…)’
- duck.etc.blueprints.welcome.ui.components.code_showcase.LIVELY_COMPONENT_CODE¶
‘strip(…)’