Skip to main content

base_component

LayoutError

from dara.components.common.base_component import LayoutError

class LayoutError(Exception)

An Error type for when the layout is invalid

BaseDashboardComponent

from dara.components.common.base_component import BaseDashboardComponent

class BaseDashboardComponent(StyledComponentInstance)

The base Component class for all other dashboarding components to extend from.

LayoutComponent

from dara.components.common.base_component import LayoutComponent

class LayoutComponent(BaseDashboardComponent)

Any component that's primary role is to aid in laying out a document should inherit from this class. It adds

append/pop functionality that allows for these components to be created more dynamically (e.g. inside a loop)

Arguments:

  • position: the position of the component, defaults to 'relative'
  • justify: the justify-content value to be passed to the component
  • align: the align-items value to be passed to the component

Attributes

  • position: str
  • justify: Optional[JustifyContent]
  • align: Optional[AlignItems]

Methods

append

def append(component: ComponentInstance)

Add a new component to the list of children, raises a TypeError if a the component does not inherit from

BaseComponent

Arguments:

  • component: the component to add, can be any type of BaseComponent

pop

def pop()

Pops the last child from the list of children and returns it. Raises an IndexError if the parent is empty

ContentComponent

from dara.components.common.base_component import ContentComponent

class ContentComponent(BaseDashboardComponent)

Any component that's primary role is to display content should inherit from this class. It makes sure that LayoutComponents cannot be nested inside. It also switches the alignment mode of the component to align self rather than aligning children.

ModifierComponent

from dara.components.common.base_component import ModifierComponent

class ModifierComponent(BaseDashboardComponent)

Any component that's primary role is to modify the behavior of the nested component should inherit from this class.

InteractiveComponent

from dara.components.common.base_component import InteractiveComponent

class InteractiveComponent(BaseDashboardComponent)

Any component that's primary role is to provide an interaction point to the end user. e.g. inputs, dropdowns and buttons

FormComponent

from dara.components.common.base_component import FormComponent

class FormComponent(InteractiveComponent)

A subset of InteractiveComponents which must subscribe to the Form context.

Attributes

  • id: Optional[str]