Skip to content

Python Components

Component definitions.

All CamelCase names in the namespace should be components.

FormField module-attribute

Union of all form field types.

CodeStyle module-attribute

CodeStyle = Annotated[Union[str, None], Field(serialization_alias='codeStyle')]

Code style to apply to a Code component.

Attributes:

Name Type Description
codeStyle

The code style to apply. If None, no style is applied.

See Also

AnyComponent module-attribute

Union of all components.

Pydantic discriminator field is set to 'type' to allow for efficient serialization and deserialization of the components.

Details

Bases: BaseModel

Details associated with displaying a data model.

data instance-attribute

data: SerializeAsAny[DataModel]

Data model to display.

fields class-attribute instance-attribute

fields: Union[List[Union[DisplayLookup, Display]], None] = None

Fields to display.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the details component.

type class-attribute instance-attribute

type: Literal['Details'] = 'Details'

The type of the component. Always 'Details'.

Display

Bases: DisplayBase

Description of how to display a value, either in a table or detail view.

mode class-attribute instance-attribute

mode: Union[DisplayMode, None] = None

Display mode for the value.

title class-attribute instance-attribute

title: Union[str, None] = None

Title to display for the value.

on_click class-attribute instance-attribute

on_click: Union[AnyEvent, None] = None

Event to trigger when the value is clicked.

value instance-attribute

value: JsonData

Value to display.

type class-attribute instance-attribute

type: Literal['Display'] = 'Display'

The type of the component. Always 'Display'.

Form

Bases: BaseForm

Form component.

submit_url instance-attribute

submit_url: str

URL to submit the form data to.

initial class-attribute instance-attribute

initial: Union[Dict[str, JsonData], None] = None

Initial values for the form fields, mapping field names to values.

method class-attribute instance-attribute

method: Literal['POST', 'GOTO', 'GET'] = 'POST'

HTTP method to use for the form submission.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'page', 'inline'], None] = None

Display mode for the form.

submit_on_change class-attribute instance-attribute

submit_on_change: Union[bool, None] = None

Whether to submit the form on change.

submit_trigger class-attribute instance-attribute

submit_trigger: Union[PageEvent, None] = None

Event to trigger form submission.

loading class-attribute instance-attribute

loading: Union[List[AnyComponent], None] = None

Components to display while the form is submitting.

footer class-attribute instance-attribute

footer: Union[List[AnyComponent], None] = None

Components to display in the form footer.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the form's HTML component.

form_fields instance-attribute

form_fields: List[FormField]

List of form fields.

type class-attribute instance-attribute

type: Literal['Form'] = 'Form'

The type of the component. Always 'Form'.

FormFieldBoolean

Bases: BaseFormField

Form field for boolean input.

name instance-attribute

name: str

Name of the field.

title instance-attribute

title: Union[List[str], str]

Title of the field to display. Can be a list of strings for multi-line titles.

required class-attribute instance-attribute

required: bool = False

Whether the field is required. Defaults to False.

error class-attribute instance-attribute

error: Union[str, None] = None

Error message to display if the field is invalid.

locked class-attribute instance-attribute

locked: bool = False

Whether the field is locked. Defaults to False.

description class-attribute instance-attribute

description: Union[str, None] = None

Description of the field.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'inline'], None] = None

Display mode for the field.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the field's HTML component.

initial class-attribute instance-attribute

initial: Union[bool, None] = None

Initial value for the field.

mode class-attribute instance-attribute

mode: Literal['checkbox', 'switch'] = 'checkbox'

Mode for the boolean field.

type class-attribute instance-attribute

type: Literal['FormFieldBoolean'] = 'FormFieldBoolean'

The type of the component. Always 'FormFieldBoolean'.

FormFieldFile

Bases: BaseFormField

Form field for file input.

name instance-attribute

name: str

Name of the field.

title instance-attribute

title: Union[List[str], str]

Title of the field to display. Can be a list of strings for multi-line titles.

required class-attribute instance-attribute

required: bool = False

Whether the field is required. Defaults to False.

error class-attribute instance-attribute

error: Union[str, None] = None

Error message to display if the field is invalid.

locked class-attribute instance-attribute

locked: bool = False

Whether the field is locked. Defaults to False.

description class-attribute instance-attribute

description: Union[str, None] = None

Description of the field.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'inline'], None] = None

Display mode for the field.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the field's HTML component.

multiple class-attribute instance-attribute

multiple: Union[bool, None] = None

Whether multiple files can be selected.

accept class-attribute instance-attribute

accept: Union[str, None] = None

Accepted file types.

type class-attribute instance-attribute

type: Literal['FormFieldFile'] = 'FormFieldFile'

The type of the component. Always 'FormFieldFile'.

FormFieldInput

Bases: BaseFormField

Form field for basic input.

name instance-attribute

name: str

Name of the field.

title instance-attribute

title: Union[List[str], str]

Title of the field to display. Can be a list of strings for multi-line titles.

required class-attribute instance-attribute

required: bool = False

Whether the field is required. Defaults to False.

error class-attribute instance-attribute

error: Union[str, None] = None

Error message to display if the field is invalid.

locked class-attribute instance-attribute

locked: bool = False

Whether the field is locked. Defaults to False.

description class-attribute instance-attribute

description: Union[str, None] = None

Description of the field.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'inline'], None] = None

Display mode for the field.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the field's HTML component.

html_type class-attribute instance-attribute

html_type: InputHtmlType = 'text'

HTML input type for the field.

initial class-attribute instance-attribute

initial: Union[str, float, None] = None

Initial value for the field.

placeholder class-attribute instance-attribute

placeholder: Union[str, None] = None

Placeholder text for the field.

autocomplete class-attribute instance-attribute

autocomplete: Union[str, None] = None

Autocomplete value for the field.

type class-attribute instance-attribute

type: Literal['FormFieldInput'] = 'FormFieldInput'

The type of the component. Always 'FormFieldInput'.

FormFieldSelect

Bases: BaseFormField

Form field for select input.

name instance-attribute

name: str

Name of the field.

title instance-attribute

title: Union[List[str], str]

Title of the field to display. Can be a list of strings for multi-line titles.

required class-attribute instance-attribute

required: bool = False

Whether the field is required. Defaults to False.

error class-attribute instance-attribute

error: Union[str, None] = None

Error message to display if the field is invalid.

locked class-attribute instance-attribute

locked: bool = False

Whether the field is locked. Defaults to False.

description class-attribute instance-attribute

description: Union[str, None] = None

Description of the field.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'inline'], None] = None

Display mode for the field.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the field's HTML component.

options instance-attribute

options: SelectOptions

Options for the select field.

multiple class-attribute instance-attribute

multiple: Union[bool, None] = None

Whether multiple options can be selected.

initial class-attribute instance-attribute

initial: Union[List[str], str, None] = None

Initial value for the field.

vanilla class-attribute instance-attribute

vanilla: Union[bool, None] = None

Whether to use a vanilla (plain) select element.

placeholder class-attribute instance-attribute

placeholder: Union[str, None] = None

Placeholder text for the field.

autocomplete class-attribute instance-attribute

autocomplete: Union[str, None] = None

Autocomplete value for the field.

type class-attribute instance-attribute

type: Literal['FormFieldSelect'] = 'FormFieldSelect'

The type of the component. Always 'FormFieldSelect'.

FormFieldSelectSearch

Bases: BaseFormField

Form field for searchable select input.

name instance-attribute

name: str

Name of the field.

title instance-attribute

title: Union[List[str], str]

Title of the field to display. Can be a list of strings for multi-line titles.

required class-attribute instance-attribute

required: bool = False

Whether the field is required. Defaults to False.

error class-attribute instance-attribute

error: Union[str, None] = None

Error message to display if the field is invalid.

locked class-attribute instance-attribute

locked: bool = False

Whether the field is locked. Defaults to False.

description class-attribute instance-attribute

description: Union[str, None] = None

Description of the field.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'inline'], None] = None

Display mode for the field.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the field's HTML component.

search_url instance-attribute

search_url: str

URL to search for options.

multiple class-attribute instance-attribute

multiple: Union[bool, None] = None

Whether multiple options can be selected.

initial class-attribute instance-attribute

initial: Union[SelectOption, None] = None

Initial value for the field.

debounce class-attribute instance-attribute

debounce: Union[int, None] = None

Time in milliseconds to debounce requests by. Defaults to 300ms.

placeholder class-attribute instance-attribute

placeholder: Union[str, None] = None

Placeholder text for the field.

type class-attribute instance-attribute

type: Literal['FormFieldSelectSearch'] = 'FormFieldSelectSearch'

The type of the component. Always 'FormFieldSelectSearch'.

ModelForm

Bases: BaseForm

Form component generated from a Pydantic model.

submit_url instance-attribute

submit_url: str

URL to submit the form data to.

initial class-attribute instance-attribute

initial: Union[Dict[str, JsonData], None] = None

Initial values for the form fields, mapping field names to values.

method class-attribute instance-attribute

method: Literal['POST', 'GOTO', 'GET'] = 'POST'

HTTP method to use for the form submission.

display_mode class-attribute instance-attribute

display_mode: Union[Literal['default', 'page', 'inline'], None] = None

Display mode for the form.

submit_on_change class-attribute instance-attribute

submit_on_change: Union[bool, None] = None

Whether to submit the form on change.

submit_trigger class-attribute instance-attribute

submit_trigger: Union[PageEvent, None] = None

Event to trigger form submission.

loading class-attribute instance-attribute

loading: Union[List[AnyComponent], None] = None

Components to display while the form is submitting.

footer class-attribute instance-attribute

footer: Union[List[AnyComponent], None] = None

Components to display in the form footer.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the form's HTML component.

model class-attribute instance-attribute

model: Type[BaseModel] = Field(exclude=True)

Pydantic model from which to generate the form.

type class-attribute instance-attribute

type: Literal['ModelForm'] = 'ModelForm'

The type of the component. Always 'ModelForm'.

Pagination

Bases: BaseModel

Pagination component to use with tables.

page instance-attribute

page: int

The current page number.

page_size instance-attribute

page_size: int

The number of items per page.

total instance-attribute

total: int

The total number of items.

page_query_param class-attribute instance-attribute

page_query_param: str = 'page'

The query parameter to use for the page number.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the pagination's HTML component.

type class-attribute instance-attribute

type: Literal['Pagination'] = 'Pagination'

The type of the component. Always 'Pagination'.

Table

Bases: BaseModel

Table component.

data instance-attribute

data: Sequence[SerializeAsAny[DataModel]]

Sequence of data models to display in the table.

columns class-attribute instance-attribute

columns: Union[List[DisplayLookup], None] = None

List of columns to display in the table. If not provided, columns will be inferred from the data model.

data_model class-attribute instance-attribute

data_model: Union[Type[BaseModel], None] = Field(default=None, exclude=True)

Data model to use for the table. If not provided, the model will be inferred from the first data item.

no_data_message class-attribute instance-attribute

no_data_message: Union[str, None] = None

Message to display when there is no data.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the paragraph's HTML component.

type class-attribute instance-attribute

type: Literal['Table'] = 'Table'

The type of the component. Always 'Table'.

Text

Bases: BaseModel

Text component that displays a string.

text instance-attribute

text: str

The text to display.

type class-attribute instance-attribute

type: Literal['Text'] = 'Text'

The type of the component. Always 'Text'.

Paragraph

Bases: BaseModel

Paragraph component that displays a string as a paragraph.

text instance-attribute

text: str

The text to display.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the paragraph's HTML component.

type class-attribute instance-attribute

type: Literal['Paragraph'] = 'Paragraph'

The type of the component. Always 'Paragraph'.

PageTitle

Bases: BaseModel

Sets the title of the HTML page via the document.title property.

text instance-attribute

text: str

The text to set as the page title.

type class-attribute instance-attribute

type: Literal['PageTitle'] = 'PageTitle'

The type of the component. Always 'PageTitle'.

Div

Bases: BaseModel

A generic container component.

components instance-attribute

components: List[AnyComponent]

List of components to render inside the div.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the div's HTML component.

type class-attribute instance-attribute

type: Literal['Div'] = 'Div'

The type of the component. Always 'Div'.

Page

Bases: BaseModel

Similar to container in many UI frameworks, this acts as a root component for most pages.

components instance-attribute

components: List[AnyComponent]

List of components to render on the page.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the page's HTML component.

type class-attribute instance-attribute

type: Literal['Page'] = 'Page'

The type of the component. Always 'Page'.

Heading

Bases: BaseModel

Heading component.

text instance-attribute

text: str

The text to display in the heading.

level class-attribute instance-attribute

level: Literal[1, 2, 3, 4, 5, 6] = 1

The level of the heading. 1 is the largest, 6 is the smallest.

html_id class-attribute instance-attribute

html_id: Union[str, None] = None

Optional HTML ID to apply to the heading's HTML component.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the page's HTML component.

type class-attribute instance-attribute

type: Literal['Heading'] = 'Heading'

The type of the component. Always 'Heading'.

Markdown

Bases: BaseModel

Markdown component that renders markdown text.

text instance-attribute

text: str

The markdown text to render.

code_style class-attribute instance-attribute

code_style: CodeStyle = None

Optional code style to apply to the markdown text.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the page's HTML component.

type class-attribute instance-attribute

type: Literal['Markdown'] = 'Markdown'

The type of the component. Always 'Markdown'.

Code

Bases: BaseModel

Code component that renders code with syntax highlighting.

text instance-attribute

text: str

The code to render.

language class-attribute instance-attribute

language: Union[str, None] = None

Optional language of the code. If None, no syntax highlighting is applied.

code_style class-attribute instance-attribute

code_style: CodeStyle = None

Optional code style to apply to the code.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the page's HTML component.

type class-attribute instance-attribute

type: Literal['Code'] = 'Code'

The type of the component. Always 'Code'.

Json

Bases: BaseModel

JSON component that renders JSON data.

value instance-attribute

value: JsonData

The JSON data to render.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the page's HTML component.

type class-attribute instance-attribute

type: Literal['JSON'] = 'JSON'

The type of the component. Always 'JSON'.

Button

Bases: BaseModel

Button component.

text instance-attribute

text: str

The text to display on the button.

on_click class-attribute instance-attribute

on_click: Union[AnyEvent, None] = None

Optional event to trigger when the button is clicked.

html_type class-attribute instance-attribute

html_type: Union[Literal['button', 'reset', 'submit'], None] = None

Optional HTML type of the button. If None, defaults to 'button'.

named_style class-attribute instance-attribute

named_style: NamedStyleField = None

Optional named style to apply to the button.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the button's HTML component.

type class-attribute instance-attribute

type: Literal['Button'] = 'Button'

The type of the component. Always 'Button'.

Bases: BaseModel

Link component.

components instance-attribute

components: List[AnyComponent]

List of components to render attached to the link.

on_click class-attribute instance-attribute

on_click: Union[AnyEvent, None] = None

Optional event to trigger when the link is clicked.

mode class-attribute instance-attribute

mode: Union[Literal['navbar', 'footer', 'tabs', 'vertical', 'pagination'], None] = None

Optional mode of the link.

active class-attribute instance-attribute

active: Union[str, bool, None] = None

Optional active state of the link.

locked class-attribute instance-attribute

locked: Union[bool, None] = None

Optional locked state of the link.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the link's HTML component.

type class-attribute instance-attribute

type: Literal['Link'] = 'Link'

The type of the component. Always 'Link'.

Bases: BaseModel

List of Link components.

links: List[Link]

List of links to render.

mode class-attribute instance-attribute

mode: Union[Literal['tabs', 'vertical', 'pagination'], None] = None

Optional mode of the link list.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the link list's HTML component.

type class-attribute instance-attribute

type: Literal['LinkList'] = 'LinkList'

The type of the component. Always 'LinkList'.

Navbar

Bases: BaseModel

Navbar component used for moving between pages.

title class-attribute instance-attribute

title: Union[str, None] = None

Optional title to display in the navbar.

title_event class-attribute instance-attribute

title_event: Union[AnyEvent, None] = None

Optional event to trigger when the title is clicked. Often used to navigate to the home page.

start_links: List[Link] = []

List of links to render at the start of the navbar.

end_links: List[Link] = []

List of links to render at the end of the navbar.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the navbar's HTML component.

type class-attribute instance-attribute

type: Literal['Navbar'] = 'Navbar'

The type of the component. Always 'Navbar'.

Footer

Bases: BaseModel

Footer component.

links: List[Link]

List of links to render in the footer.

extra_text class-attribute instance-attribute

extra_text: Union[str, None] = None

Optional extra text to display in the footer.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the footer's HTML component.

type class-attribute instance-attribute

type: Literal['Footer'] = 'Footer'

The type of the component. Always 'Footer'.

Modal

Bases: BaseModel

Modal component that displays a modal dialog.

title instance-attribute

title: str

The text displayed on the modal trigger button.

body instance-attribute

body: List[AnyComponent]

List of components to render in the modal body.

footer class-attribute instance-attribute

footer: Union[List[AnyComponent], None] = None

Optional list of components to render in the modal footer.

open_trigger class-attribute instance-attribute

open_trigger: Union[PageEvent, None] = None

Optional event to trigger when the modal is opened.

open_context class-attribute instance-attribute

open_context: Union[ContextType, None] = None

Optional context to pass to the open trigger event.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the modal's HTML component.

type class-attribute instance-attribute

type: Literal['Modal'] = 'Modal'

The type of the component. Always 'Modal'.

ServerLoad

Bases: BaseModel

A component that will be replaced by the server with the component returned by the given URL.

path instance-attribute

path: str

The URL to load the component from.

load_trigger class-attribute instance-attribute

load_trigger: Union[PageEvent, None] = None

Optional event to trigger when the component is loaded.

components class-attribute instance-attribute

components: Union[List[AnyComponent], None] = None

Optional list of components to render while the server is loading the new component(s).

sse class-attribute instance-attribute

sse: Union[bool, None] = None

Optional flag to enable server-sent events (SSE) for the server load.

sse_retry class-attribute instance-attribute

sse_retry: Union[int, None] = None

Optional time in milliseconds to retry the SSE connection.

method class-attribute instance-attribute

method: Union[Literal['GET', 'POST', 'PATCH', 'PUT', 'DELETE'], None] = None

Optional HTTP method to use when loading the component.

type class-attribute instance-attribute

type: Literal['ServerLoad'] = 'ServerLoad'

The type of the component. Always 'ServerLoad'.

Image

Bases: BaseModel

Image container component.

src instance-attribute

src: str

The URL of the image to display.

alt class-attribute instance-attribute

alt: Union[str, None] = None

Optional alt text for the image.

width class-attribute instance-attribute

width: Union[str, int, None] = None

Optional width used to display the image.

height class-attribute instance-attribute

height: Union[str, int, None] = None

Optional height used to display the image.

referrer_policy class-attribute instance-attribute

referrer_policy: Union[Literal['no-referrer', 'no-referrer-when-downgrade', 'origin', 'origin-when-cross-origin', 'same-origin', 'strict-origin', 'strict-origin-when-cross-origin', 'unsafe-url'], None] = None

Optional referrer policy for the image. Specifies what information to send when fetching the image.

For more info, see https://developer.mozilla.org/en-US/docs/Web/HTTP/Headers/Referrer-Policy.

loading class-attribute instance-attribute

loading: Union[Literal['eager', 'lazy'], None] = None

Optional loading strategy for the image.

on_click class-attribute instance-attribute

on_click: Union[AnyEvent, None] = None

Optional event to trigger when the image is clicked.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the image's HTML component.

type class-attribute instance-attribute

type: Literal['Image'] = 'Image'

The type of the component. Always 'Image'.

Iframe

Bases: BaseModel

Iframe component that displays content from a URL.

src instance-attribute

src: HttpUrl

The URL of the content to display.

title class-attribute instance-attribute

title: Union[str, None] = None

Optional title for the iframe.

width class-attribute instance-attribute

width: Union[str, int, None] = None

Optional width used to display the iframe.

height class-attribute instance-attribute

height: Union[str, int, None] = None

Optional height used to display the iframe.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the iframe's HTML component.

srcdoc class-attribute instance-attribute

srcdoc: Union[str, None] = None

Optional HTML content to display in the iframe.

sandbox class-attribute instance-attribute

sandbox: Union[str, None] = None

Optional sandbox policy for the iframe. Specifies restrictions on the HTML content in the iframe.

type class-attribute instance-attribute

type: Literal['Iframe'] = 'Iframe'

The type of the component. Always 'Iframe'.

Video

Bases: BaseModel

Video component that displays a video or multiple videos.

sources instance-attribute

sources: List[AnyUrl]

List of URLs to the video sources.

autoplay class-attribute instance-attribute

autoplay: Union[bool, None] = None

Optional flag to enable autoplay for the video.

controls class-attribute instance-attribute

controls: Union[bool, None] = None

Optional flag to enable controls (pause, play, etc) for the video.

loop class-attribute instance-attribute

loop: Union[bool, None] = None

Optional flag to enable looping for the video.

muted class-attribute instance-attribute

muted: Union[bool, None] = None

Optional flag to mute the video.

poster class-attribute instance-attribute

poster: Union[AnyUrl, None] = None

Optional URL to an image to display as the video poster (what is shown when the video is loading or until the user plays it).

width class-attribute instance-attribute

width: Union[str, int, None] = None

Optional width used to display the video.

height class-attribute instance-attribute

height: Union[str, int, None] = None

Optional height used to display the video.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the video's HTML component.

type class-attribute instance-attribute

type: Literal['Video'] = 'Video'

The type of the component. Always 'Video'.

FireEvent

Bases: BaseModel

Fire an event.

event instance-attribute

event: AnyEvent

The event to fire.

message class-attribute instance-attribute

message: Union[str, None] = None

Optional message to display when the event is fired. Defaults to a blank message.

type class-attribute instance-attribute

type: Literal['FireEvent'] = 'FireEvent'

The type of the component. Always 'FireEvent'.

Error

Bases: BaseModel

Utility component used to display an error.

title instance-attribute

title: str

The title of the error.

description instance-attribute

description: str

The description of the error.

status_code class-attribute instance-attribute

status_code: Union[int, None] = None

Optional status code of the error.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the error's HTML component.

type class-attribute instance-attribute

type: Literal['Error'] = 'Error'

The type of the component. Always 'Error'.

Spinner

Bases: BaseModel

Spinner component that displays a loading spinner.

text class-attribute instance-attribute

text: Union[str, None] = None

Optional text to display with the spinner.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the spinner's HTML component.

type class-attribute instance-attribute

type: Literal['Spinner'] = 'Spinner'

The type of the component. Always 'Spinner'.

Toast

Bases: BaseModel

Toast component that displays a toast message (small temporary message).

title instance-attribute

title: str

The title of the toast.

body instance-attribute

body: List[AnyComponent]

List of components to render in the toast body.

position class-attribute instance-attribute

position: Union[Literal['top-start', 'top-center', 'top-end', 'middle-start', 'middle-center', 'middle-end', 'bottom-start', 'bottom-center', 'bottom-end'], None] = None

Optional position of the toast.

open_trigger class-attribute instance-attribute

open_trigger: Union[PageEvent, None] = None

Optional event to trigger when the toast is opened.

open_context class-attribute instance-attribute

open_context: Union[ContextType, None] = None

Optional context to pass to the open trigger event.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the toast's HTML component.

type class-attribute instance-attribute

type: Literal['Toast'] = 'Toast'

The type of the component. Always 'Toast'.

Custom

Bases: BaseModel

Custom component that allows for special data to be rendered.

data instance-attribute

data: JsonData

The data to render in the custom component.

sub_type instance-attribute

sub_type: str

The sub-type of the custom component.

library class-attribute instance-attribute

library: Union[str, None] = None

Optional library to use for the custom component.

class_name class-attribute instance-attribute

class_name: ClassNameField = None

Optional class name to apply to the custom component's HTML component.

type class-attribute instance-attribute

type: Literal['Custom'] = 'Custom'

The type of the component. Always 'Custom'.