Skip to content

Placeholder

Placeholder

Bases: Widget

A simple placeholder widget to use before you build your custom widgets.

This placeholder has a couple of variants that show different data. Clicking the placeholder cycles through the available variants, but a placeholder can also be initialised in a specific variant.

The variants available are:

Variant Placeholder shows
default Identifier label or the ID of the placeholder.
size Size of the placeholder.
text Lorem Ipsum text.

__init__(label=None, variant='default', *, name=None, id=None, classes=None)

Create a Placeholder widget.

Parameters:

Name Type Description Default
label str | None

The label to identify the placeholder. If no label is present, uses the placeholder ID instead. Defaults to None.

None
variant PlaceholderVariant

The variant of the placeholder. Defaults to "default".

'default'
name str | None

The name of the placeholder. Defaults to None.

None
id str | None

The ID of the placeholder in the DOM. Defaults to None.

None
classes str | None

A space separated string with the CSS classes of the placeholder, if any. Defaults to None.

None

cycle_variant()

Get the next variant in the cycle.

on_click()

Click handler to cycle through the placeholder variants.

on_resize(event)

Update the placeholder "size" variant with the new placeholder size.

reset_color_cycle() classmethod

Reset the placeholder background color cycle.

validate_variant(variant)

Validate the variant to which the placeholder was set.