Skip to main content

ALToolbox.display_template

re

*

b64encode

__all__

display_template

def display_template(template,
scrollable=True,
collapse=False,
copy=False,
classname="bg-light",
class_name=None,
h_level=2) -> str

Display a template with optional scrolling, collapsing, and copy functionality.

Renders a template in a styled container with various display options including scrollable content, collapsible sections, and copy-to-clipboard functionality. Supports both the current classname parameter and the deprecated class_name parameter for backwards compatibility.

Arguments

  • template - A docassemble template object with content to display.
  • scrollable bool, optional - Whether the content should be scrollable. Defaults to True.
  • collapse bool, optional - Whether the content should be collapsible. Defaults to False.
  • copy bool, optional - Whether to include a copy-to-clipboard button. Defaults to False.
  • classname str, optional - CSS class name for styling the container. Defaults to "bg-light".
  • class_name str, optional - Deprecated parameter for CSS class name. Defaults to None.
  • h_level int, optional - The HTML heading level for the template subject. Must be between 1 and 6. Defaults to 2.

Returns

HTML string containing the rendered template with the specified display options.

Example

>>> display_template(my_template, scrollable=True, collapse=True)
'<div id="..." class="al_display_template">...</div>'