quirl.components.spinner

A loading spinner with theme-aware color.

Module Contents

Classes

Spinner

A loading spinner with theme-aware color.

Data

API

quirl.components.spinner.SIZE_MAP

None

class quirl.components.spinner.Spinner(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.Container

A loading spinner with theme-aware color.

Renders as a rotating ring by default, or a trio of bouncing dots in the iOS activity-indicator style.

Note: requires quirl.styles.quirl_global_styles() added to the page head for the animation to run.

Usage:

Spinner(size="md", color="var(--theme-accent-color)")
Spinner(variant="dots")

Optional Props:

  • variant: One of ring, dots. Defaults to ring.

  • size: One of sm, md, lg. Defaults to md.

  • color: Spinner color, defaults to var(–theme-accent-color)

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_dots() None[source]

Style this component as three bouncing dots.

build_ring() None[source]

Style this component as a rotating ring indicator.

docs_preview_kwargs

None

on_create()[source]

Build the spinner as a rotating ring or bouncing dots.