Skip to content

Widgets

The Ff widget library: typed wrappers of the React components in the committed dist.

femforge_workbench.widgets

The Ff widget library: typed wrappers of the React components in the built dist, one module per family.

Modules:

  • accordion –

    The accordion: collapsible sections, one or several open at a time.

  • badge –

    The badge.

  • body_look –

    The body look: a swatch that opens a body's visibility, opacity and color editor.

  • busy –

    The busy indicator of an area whose content the server is working on.

  • button –

    Buttons: the shadcn button and button group.

  • card –

    Cards: a bordered box with header, content and footer.

  • checkbox –

    The checkbox.

  • code –

    The code editor: Monaco over a text value.

  • combobox –

    The combobox: a searchable single choice narrowed by group toggles.

  • context_menu –

    Context menus: a Radix menu a right click opens over its trigger, and its items.

  • dialog –

    Dialogs: a modal and its trigger, content, header, footer and close.

  • dist_hash –

    The source hash a built client dist records in version.json, shared by the build hook and the startup check.

  • dock –

    The dock: a dockview host rendering one server template per panel.

  • drawer –

    A bar at the bottom of its parent with a body that slides up under it.

  • dropdown_menu –

    Dropdown menus: a Radix menu and its trigger, content, items and groups.

  • element –

    The Element base: a wrapper's declared parameters become React props by name, those named on_* events.

  • entity_grid –

    The entity grid: rows of bodies or boundaries with their conditions as read-only editors, one tab stop with roving focus.

  • field –

    Fields: a labelled control with its description and error.

  • fields –

    Read-only fields: an authored value shown in the control that would edit it.

  • icon –

    The icon: one of the curated lucide names.

  • input –

    Text inputs: uncontrolled, committing to the state on blur and Enter, named after the state key they bind.

  • label –

    The label.

  • module –

    The Ff client module: the built dist under serve/, its trame descriptor and the URLs of its files.

  • notify –

    The shell's one-shot messages to the user: a file to save and a toast.

  • plot –

    The plot: a plotly figure reporting restyle, relayout and click events.

  • progress –

    The progress bar.

  • reveal –

    Controls that appear with the setting they depend on.

  • scene –

    The scene widgets: the browser-side companion of a mirrored view.

  • scroll_area –

    Scroll areas: a viewport with styled scrollbars.

  • select –

    Selects: a Radix select and its trigger, value, content and items.

  • separator –

    The separator.

  • slider –

    The slider.

  • switch –

    The switch.

  • table –

    The table: a TanStack table over columns, rows and options, reporting its layout, row clicks and the selection.

  • tabs –

    Tabs: a tab list and the content panes it switches.

  • term –

    The terminal: an xterm fed from the server.

  • tip –

    The tooltip a single child carries.

  • toggle –

    Toggles: a pressed button and a group of them choosing one or many values.

  • tooltip –

    Tooltips: a provider, a tooltip and its trigger and content.

  • tour –

    The guided tour: a spotlight and a card stepping over elements of the live app.

  • tree –

    The tree: collapsible items with leaf checkboxes.

Functions:

  • asset_url –

    The URL of a file under the served directory.

  • initialize –

    Enables the module before the first client connects.

asset_url

asset_url(name: str) -> str

The URL of a file under the served directory.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def asset_url(name: str) -> str:
    """The URL of a file under the served directory."""
    return f"/{ROUTE}/{name}"

initialize

initialize(server: Server) -> None

Enables the module before the first client connects.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def initialize(server: Server) -> None:
    """Enables the module before the first client connects."""
    _ = server.enable_module(descriptor())

accordion

The accordion: collapsible sections, one or several open at a time.

Classes:

  • Accordion –

    Sections opened one at a time (type_ single) or several; model binds the open ids to a state variable.

  • AccordionItem –

    One section, named by value.

  • AccordionTrigger –

    The header that opens and closes a section.

  • AccordionContent –

    The body of a section.

Accordion

Accordion(children: object = None, *, model: str | None = None, type_: Prop[AccordionType] = None, value: Prop[str | Sequence[str]] = None, default_value: Prop[str | Sequence[str]] = None, on_value_change: Event = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

Sections opened one at a time (type_ single) or several; model binds the open ids to a state variable.

Parameters:

  • children (object, default: None ) –

    The accordion's sections.

  • model (str | None, default: None ) –

    A state variable to bind the open section ids to, unless on_value_change is given.

  • type_ (Prop[AccordionType], default: None ) –

    Whether one section opens at a time or several.

  • value (Prop[str | Sequence[str]], default: None ) –

    The open section's id, or the open ids of a multiple accordion.

  • default_value (Prop[str | Sequence[str]], default: None ) –

    The sections open at mount while value is unset.

  • on_value_change (Event, default: None ) –

    Receives the open ids after a section opens or closes.

  • disabled (Prop[bool], default: None ) –

    Disables every section.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/accordion.py
def __init__(
    self,
    children: object = None,
    *,
    model: str | None = None,
    type_: Prop[AccordionType] = None,
    value: Prop[str | Sequence[str]] = None,
    default_value: Prop[str | Sequence[str]] = None,
    on_value_change: Event = None,
    disabled: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the accordion; a prop left None keeps the component's default.

    Args:
        children: The accordion's sections.
        model: A state variable to bind the open section ids to, unless `on_value_change` is given.
        type_: Whether one section opens at a time or several.
        value: The open section's id, or the open ids of a multiple accordion.
        default_value: The sections open at mount while `value` is unset.
        on_value_change: Receives the open ids after a section opens or closes.
        disabled: Disables every section.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-accordion", locals(), children, **kwargs)

AccordionItem

AccordionItem(children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

One section, named by value.

Parameters:

  • children (object, default: None ) –

    The section's trigger and content.

  • value (Prop[str], default: None ) –

    The section's id.

  • disabled (Prop[bool], default: None ) –

    Disables the section.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/accordion.py
def __init__(self, children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the section; a prop left None keeps the component's default.

    Args:
        children: The section's trigger and content.
        value: The section's id.
        disabled: Disables the section.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-accordion-item", locals(), children, **kwargs)

AccordionTrigger

AccordionTrigger(children: object = None, *, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The header that opens and closes a section.

Parameters:

  • children (object, default: None ) –

    The header's text.

  • disabled (Prop[bool], default: None ) –

    Disables the trigger.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/accordion.py
def __init__(self, children: object = None, *, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the trigger; a prop left None keeps the component's default.

    Args:
        children: The header's text.
        disabled: Disables the trigger.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-accordion-trigger", locals(), children, **kwargs)

AccordionContent

AccordionContent(children: object = None, *, force_mount: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The body of a section.

Parameters:

  • children (object, default: None ) –

    The section's content.

  • force_mount (Prop[bool], default: None ) –

    Keeps the content mounted while the section is closed.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/accordion.py
def __init__(self, children: object = None, *, force_mount: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the section body; a prop left None keeps the component's default.

    Args:
        children: The section's content.
        force_mount: Keeps the content mounted while the section is closed.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-accordion-content", locals(), children, **kwargs)

badge

The badge.

Classes:

  • Badge –

    A small status label.

Badge

Badge(children: object = None, *, variant: Prop[BadgeVariant] = None, as_child: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A small status label.

Parameters:

  • children (object, default: None ) –

    The badge's text.

  • variant (Prop[BadgeVariant], default: None ) –

    The badge's style.

  • as_child (Prop[bool], default: None ) –

    Renders the child element itself, styled as the badge.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/badge.py
def __init__(self, children: object = None, *, variant: Prop[BadgeVariant] = None, as_child: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the badge; a prop left None keeps the component's default.

    Args:
        children: The badge's text.
        variant: The badge's style.
        as_child: Renders the child element itself, styled as the badge.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-badge", locals(), children, **kwargs)

body_look

The body look: a swatch that opens a body's visibility, opacity and color editor.

Classes:

  • BodyLook –

    One body's look as an 18 px swatch; its popover holds the eye and opacity on top, then the Field, Colormap and Fixed modes.

BodyLook

BodyLook(*, paint: Prop[Paint] = None, colors: Prop[Sequence[str | None]] = None, shown: Prop[bool | Literal['mixed']] = None, opacity: Prop[float] = None, field_gradient: Prop[str] = None, colormap: Prop[str] = None, colormaps: Prop[Sequence[ComboboxItem]] = None, filters: Prop[Sequence[str]] = None, field_disabled: Prop[bool] = None, palette: Prop[Sequence[str]] = None, label: Prop[str] = None, disabled: Prop[bool] = None, on_shown_change: Event = None, on_opacity_change: Event = None, on_opacity_commit: Event = None, on_paint_change: Event = None, on_color_change: Event = None, on_colormap_change: Event = None, **kwargs: Unpack[Shared])

Bases: Element

One body's look as an 18 px swatch; its popover holds the eye and opacity on top, then the Field, Colormap and Fixed modes.

Parameters:

  • paint (Prop[Paint], default: None ) –

    Where the color comes from: the field colormap, the body colormap, a fixed color, or a group's mix.

  • colors (Prop[Sequence[str | None]], default: None ) –

    The resolved color of each body the swatch stands for, None for a body painted by the field.

  • shown (Prop[bool | Literal['mixed']], default: None ) –

    Whether the bodies show, or mixed for a group that is partly hidden.

  • opacity (Prop[float], default: None ) –

    The bodies' own opacity, 0 to 1.

  • field_gradient (Prop[str], default: None ) –

    The field colormap as a CSS gradient.

  • colormap (Prop[str], default: None ) –

    The shared body colormap.

  • colormaps (Prop[Sequence[ComboboxItem]], default: None ) –

    The colormaps the Colormap mode lists.

  • filters (Prop[Sequence[str]], default: None ) –

    The group toggles that narrow the colormap list.

  • field_disabled (Prop[bool], default: None ) –

    Disables the Field mode, for a run without fields.

  • palette (Prop[Sequence[str]], default: None ) –

    The fixed colors offered one click away.

  • label (Prop[str], default: None ) –

    The name the controls are announced with.

  • disabled (Prop[bool], default: None ) –

    Disables the swatch.

  • on_shown_change (Event, default: None ) –

    Receives the new visibility.

  • on_opacity_change (Event, default: None ) –

    Receives the opacity as the thumb moves.

  • on_opacity_commit (Event, default: None ) –

    Receives the opacity when the thumb is released.

  • on_paint_change (Event, default: None ) –

    Receives the chosen mode.

  • on_color_change (Event, default: None ) –

    Receives a picked fixed color.

  • on_colormap_change (Event, default: None ) –

    Receives a picked body colormap.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/body_look.py
def __init__(
    self,
    *,
    paint: Prop[Paint] = None,
    colors: Prop[Sequence[str | None]] = None,
    shown: Prop[bool | Literal["mixed"]] = None,
    opacity: Prop[float] = None,
    field_gradient: Prop[str] = None,
    colormap: Prop[str] = None,
    colormaps: Prop[Sequence[ComboboxItem]] = None,
    filters: Prop[Sequence[str]] = None,
    field_disabled: Prop[bool] = None,
    palette: Prop[Sequence[str]] = None,
    label: Prop[str] = None,
    disabled: Prop[bool] = None,
    on_shown_change: Event = None,
    on_opacity_change: Event = None,
    on_opacity_commit: Event = None,
    on_paint_change: Event = None,
    on_color_change: Event = None,
    on_colormap_change: Event = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the body look; a prop left None keeps the component's default.

    Args:
        paint: Where the color comes from: the field colormap, the body colormap, a fixed color, or a group's mix.
        colors: The resolved color of each body the swatch stands for, None for a body painted by the field.
        shown: Whether the bodies show, or ``mixed`` for a group that is partly hidden.
        opacity: The bodies' own opacity, 0 to 1.
        field_gradient: The field colormap as a CSS gradient.
        colormap: The shared body colormap.
        colormaps: The colormaps the Colormap mode lists.
        filters: The group toggles that narrow the colormap list.
        field_disabled: Disables the Field mode, for a run without fields.
        palette: The fixed colors offered one click away.
        label: The name the controls are announced with.
        disabled: Disables the swatch.
        on_shown_change: Receives the new visibility.
        on_opacity_change: Receives the opacity as the thumb moves.
        on_opacity_commit: Receives the opacity when the thumb is released.
        on_paint_change: Receives the chosen mode.
        on_color_change: Receives a picked fixed color.
        on_colormap_change: Receives a picked body colormap.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-body-look", locals(), None, **kwargs)

busy

The busy indicator of an area whose content the server is working on.

Classes:

  • Busy –

    A line along the top edge of its parent and a spinner on the control that started the work, shown only while active outlasts the busy delay.

Busy

Busy(*, active: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A line along the top edge of its parent and a spinner on the control that started the work, shown only while active outlasts the busy delay.

Parameters:

  • active (Prop[bool], default: None ) –

    Whether the server is working on the parent's content.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/busy.py
def __init__(self, *, active: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the indicator; a prop left None keeps the component's default.

    Args:
        active: Whether the server is working on the parent's content.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-busy", locals(), None, **kwargs)

button

Buttons: the shadcn button and button group.

Classes:

Button

Button(children: object = None, *, variant: Prop[ButtonVariant] = None, size: Prop[ButtonSize] = None, disabled: Prop[bool] = None, type_: Prop[ButtonType] = None, as_child: Prop[bool] = None, aria_label: Prop[str] = None, aria_disabled: Prop[bool] = None, aria_pressed: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A button whose children are its label or icon.

Parameters:

  • children (object, default: None ) –

    The button's label or icon.

  • variant (Prop[ButtonVariant], default: None ) –

    The button's style.

  • size (Prop[ButtonSize], default: None ) –

    The button's size; the icon sizes make it square.

  • disabled (Prop[bool], default: None ) –

    Disables the button.

  • type_ (Prop[ButtonType], default: None ) –

    The HTML button type.

  • as_child (Prop[bool], default: None ) –

    Renders the child element itself, styled as the button.

  • aria_label (Prop[str], default: None ) –

    The accessible name, needed when the button shows only an icon.

  • aria_disabled (Prop[bool], default: None ) –

    Marks the button unavailable while it stays hoverable and focusable, so its tooltip can say why.

  • aria_pressed (Prop[bool], default: None ) –

    The on state of a toggle button.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/button.py
def __init__(
    self,
    children: object = None,
    *,
    variant: Prop[ButtonVariant] = None,
    size: Prop[ButtonSize] = None,
    disabled: Prop[bool] = None,
    type_: Prop[ButtonType] = None,
    as_child: Prop[bool] = None,
    aria_label: Prop[str] = None,
    aria_disabled: Prop[bool] = None,
    aria_pressed: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the button; a prop left None keeps the component's default.

    Args:
        children: The button's label or icon.
        variant: The button's style.
        size: The button's size; the icon sizes make it square.
        disabled: Disables the button.
        type_: The HTML button type.
        as_child: Renders the child element itself, styled as the button.
        aria_label: The accessible name, needed when the button shows only an icon.
        aria_disabled: Marks the button unavailable while it stays hoverable and focusable, so its tooltip can say why.
        aria_pressed: The on state of a toggle button.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-button", locals(), children, **kwargs)

ButtonGroup

ButtonGroup(children: object = None, *, orientation: Prop[Orientation] = None, **kwargs: Unpack[Shared])

Bases: Element

Buttons joined into one row or column.

Parameters:

  • children (object, default: None ) –

    The grouped buttons.

  • orientation (Prop[Orientation], default: None ) –

    Whether the buttons join in a row or a column.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/button.py
def __init__(self, children: object = None, *, orientation: Prop[Orientation] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the group; a prop left None keeps the component's default.

    Args:
        children: The grouped buttons.
        orientation: Whether the buttons join in a row or a column.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-button-group", locals(), children, **kwargs)

ButtonGroupSeparator

ButtonGroupSeparator(*, orientation: Prop[Orientation] = None, decorative: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A separator between grouped buttons.

Parameters:

  • orientation (Prop[Orientation], default: None ) –

    The direction the separator runs.

  • decorative (Prop[bool], default: None ) –

    Hides the separator from assistive technology.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/button.py
def __init__(self, *, orientation: Prop[Orientation] = None, decorative: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the separator; a prop left None keeps the component's default.

    Args:
        orientation: The direction the separator runs.
        decorative: Hides the separator from assistive technology.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-button-group-separator", locals(), None, **kwargs)

ButtonGroupText

ButtonGroupText(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

Text set beside grouped buttons.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/button.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the text from `children`."""
    super().__init__("ff-button-group-text", locals(), children, **kwargs)

card

Cards: a bordered box with header, content and footer.

Classes:

Card

Card(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A bordered box.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the card around `children`."""
    super().__init__("ff-card", locals(), children, **kwargs)

CardHeader

CardHeader(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The title row of a card.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the header around `children`."""
    super().__init__("ff-card-header", locals(), children, **kwargs)

CardTitle

CardTitle(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A card's title.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the title from `children`."""
    super().__init__("ff-card-title", locals(), children, **kwargs)

CardDescription

CardDescription(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A card's description.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the description from `children`."""
    super().__init__("ff-card-description", locals(), children, **kwargs)

CardAction

CardAction(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A control set in the header's corner.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the corner control around `children`."""
    super().__init__("ff-card-action", locals(), children, **kwargs)

CardContent

CardContent(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A card's body.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the body around `children`."""
    super().__init__("ff-card-content", locals(), children, **kwargs)

CardFooter

CardFooter(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A card's action row.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/card.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the action row around `children`."""
    super().__init__("ff-card-footer", locals(), children, **kwargs)

checkbox

The checkbox.

Classes:

  • Checkbox –

    A checkbox; model binds its checked state to a state variable.

Checkbox

Checkbox(*, model: str | None = None, checked: Prop[bool] = None, default_checked: Prop[bool] = None, on_checked_change: Event = None, disabled: Prop[bool] = None, required: Prop[bool] = None, name: Prop[str] = None, value: Prop[str] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A checkbox; model binds its checked state to a state variable.

Parameters:

  • model (str | None, default: None ) –

    A state variable to bind the checked state to, unless on_checked_change is given.

  • checked (Prop[bool], default: None ) –

    Whether the box is checked.

  • default_checked (Prop[bool], default: None ) –

    Whether the box is checked at mount while checked is unset.

  • on_checked_change (Event, default: None ) –

    Receives the new checked state.

  • disabled (Prop[bool], default: None ) –

    Disables the checkbox.

  • required (Prop[bool], default: None ) –

    Marks the checkbox as required in a form.

  • name (Prop[str], default: None ) –

    The form field name.

  • value (Prop[str], default: None ) –

    The value a form submits while the box is checked.

  • aria_label (Prop[str], default: None ) –

    The accessible name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/checkbox.py
def __init__(
    self,
    *,
    model: str | None = None,
    checked: Prop[bool] = None,
    default_checked: Prop[bool] = None,
    on_checked_change: Event = None,
    disabled: Prop[bool] = None,
    required: Prop[bool] = None,
    name: Prop[str] = None,
    value: Prop[str] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the checkbox; a prop left None keeps the component's default.

    Args:
        model: A state variable to bind the checked state to, unless `on_checked_change` is given.
        checked: Whether the box is checked.
        default_checked: Whether the box is checked at mount while `checked` is unset.
        on_checked_change: Receives the new checked state.
        disabled: Disables the checkbox.
        required: Marks the checkbox as required in a form.
        name: The form field name.
        value: The value a form submits while the box is checked.
        aria_label: The accessible name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_checked_change is None:
        checked = react.Bind(model)
        on_checked_change = setter(model)

    super().__init__("ff-checkbox", locals(), None, **kwargs)

code

The code editor: Monaco over a text value.

Classes:

  • Code –

    An editor over value in language; on_change (shared) carries the edited text.

Code

Code(*, value: Prop[str] = None, language: Prop[str] = None, theme: Prop[str] = None, options: Prop[Mapping[str, object]] = None, **kwargs: Unpack[Shared])

Bases: Element

An editor over value in language; on_change (shared) carries the edited text.

Parameters:

  • value (Prop[str], default: None ) –

    The text to edit.

  • language (Prop[str], default: None ) –

    The Monaco language that highlights the text.

  • theme (Prop[str], default: None ) –

    The Monaco theme.

  • options (Prop[Mapping[str, object]], default: None ) –

    Monaco editor options.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/code.py
def __init__(
    self,
    *,
    value: Prop[str] = None,
    language: Prop[str] = None,
    theme: Prop[str] = None,
    options: Prop[Mapping[str, object]] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the editor; a prop left None keeps the component's default.

    Args:
        value: The text to edit.
        language: The Monaco language that highlights the text.
        theme: The Monaco theme.
        options: Monaco editor options.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-code", locals(), None, **kwargs)

combobox

The combobox: a searchable single choice narrowed by group toggles.

Classes:

  • ComboboxItem –

    One option: its value, label, the groups it belongs to and an optional CSS background swatch.

  • Combobox –

    A searchable select whose filters toggle its groups on and off and whose arrow keys apply as they step; model binds its value to a state variable.

ComboboxItem

Bases: TypedDict

One option: its value, label, the groups it belongs to and an optional CSS background swatch.

Combobox

Combobox(*, model: str | None = None, items: Prop[Sequence[ComboboxItem]] = None, value: Prop[str] = None, on_value_change: Event = None, filters: Prop[Sequence[str]] = None, placeholder: Prop[str] = None, search_placeholder: Prop[str] = None, empty_text: Prop[str] = None, disabled: Prop[bool] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A searchable select whose filters toggle its groups on and off and whose arrow keys apply as they step; model binds its value to a state variable.

Parameters:

  • model (str | None, default: None ) –

    A state variable to bind the value to, unless on_value_change is given.

  • items (Prop[Sequence[ComboboxItem]], default: None ) –

    The options.

  • value (Prop[str], default: None ) –

    The chosen option's value.

  • on_value_change (Event, default: None ) –

    Receives the chosen value.

  • filters (Prop[Sequence[str]], default: None ) –

    The group toggles that narrow the items.

  • placeholder (Prop[str], default: None ) –

    The trigger's text while nothing is chosen.

  • search_placeholder (Prop[str], default: None ) –

    The search field's placeholder.

  • empty_text (Prop[str], default: None ) –

    The text shown when no option matches the search.

  • disabled (Prop[bool], default: None ) –

    Disables the combobox.

  • aria_label (Prop[str], default: None ) –

    The accessible name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/combobox.py
def __init__(
    self,
    *,
    model: str | None = None,
    items: Prop[Sequence[ComboboxItem]] = None,
    value: Prop[str] = None,
    on_value_change: Event = None,
    filters: Prop[Sequence[str]] = None,
    placeholder: Prop[str] = None,
    search_placeholder: Prop[str] = None,
    empty_text: Prop[str] = None,
    disabled: Prop[bool] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the combobox; a prop left None keeps the component's default.

    Args:
        model: A state variable to bind the value to, unless `on_value_change` is given.
        items: The options.
        value: The chosen option's value.
        on_value_change: Receives the chosen value.
        filters: The group toggles that narrow the items.
        placeholder: The trigger's text while nothing is chosen.
        search_placeholder: The search field's placeholder.
        empty_text: The text shown when no option matches the search.
        disabled: Disables the combobox.
        aria_label: The accessible name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-combobox", locals(), None, **kwargs)

context_menu

Context menus: a Radix menu a right click opens over its trigger, and its items.

Classes:

ContextMenu

ContextMenu(children: object = None, *, on_open_change: Event = None, modal: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A menu a right click on its trigger opens at the pointer.

Parameters:

  • children (object, default: None ) –

    The menu's trigger and content.

  • on_open_change (Event, default: None ) –

    Receives the new open state.

  • modal (Prop[bool], default: None ) –

    Blocks the page outside the menu while it is open.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/context_menu.py
def __init__(self, children: object = None, *, on_open_change: Event = None, modal: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the menu; a prop left None keeps the component's default.

    Args:
        children: The menu's trigger and content.
        on_open_change: Receives the new open state.
        modal: Blocks the page outside the menu while it is open.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-context-menu", locals(), children, **kwargs)

ContextMenuTrigger

ContextMenuTrigger(children: object = None, *, as_child: Prop[bool] = None, disabled: Prop[bool] = None, drag_tolerance: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

The area a right click opens the menu over; as_child makes the child element itself that area.

Parameters:

  • children (object, default: None ) –

    The area's content.

  • as_child (Prop[bool], default: None ) –

    Makes the child element itself the area.

  • disabled (Prop[bool], default: None ) –

    Leaves the browser's own menu to a right click.

  • drag_tolerance (Prop[float], default: None ) –

    How far, in pixels, a right press may move and still open the menu; None opens it after any drag.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/context_menu.py
def __init__(
    self,
    children: object = None,
    *,
    as_child: Prop[bool] = None,
    disabled: Prop[bool] = None,
    drag_tolerance: Prop[float] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the trigger; a prop left None keeps the component's default.

    Args:
        children: The area's content.
        as_child: Makes the child element itself the area.
        disabled: Leaves the browser's own menu to a right click.
        drag_tolerance: How far, in pixels, a right press may move and still open the menu; None opens it after any drag.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-context-menu-trigger", locals(), children, **kwargs)

ContextMenuContent

ContextMenuContent(children: object = None, *, loop: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The floating list of items.

Parameters:

  • children (object, default: None ) –

    The menu's items.

  • loop (Prop[bool], default: None ) –

    Whether keyboard navigation wraps from the last item to the first.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/context_menu.py
def __init__(self, children: object = None, *, loop: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the list; a prop left None keeps the component's default.

    Args:
        children: The menu's items.
        loop: Whether keyboard navigation wraps from the last item to the first.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-context-menu-content", locals(), children, **kwargs)

ContextMenuItem

ContextMenuItem(children: object = None, *, on_select: Event = None, disabled: Prop[bool] = None, inset: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

One item; on_select fires when it is chosen.

Parameters:

  • children (object, default: None ) –

    The item's label.

  • on_select (Event, default: None ) –

    Fires when the item is chosen.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • inset (Prop[bool], default: None ) –

    Indents the item to line up with a checkbox item's label.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/context_menu.py
def __init__(
    self,
    children: object = None,
    *,
    on_select: Event = None,
    disabled: Prop[bool] = None,
    inset: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label.
        on_select: Fires when the item is chosen.
        disabled: Disables the item.
        inset: Indents the item to line up with a checkbox item's label.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-context-menu-item", locals(), children, **kwargs)

ContextMenuCheckboxItem

ContextMenuCheckboxItem(children: object = None, *, checked: Prop[bool] = None, on_checked_change: Event = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

An item with a check mark.

Parameters:

  • children (object, default: None ) –

    The item's label.

  • checked (Prop[bool], default: None ) –

    Whether the item is checked.

  • on_checked_change (Event, default: None ) –

    Receives the new checked state.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/context_menu.py
def __init__(
    self,
    children: object = None,
    *,
    checked: Prop[bool] = None,
    on_checked_change: Event = None,
    disabled: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label.
        checked: Whether the item is checked.
        on_checked_change: Receives the new checked state.
        disabled: Disables the item.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-context-menu-checkbox-item", locals(), children, **kwargs)

ContextMenuSeparator

ContextMenuSeparator(**kwargs: Unpack[Shared])

Bases: Element

A rule between items.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/context_menu.py
def __init__(self, **kwargs: Unpack[Shared]) -> None:
    """Creates the rule."""
    super().__init__("ff-context-menu-separator", locals(), None, **kwargs)

dialog

Dialogs: a modal and its trigger, content, header, footer and close.

Classes:

Dialog

Dialog(children: object = None, *, open_: Prop[bool] = None, default_open: Prop[bool] = None, on_open_change: Event = None, modal: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A dialog opened by its trigger or the open_ prop.

Parameters:

  • children (object, default: None ) –

    The dialog's trigger and content.

  • open_ (Prop[bool], default: None ) –

    Whether the dialog is open.

  • default_open (Prop[bool], default: None ) –

    Whether the dialog opens at mount while open_ is unset.

  • on_open_change (Event, default: None ) –

    Receives the new open state, as when Escape or the backdrop closes the dialog.

  • modal (Prop[bool], default: None ) –

    Blocks the page behind the dialog while it is open.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(
    self,
    children: object = None,
    *,
    open_: Prop[bool] = None,
    default_open: Prop[bool] = None,
    on_open_change: Event = None,
    modal: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the dialog; a prop left None keeps the component's default.

    Args:
        children: The dialog's trigger and content.
        open_: Whether the dialog is open.
        default_open: Whether the dialog opens at mount while `open_` is unset.
        on_open_change: Receives the new open state, as when Escape or the backdrop closes the dialog.
        modal: Blocks the page behind the dialog while it is open.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dialog", locals(), children, **kwargs)

DialogTrigger

DialogTrigger(children: object = None, *, as_child: Prop[bool] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The control opening the dialog; as_child renders the child element itself.

Parameters:

  • children (object, default: None ) –

    The trigger's content.

  • as_child (Prop[bool], default: None ) –

    Renders the child element itself as the trigger.

  • disabled (Prop[bool], default: None ) –

    Disables the trigger.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(self, children: object = None, *, as_child: Prop[bool] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the trigger; a prop left None keeps the component's default.

    Args:
        children: The trigger's content.
        as_child: Renders the child element itself as the trigger.
        disabled: Disables the trigger.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dialog-trigger", locals(), children, **kwargs)

DialogContent

DialogContent(children: object = None, *, show_close_button: Prop[bool] = None, force_mount: Prop[bool] = None, scrim: Prop[bool] = None, persistent: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The dialog's box.

Parameters:

  • children (object, default: None ) –

    The dialog's header, body and footer.

  • show_close_button (Prop[bool], default: None ) –

    Shows the close button in the corner.

  • force_mount (Prop[bool], default: None ) –

    Keeps the content mounted while the dialog is closed.

  • scrim (Prop[bool], default: None ) –

    Dims the page behind; a dialog whose changes show in the page leaves it clear.

  • persistent (Prop[bool], default: None ) –

    Stays open through clicks and focus outside it, and through Escape pressed outside it.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(
    self,
    children: object = None,
    *,
    show_close_button: Prop[bool] = None,
    force_mount: Prop[bool] = None,
    scrim: Prop[bool] = None,
    persistent: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the box; a prop left None keeps the component's default.

    Args:
        children: The dialog's header, body and footer.
        show_close_button: Shows the close button in the corner.
        force_mount: Keeps the content mounted while the dialog is closed.
        scrim: Dims the page behind; a dialog whose changes show in the page leaves it clear.
        persistent: Stays open through clicks and focus outside it, and through Escape pressed outside it.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dialog-content", locals(), children, **kwargs)

DialogHeader

DialogHeader(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The title and description block.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the header around `children`."""
    super().__init__("ff-dialog-header", locals(), children, **kwargs)

DialogFooter

DialogFooter(children: object = None, *, show_close_button: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The action row.

Parameters:

  • children (object, default: None ) –

    The dialog's actions.

  • show_close_button (Prop[bool], default: None ) –

    Adds a Close button to the row.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(self, children: object = None, *, show_close_button: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the action row; a prop left None keeps the component's default.

    Args:
        children: The dialog's actions.
        show_close_button: Adds a Close button to the row.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dialog-footer", locals(), children, **kwargs)

DialogTitle

DialogTitle(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The dialog's title.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the title from `children`."""
    super().__init__("ff-dialog-title", locals(), children, **kwargs)

DialogDescription

DialogDescription(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The dialog's description.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the description from `children`."""
    super().__init__("ff-dialog-description", locals(), children, **kwargs)

DialogClose

DialogClose(children: object = None, *, as_child: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A control closing the dialog.

Parameters:

  • children (object, default: None ) –

    The control's content.

  • as_child (Prop[bool], default: None ) –

    Renders the child element itself as the close control.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dialog.py
def __init__(self, children: object = None, *, as_child: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the close control; a prop left None keeps the component's default.

    Args:
        children: The control's content.
        as_child: Renders the child element itself as the close control.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dialog-close", locals(), children, **kwargs)

dist_hash

The source hash a built client dist records in version.json, shared by the build hook and the startup check.

Functions:

  • source_hash –

    The hash version.json must carry for the package at root: sha256 over the sorted (posix path, LF bytes) of every input, first 16 hex characters.

source_hash

source_hash(root: Path) -> str

The hash version.json must carry for the package at root: sha256 over the sorted (posix path, LF bytes) of every input, first 16 hex characters.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dist_hash.py
def source_hash(root: Path) -> str:
    """The hash version.json must carry for the package at ``root``: sha256 over the sorted (posix path, LF bytes) of every input, first 16 hex characters."""
    js = root / "js"
    serve = root / SERVE
    files = [path for name in HASHED_DIRS for path in (js / name).rglob("*") if path.is_file()]
    files += [path for path in (root / SCANNED).rglob("*.py") if path.is_file() and serve not in path.parents]
    files += [js / name for name in HASHED_FILES]

    digest = hashlib.sha256()
    for relative in sorted(Path(os.path.relpath(path, js)).as_posix() for path in files):
        digest.update(relative.encode())
        digest.update(b"\0")
        digest.update((js / relative).read_bytes().replace(b"\r\n", b"\n"))
        digest.update(b"\0")

    return digest.hexdigest()[:DIGEST_CHARS]

dock

The dock: a dockview host rendering one server template per panel.

Classes:

  • Dock –

    Hosts panels whose bodies are the server templates render_panel names; the panel methods reach the mounted dock through its ref.

Dock

Dock(*, render_panel: Slot | None = None, popout_url: Prop[str] = None, floating_group_bounds: Prop[FloatingGroupBounds] = None, on_ready: Event = None, on_layout_change: Event = None, on_visibility: Event = None, on_active_panel: Event = None, on_panel_removed: Event = None, **kwargs: Unpack[Shared])

Bases: Element

Hosts panels whose bodies are the server templates render_panel names; the panel methods reach the mounted dock through its ref.

Parameters:

  • render_panel (Slot | None, default: None ) –

    The slot rendering a panel's body from its params.

  • popout_url (Prop[str], default: None ) –

    The page a popped-out group opens in.

  • floating_group_bounds (Prop[FloatingGroupBounds], default: None ) –

    Where a floating group may move: wholly within the viewport, or keeping the given minimum width and height in view.

  • on_ready (Event, default: None ) –

    Fires once the dock is mounted and can take panels.

  • on_layout_change (Event, default: None ) –

    Receives the serialized layout once a burst of changes settles.

  • on_visibility (Event, default: None ) –

    Receives a panel's id and whether it became visible.

  • on_active_panel (Event, default: None ) –

    Receives the id of the panel that became active.

  • on_panel_removed (Event, default: None ) –

    Receives the id of the panel the user closed.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Methods:

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def __init__(
    self,
    *,
    render_panel: react.Slot | None = None,
    popout_url: Prop[str] = None,
    floating_group_bounds: Prop[FloatingGroupBounds] = None,
    on_ready: Event = None,
    on_layout_change: Event = None,
    on_visibility: Event = None,
    on_active_panel: Event = None,
    on_panel_removed: Event = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the dock; a prop left None keeps the component's default.

    Args:
        render_panel: The slot rendering a panel's body from its params.
        popout_url: The page a popped-out group opens in.
        floating_group_bounds: Where a floating group may move: wholly within the viewport, or keeping the given minimum width and height in view.
        on_ready: Fires once the dock is mounted and can take panels.
        on_layout_change: Receives the serialized layout once a burst of changes settles.
        on_visibility: Receives a panel's id and whether it became visible.
        on_active_panel: Receives the id of the panel that became active.
        on_panel_removed: Receives the id of the panel the user closed.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    kwargs.setdefault("ref", next_ref(KIND))
    super().__init__("ff-dock", locals(), None, **kwargs)
add_panel
add_panel(panel_id: str, title: str, template_name: str, **add_on: object) -> None

Adds a panel showing a template; an id already present is left alone.

Parameters:

  • panel_id (str) –

    The new panel's id.

  • title (str) –

    The tab title.

  • template_name (str) –

    The server template the panel's body renders.

  • add_on (object, default: {} ) –

    dockview's placement options, such as position, inactive and the initial size.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def add_panel(self, panel_id: str, title: str, template_name: str, **add_on: object) -> None:
    """Adds a panel showing a template; an id already present is left alone.

    Args:
        panel_id: The new panel's id.
        title: The tab title.
        template_name: The server template the panel's body renders.
        add_on: dockview's placement options, such as `position`, `inactive` and the initial size.
    """
    self.call("addPanel", panel_id, title, template_name, add_on)
remove_panel
remove_panel(panel_id: str) -> None

Removes the panel from the dock.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def remove_panel(self, panel_id: str) -> None:
    """Removes the panel from the dock."""
    self.call("removePanel", panel_id)
active_panel
active_panel(panel_id: str) -> None

Activates the panel's tab.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def active_panel(self, panel_id: str) -> None:
    """Activates the panel's tab."""
    self.call("activePanel", panel_id)
restore_layout
restore_layout(layout: Layout) -> None

Replaces the arrangement with a serialized dockview layout.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def restore_layout(self, layout: Layout) -> None:
    """Replaces the arrangement with a serialized dockview layout."""
    self.call("restoreLayout", dict(layout))
move_to
move_to(panel_id: str, target_id: str) -> None

Moves a panel into the group of another.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def move_to(self, panel_id: str, target_id: str) -> None:
    """Moves a panel into the group of another."""
    self.call("moveTo", panel_id, target_id)
set_panel_title
set_panel_title(panel_id: str, title: str) -> None

Renames the panel's tab.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def set_panel_title(self, panel_id: str, title: str) -> None:
    """Renames the panel's tab."""
    self.call("setTitle", panel_id, title)
maximize
maximize(panel_id: str) -> None

Maximizes the panel's group.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def maximize(self, panel_id: str) -> None:
    """Maximizes the panel's group."""
    self.call("maximize", panel_id)
restore_maximized
restore_maximized() -> None

Returns the maximized group to its place.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dock.py
def restore_maximized(self) -> None:
    """Returns the maximized group to its place."""
    self.call("restoreMaximized")

drawer

A bar at the bottom of its parent with a body that slides up under it.

Classes:

  • Drawer –

    Pins its first child, the bar, to the bottom of its parent and slides the rest up under it while open_ holds, so the bar heads the open drawer.

Drawer

Drawer(children: object = None, *, open_: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

Pins its first child, the bar, to the bottom of its parent and slides the rest up under it while open_ holds, so the bar heads the open drawer.

Parameters:

  • children (object, default: None ) –

    The bar, then the body.

  • open_ (Prop[bool], default: None ) –

    Whether the body is open.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/drawer.py
def __init__(self, children: object = None, *, open_: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the drawer; a prop left None keeps the component's default.

    Args:
        children: The bar, then the body.
        open_: Whether the body is open.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-drawer", locals(), children, **kwargs)

dropdown_menu

Dropdown menus: a Radix menu and its trigger, content, items and groups.

Classes:

DropdownMenu

DropdownMenu(children: object = None, *, open_: Prop[bool] = None, default_open: Prop[bool] = None, on_open_change: Event = None, modal: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A menu opened by its trigger.

Parameters:

  • children (object, default: None ) –

    The menu's trigger and content.

  • open_ (Prop[bool], default: None ) –

    Whether the menu is open.

  • default_open (Prop[bool], default: None ) –

    Whether the menu opens at mount while open_ is unset.

  • on_open_change (Event, default: None ) –

    Receives the new open state.

  • modal (Prop[bool], default: None ) –

    Blocks the page outside the menu while it is open.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(
    self,
    children: object = None,
    *,
    open_: Prop[bool] = None,
    default_open: Prop[bool] = None,
    on_open_change: Event = None,
    modal: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the menu; a prop left None keeps the component's default.

    Args:
        children: The menu's trigger and content.
        open_: Whether the menu is open.
        default_open: Whether the menu opens at mount while `open_` is unset.
        on_open_change: Receives the new open state.
        modal: Blocks the page outside the menu while it is open.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu", locals(), children, **kwargs)

DropdownMenuTrigger

DropdownMenuTrigger(children: object = None, *, as_child: Prop[bool] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The control opening the menu; as_child renders the child element itself.

Parameters:

  • children (object, default: None ) –

    The trigger's content.

  • as_child (Prop[bool], default: None ) –

    Renders the child element itself as the trigger.

  • disabled (Prop[bool], default: None ) –

    Disables the trigger.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, *, as_child: Prop[bool] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the trigger; a prop left None keeps the component's default.

    Args:
        children: The trigger's content.
        as_child: Renders the child element itself as the trigger.
        disabled: Disables the trigger.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-trigger", locals(), children, **kwargs)

DropdownMenuContent

DropdownMenuContent(children: object = None, *, side: Prop[Side] = None, align: Prop[Align] = None, side_offset: Prop[float] = None, align_offset: Prop[float] = None, loop: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The floating list of items.

Parameters:

  • children (object, default: None ) –

    The menu's items.

  • side (Prop[Side], default: None ) –

    The side of the trigger the list opens on.

  • align (Prop[Align], default: None ) –

    How the list aligns against the trigger.

  • side_offset (Prop[float], default: None ) –

    The gap between the trigger and the list, in pixels.

  • align_offset (Prop[float], default: None ) –

    The shift along the aligned edge, in pixels.

  • loop (Prop[bool], default: None ) –

    Whether keyboard navigation wraps from the last item to the first.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(
    self,
    children: object = None,
    *,
    side: Prop[Side] = None,
    align: Prop[Align] = None,
    side_offset: Prop[float] = None,
    align_offset: Prop[float] = None,
    loop: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the list; a prop left None keeps the component's default.

    Args:
        children: The menu's items.
        side: The side of the trigger the list opens on.
        align: How the list aligns against the trigger.
        side_offset: The gap between the trigger and the list, in pixels.
        align_offset: The shift along the aligned edge, in pixels.
        loop: Whether keyboard navigation wraps from the last item to the first.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-content", locals(), children, **kwargs)

DropdownMenuItem

DropdownMenuItem(children: object = None, *, on_select: Event = None, disabled: Prop[bool] = None, inset: Prop[bool] = None, variant: Prop[MenuItemVariant] = None, text_value: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

One item; on_select fires when it is chosen.

Parameters:

  • children (object, default: None ) –

    The item's label.

  • on_select (Event, default: None ) –

    Fires when the item is chosen.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • inset (Prop[bool], default: None ) –

    Indents the item to line up with items that carry an icon.

  • variant (Prop[MenuItemVariant], default: None ) –

    The item's style.

  • text_value (Prop[str], default: None ) –

    The text typeahead matches, for a label that is not plain text.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(
    self,
    children: object = None,
    *,
    on_select: Event = None,
    disabled: Prop[bool] = None,
    inset: Prop[bool] = None,
    variant: Prop[MenuItemVariant] = None,
    text_value: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label.
        on_select: Fires when the item is chosen.
        disabled: Disables the item.
        inset: Indents the item to line up with items that carry an icon.
        variant: The item's style.
        text_value: The text typeahead matches, for a label that is not plain text.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-item", locals(), children, **kwargs)

DropdownMenuCheckboxItem

DropdownMenuCheckboxItem(children: object = None, *, checked: Prop[bool] = None, on_checked_change: Event = None, on_select: Event = None, disabled: Prop[bool] = None, text_value: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

An item with a check mark.

Parameters:

  • children (object, default: None ) –

    The item's label.

  • checked (Prop[bool], default: None ) –

    Whether the item is checked.

  • on_checked_change (Event, default: None ) –

    Receives the new checked state.

  • on_select (Event, default: None ) –

    Fires when the item is chosen.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • text_value (Prop[str], default: None ) –

    The text typeahead matches, for a label that is not plain text.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(
    self,
    children: object = None,
    *,
    checked: Prop[bool] = None,
    on_checked_change: Event = None,
    on_select: Event = None,
    disabled: Prop[bool] = None,
    text_value: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label.
        checked: Whether the item is checked.
        on_checked_change: Receives the new checked state.
        on_select: Fires when the item is chosen.
        disabled: Disables the item.
        text_value: The text typeahead matches, for a label that is not plain text.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-checkbox-item", locals(), children, **kwargs)

DropdownMenuRadioGroup

DropdownMenuRadioGroup(children: object = None, *, value: Prop[str] = None, on_value_change: Event = None, **kwargs: Unpack[Shared])

Bases: Element

Radio items choosing one value.

Parameters:

  • children (object, default: None ) –

    The radio items.

  • value (Prop[str], default: None ) –

    The chosen item's value.

  • on_value_change (Event, default: None ) –

    Receives the chosen value.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, *, value: Prop[str] = None, on_value_change: Event = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the group; a prop left None keeps the component's default.

    Args:
        children: The radio items.
        value: The chosen item's value.
        on_value_change: Receives the chosen value.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-radio-group", locals(), children, **kwargs)

DropdownMenuRadioItem

DropdownMenuRadioItem(children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

One radio item.

Parameters:

  • children (object, default: None ) –

    The item's label.

  • value (Prop[str], default: None ) –

    The value the item chooses.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label.
        value: The value the item chooses.
        disabled: Disables the item.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-radio-item", locals(), children, **kwargs)

DropdownMenuLabel

DropdownMenuLabel(children: object = None, *, inset: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A heading inside the menu.

Parameters:

  • children (object, default: None ) –

    The heading's text.

  • inset (Prop[bool], default: None ) –

    Indents the heading to line up with items that carry an icon.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, *, inset: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the heading; a prop left None keeps the component's default.

    Args:
        children: The heading's text.
        inset: Indents the heading to line up with items that carry an icon.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-label", locals(), children, **kwargs)

DropdownMenuSeparator

DropdownMenuSeparator(**kwargs: Unpack[Shared])

Bases: Element

A rule between items.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, **kwargs: Unpack[Shared]) -> None:
    """Creates the rule."""
    super().__init__("ff-dropdown-menu-separator", locals(), None, **kwargs)

DropdownMenuShortcut

DropdownMenuShortcut(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The key hint at an item's end.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the key hint from `children`."""
    super().__init__("ff-dropdown-menu-shortcut", locals(), children, **kwargs)

DropdownMenuGroup

DropdownMenuGroup(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

Items under one label.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the group around `children`."""
    super().__init__("ff-dropdown-menu-group", locals(), children, **kwargs)

DropdownMenuSub

DropdownMenuSub(children: object = None, *, open_: Prop[bool] = None, default_open: Prop[bool] = None, on_open_change: Event = None, **kwargs: Unpack[Shared])

Bases: Element

A nested menu.

Parameters:

  • children (object, default: None ) –

    The nested menu's trigger and content.

  • open_ (Prop[bool], default: None ) –

    Whether the nested menu is open.

  • default_open (Prop[bool], default: None ) –

    Whether the nested menu opens at mount while open_ is unset.

  • on_open_change (Event, default: None ) –

    Receives the new open state.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, *, open_: Prop[bool] = None, default_open: Prop[bool] = None, on_open_change: Event = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the nested menu; a prop left None keeps the component's default.

    Args:
        children: The nested menu's trigger and content.
        open_: Whether the nested menu is open.
        default_open: Whether the nested menu opens at mount while `open_` is unset.
        on_open_change: Receives the new open state.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-sub", locals(), children, **kwargs)

DropdownMenuSubTrigger

DropdownMenuSubTrigger(children: object = None, *, inset: Prop[bool] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The item opening a nested menu.

Parameters:

  • children (object, default: None ) –

    The item's label.

  • inset (Prop[bool], default: None ) –

    Indents the item to line up with items that carry an icon.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, *, inset: Prop[bool] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label.
        inset: Indents the item to line up with items that carry an icon.
        disabled: Disables the item.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-dropdown-menu-sub-trigger", locals(), children, **kwargs)

DropdownMenuSubContent

DropdownMenuSubContent(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The nested menu's list.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/dropdown_menu.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the nested list around `children`."""
    super().__init__("ff-dropdown-menu-sub-content", locals(), children, **kwargs)

element

The Element base: a wrapper's declared parameters become React props by name, those named on_* events.

Type Aliases:

  • Event –

    An event handler, or unset.

  • Prop –

    A prop: a static value, a state binding, or unset.

Classes:

  • Shared –

    The trame-shared props and events a wrapper accepts beside its own.

  • Element –

    A component of the Ff library: its wrapper's parameters are its props and events, trame's shared names pass through.

Functions:

  • react_name –

    The React prop of a parameter: one trailing underscore stripped, then the rename map, else camelCase.

  • is_event –

    Whether a parameter is an event handler: its name starts with on_.

  • next_ref –

    A name for trame.refs, unique for the process.

  • setter –

    A client-side handler writing the event payload into the state variable.

Attributes:

  • RESERVED –

    Names of a wrapper's locals that are never props.

  • MODEL –

    The Python-only parameter of the control wrappers: the state variable the control binds and writes client-side.

  • RENAMES (Mapping[str, str]) –

    Parameters whose React prop is not their camelCase.

  • SHARED –

    The props and events trame registers on every React element.

RESERVED module-attribute

RESERVED = frozenset({'self', 'children', 'kwargs', '__class__'})

Names of a wrapper's locals that are never props.

MODEL module-attribute

MODEL = 'model'

The Python-only parameter of the control wrappers: the state variable the control binds and writes client-side.

RENAMES module-attribute

RENAMES: Mapping[str, str] = {'aria_label': 'aria-label', 'aria_disabled': 'aria-disabled', 'aria_pressed': 'aria-pressed'}

Parameters whose React prop is not their camelCase.

SHARED module-attribute

SHARED = frozenset(name if isinstance(name, str) else name[0] for name in (*SHARED_PROPS, *SHARED_EVENTS))

The props and events trame registers on every React element.

Prop

Prop = T | Bind | None

A prop: a static value, a state binding, or unset.

Event

Event = Callback | None

An event handler, or unset.

Shared

Bases: TypedDict

The trame-shared props and events a wrapper accepts beside its own.

Element

Element(tag: str, params: Mapping[str, object], children: object = None, *, rename: Mapping[str, str] = RENAMES, **kwargs: Unpack[Shared])

Bases: AbstractElement

A component of the Ff library: its wrapper's parameters are its props and events, trame's shared names pass through.

Parameters:

  • tag (str) –

    The element's custom tag, such as ff-button.

  • params (Mapping[str, object]) –

    The wrapper's locals; each declared parameter becomes a prop, or an event when named on_*.

  • children (object, default: None ) –

    The content nested inside the element.

  • rename (Mapping[str, str], default: RENAMES ) –

    Parameters whose React prop is not their camelCase.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, passed through as they are.

Methods:

  • call –

    Calls a method of the mounted component through its ref.

Attributes:

  • reference (str) –

    The name the client registers this element under on trame.refs; KeyError when it has none.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/element.py
def __init__(self, tag: str, params: Mapping[str, object], children: object = None, *, rename: Mapping[str, str] = RENAMES, **kwargs: Unpack[Shared]) -> None:
    """Declares the wrapper's parameters as props and events and enables the Ff module on the server.

    Args:
        tag: The element's custom tag, such as `ff-button`.
        params: The wrapper's locals; each declared parameter becomes a prop, or an event when named `on_*`.
        children: The content nested inside the element.
        rename: Parameters whose React prop is not their camelCase.
        kwargs: Shared trame props and events, passed through as they are.
    """
    declared = {name: value for name, value in params.items() if name not in RESERVED and name != MODEL}
    fresh = [name for name in declared if name not in SHARED]
    props = [(name, react_name(name, rename)) for name in fresh if not is_event(name)]
    events = [(name, react_name(name, rename)) for name in fresh if is_event(name)]

    super().__init__(tag, children, **declared, **kwargs)

    self._attr_names.extend(props)
    self._event_names.extend(events)
    _ = self.server.enable_module(descriptor())
reference property
reference: str

The name the client registers this element under on trame.refs; KeyError when it has none.

call
call(method: str, *args: object) -> None

Calls a method of the mounted component through its ref.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/element.py
def call(self, method: str, *args: object) -> None:
    """Calls a method of the mounted component through its ref."""
    self.server.js_call(self.reference, method, *args)

react_name

react_name(name: str, rename: Mapping[str, str] = RENAMES) -> str

The React prop of a parameter: one trailing underscore stripped, then the rename map, else camelCase.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/element.py
def react_name(name: str, rename: Mapping[str, str] = RENAMES) -> str:
    """The React prop of a parameter: one trailing underscore stripped, then the rename map, else camelCase."""
    stripped = name.removesuffix("_")
    if stripped in rename:
        return rename[stripped]

    head, *tail = stripped.split("_")

    return head + "".join(part[:1].upper() + part[1:] for part in tail)

is_event

is_event(name: str) -> bool

Whether a parameter is an event handler: its name starts with on_.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/element.py
def is_event(name: str) -> bool:
    """Whether a parameter is an event handler: its name starts with `on_`."""
    return name.startswith(EVENT_PREFIX)

next_ref

next_ref(kind: str) -> str

A name for trame.refs, unique for the process.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/element.py
def next_ref(kind: str) -> str:
    """A name for trame.refs, unique for the process."""
    return f"{REF_PREFIX}_{kind}_{next(REFS)}"

setter

setter(model: str, value: str = EVENT) -> Callback

A client-side handler writing the event payload into the state variable.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/element.py
def setter(model: str, value: str = EVENT) -> react.Callback:
    """A client-side handler writing the event payload into the state variable."""
    return react.Callback(f"trame.state.set({json.dumps(model)}, {value})")

entity_grid

The entity grid: rows of bodies or boundaries with their conditions as read-only editors, one tab stop with roving focus.

Classes:

  • LinePart –

    One run of text in a condition line.

  • ConditionLine –

    One condition a row received, as the parts it reads in.

  • BodyChip –

    A body a boundary touches, by its name and its body color.

  • EntityRow –

    One body or boundary group: its kind icon, its name or the bodies it touches, its material and measure, and its conditions as cards.

  • EntityGrid –

    Rows of bodies or boundaries as one grid: the arrows move the focus, Enter selects, F frames, S shows a hidden body and Escape clears.

LinePart

Bases: TypedDict

One run of text in a condition line.

Attributes:

  • text (str) –

    The text, separators included.

  • muted (bool) –

    Whether the part reads dimmer than the line, such as an axis the frame drops.

  • tip (str) –

    The part's tooltip; empty for none.

text instance-attribute
text: str

The text, separators included.

muted instance-attribute
muted: bool

Whether the part reads dimmer than the line, such as an axis the frame drops.

tip instance-attribute
tip: str

The part's tooltip; empty for none.

ConditionLine

Bases: TypedDict

One condition a row received, as the parts it reads in.

Attributes:

parts instance-attribute
parts: list[LinePart]

The parts, in reading order.

BodyChip

Bases: TypedDict

A body a boundary touches, by its name and its body color.

Attributes:

  • name (str) –

    The body's name, or External for the outside.

  • color (str) –

    The body's color as sRGB hex; absent for the outside.

name instance-attribute
name: str

The body's name, or External for the outside.

color instance-attribute
color: str

The body's color as sRGB hex; absent for the outside.

EntityRow

Bases: TypedDict

One body or boundary group: its kind icon, its name or the bodies it touches, its material and measure, and its conditions as cards.

Attributes:

  • id (str) –

    The entity id, such as boundary:RIGHTFACE.

  • name (str) –

    The name as authored, such as RightFace.

  • detail (str) –

    The measure of a body or a boundary.

  • detail_tip (str) –

    The detail's tooltip, such as the face area a 2D length stands for.

  • material (str) –

    A body's material, shown as a read-only field.

  • material_tip (str) –

    The material's full name.

  • tip (list[str]) –

    The name's tooltip lines, the Elmer name first.

  • kind_icon (IconName) –

    The icon of the group's kind: a body, a face or an edge.

  • chips (list[BodyChip]) –

    The bodies an unnamed boundary touches, which name it.

  • cards (list[ConditionCard]) –

    One read-only editor per condition the group received.

  • group (bool) –

    Whether the row heads the bodies of one material.

  • member (bool) –

    Whether the row is a body under a material group.

  • dimmed (bool) –

    Whether the row has no cells to highlight.

  • dim_tip (str) –

    Why a dimmed row cannot be highlighted.

  • hidden (bool) –

    Whether the body is hidden in the Field Viewer, which the row offers to show.

  • label (str) –

    The row's accessible name: its name, its conditions with their tooltips and why it is dimmed or hidden.

id instance-attribute
id: str

The entity id, such as boundary:RIGHTFACE.

name instance-attribute
name: str

The name as authored, such as RightFace.

detail instance-attribute
detail: str

The measure of a body or a boundary.

detail_tip instance-attribute
detail_tip: str

The detail's tooltip, such as the face area a 2D length stands for.

material instance-attribute
material: str

A body's material, shown as a read-only field.

material_tip instance-attribute
material_tip: str

The material's full name.

tip instance-attribute
tip: list[str]

The name's tooltip lines, the Elmer name first.

kind_icon instance-attribute
kind_icon: IconName

The icon of the group's kind: a body, a face or an edge.

chips instance-attribute
chips: list[BodyChip]

The bodies an unnamed boundary touches, which name it.

cards instance-attribute

One read-only editor per condition the group received.

group instance-attribute
group: bool

Whether the row heads the bodies of one material.

member instance-attribute
member: bool

Whether the row is a body under a material group.

dimmed instance-attribute
dimmed: bool

Whether the row has no cells to highlight.

dim_tip instance-attribute
dim_tip: str

Why a dimmed row cannot be highlighted.

hidden instance-attribute
hidden: bool

Whether the body is hidden in the Field Viewer, which the row offers to show.

label instance-attribute
label: str

The row's accessible name: its name, its conditions with their tooltips and why it is dimmed or hidden.

EntityGrid

EntityGrid(*, rows: Prop[Sequence[EntityRow]] = None, selected: Prop[str] = None, label: Prop[str] = None, columns: Prop[Sequence[str]] = None, on_select: Event = None, on_frame: Event = None, on_show: Event = None, on_hover: Event = None, **kwargs: Unpack[Shared])

Bases: Element

Rows of bodies or boundaries as one grid: the arrows move the focus, Enter selects, F frames, S shows a hidden body and Escape clears.

Parameters:

  • rows (Prop[Sequence[EntityRow]], default: None ) –

    The rows, in order.

  • selected (Prop[str], default: None ) –

    The id of the selected row.

  • label (Prop[str], default: None ) –

    The grid's accessible name.

  • columns (Prop[Sequence[str]], default: None ) –

    The header of each column: the name and the detail.

  • on_select (Event, default: None ) –

    Receives the id of a row clicked or chosen with Enter, or an empty id for Escape.

  • on_frame (Event, default: None ) –

    Receives the id of a row double-clicked or framed with F.

  • on_show (Event, default: None ) –

    Receives the id of a hidden body whose Show was clicked or pressed with S.

  • on_hover (Event, default: None ) –

    Receives the id of the row the pointer or the keyboard focus moved onto, and an empty id once both left the grid.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/entity_grid.py
def __init__(
    self,
    *,
    rows: Prop[Sequence[EntityRow]] = None,
    selected: Prop[str] = None,
    label: Prop[str] = None,
    columns: Prop[Sequence[str]] = None,
    on_select: Event = None,
    on_frame: Event = None,
    on_show: Event = None,
    on_hover: Event = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the grid; a prop left None keeps the component's default.

    Args:
        rows: The rows, in order.
        selected: The id of the selected row.
        label: The grid's accessible name.
        columns: The header of each column: the name and the detail.
        on_select: Receives the id of a row clicked or chosen with Enter, or an empty id for Escape.
        on_frame: Receives the id of a row double-clicked or framed with F.
        on_show: Receives the id of a hidden body whose Show was clicked or pressed with S.
        on_hover: Receives the id of the row the pointer or the keyboard focus moved onto, and an empty id once both left the grid.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-entity-grid", locals(), None, **kwargs)

field

Fields: a labelled control with its description and error.

Classes:

Field

Field(children: object = None, *, orientation: Prop[FieldOrientation] = None, **kwargs: Unpack[Shared])

Bases: Element

A control with its label, laid out along orientation.

Parameters:

  • children (object, default: None ) –

    The field's label and control.

  • orientation (Prop[FieldOrientation], default: None ) –

    The direction the label and the control lay out along.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, *, orientation: Prop[FieldOrientation] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the field; a prop left None keeps the component's default.

    Args:
        children: The field's label and control.
        orientation: The direction the label and the control lay out along.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-field", locals(), children, **kwargs)

FieldLabel

FieldLabel(children: object = None, *, html_for: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

The label of a field.

Parameters:

  • children (object, default: None ) –

    The label's text.

  • html_for (Prop[str], default: None ) –

    The id of the control the label names.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, *, html_for: Prop[str] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the label; a prop left None keeps the component's default.

    Args:
        children: The label's text.
        html_for: The id of the control the label names.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-field-label", locals(), children, **kwargs)

FieldContent

FieldContent(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The column holding a field's control and description.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the column around `children`."""
    super().__init__("ff-field-content", locals(), children, **kwargs)

FieldDescription

FieldDescription(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

Help text under a field.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the help text from `children`."""
    super().__init__("ff-field-description", locals(), children, **kwargs)

FieldError

FieldError(children: object = None, *, errors: Prop[list[dict[str, str]]] = None, **kwargs: Unpack[Shared])

Bases: Element

The error text of a field, or the errors it lists.

Parameters:

  • children (object, default: None ) –

    The error's text.

  • errors (Prop[list[dict[str, str]]], default: None ) –

    Errors listed by their message when no children are given.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, *, errors: Prop[list[dict[str, str]]] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the error; a prop left None keeps the component's default.

    Args:
        children: The error's text.
        errors: Errors listed by their `message` when no children are given.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-field-error", locals(), children, **kwargs)

FieldGroup

FieldGroup(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A stack of fields.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the stack around `children`."""
    super().__init__("ff-field-group", locals(), children, **kwargs)

FieldSet

FieldSet(children: object = None, *, disabled: Prop[bool] = None, name: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A fieldset of related fields.

Parameters:

  • children (object, default: None ) –

    The fieldset's legend and fields.

  • disabled (Prop[bool], default: None ) –

    Disables every control in the fieldset.

  • name (Prop[str], default: None ) –

    The fieldset's form name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, *, disabled: Prop[bool] = None, name: Prop[str] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the fieldset; a prop left None keeps the component's default.

    Args:
        children: The fieldset's legend and fields.
        disabled: Disables every control in the fieldset.
        name: The fieldset's form name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-field-set", locals(), children, **kwargs)

FieldLegend

FieldLegend(children: object = None, *, variant: Prop[FieldLegendVariant] = None, **kwargs: Unpack[Shared])

Bases: Element

The legend of a fieldset.

Parameters:

  • children (object, default: None ) –

    The legend's text.

  • variant (Prop[FieldLegendVariant], default: None ) –

    Whether the legend reads as a legend or as a label.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, *, variant: Prop[FieldLegendVariant] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the legend; a prop left None keeps the component's default.

    Args:
        children: The legend's text.
        variant: Whether the legend reads as a legend or as a label.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-field-legend", locals(), children, **kwargs)

FieldSeparator

FieldSeparator(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A rule between fields, with optional text.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the rule, with `children` as its text."""
    super().__init__("ff-field-separator", locals(), children, **kwargs)

FieldTitle

FieldTitle(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

A title styled like a label without being one.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/field.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the title from `children`."""
    super().__init__("ff-field-title", locals(), children, **kwargs)

fields

Read-only fields: an authored value shown in the control that would edit it.

Classes:

  • FieldView –

    One labelled read-only field.

  • ConditionCard –

    One condition as the read-only editor its authoring form would be.

  • Fields –

    Labelled read-only fields in two aligned columns.

FieldView

Bases: TypedDict

One labelled read-only field.

Attributes:

  • label (str) –

    The field's label.

  • kind (FieldKind) –

    How the value shows: a number with its unit, one cell per component, plain text, or a select's choice.

  • value (NotRequired[str]) –

    The value of a quantity, text or choice field.

  • values (NotRequired[list[str | None]]) –

    Each component of a vector field; None for a free one.

  • axes (NotRequired[list[str]]) –

    The label of each component of a vector field.

  • unit (NotRequired[str]) –

    The unit after the value or the last component.

  • dropped (NotRequired[list[int]]) –

    The components of a vector the solve frame drops, shown muted.

  • tip (NotRequired[str]) –

    What the screen does not show about the field, such as why a component is muted.

label instance-attribute
label: str

The field's label.

kind instance-attribute
kind: FieldKind

How the value shows: a number with its unit, one cell per component, plain text, or a select's choice.

value instance-attribute
value: NotRequired[str]

The value of a quantity, text or choice field.

values instance-attribute
values: NotRequired[list[str | None]]

Each component of a vector field; None for a free one.

axes instance-attribute

The label of each component of a vector field.

unit instance-attribute

The unit after the value or the last component.

dropped instance-attribute
dropped: NotRequired[list[int]]

The components of a vector the solve frame drops, shown muted.

tip instance-attribute

What the screen does not show about the field, such as why a component is muted.

ConditionCard

Bases: TypedDict

One condition as the read-only editor its authoring form would be.

Attributes:

title instance-attribute
title: str

The condition type, such as Surface Force.

icon instance-attribute

The condition's glyph icon; absent for a condition the scene draws no glyph for.

fields instance-attribute
fields: list[FieldView]

The condition's fields in authoring order.

Fields

Fields(*, fields: Prop[Sequence[FieldView]] = None, **kwargs: Unpack[Shared])

Bases: Element

Labelled read-only fields in two aligned columns.

Parameters:

  • fields (Prop[Sequence[FieldView]], default: None ) –

    The fields in order.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/fields.py
def __init__(self, *, fields: Prop[Sequence[FieldView]] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the fields; a prop left None keeps the component's default.

    Args:
        fields: The fields in order.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-fields", locals(), None, **kwargs)

icon

The icon: one of the curated lucide names.

Type Aliases:

  • IconName –

    The names in the dist's icons.json.

Classes:

  • Icon –

    A lucide icon; an unknown name draws circle-help with a console warning.

IconName

IconName = Literal['anchor', 'app-window', 'arrow-big-right-dash', 'arrow-down-to-line', 'arrow-left-to-line', 'arrow-right-to-line', 'arrow-up-right', 'arrow-up-to-line', 'axis-3d', 'box', 'camera', 'check', 'chevron-down', 'chevron-up', 'chevron-right', 'circle-dashed', 'circle-dot', 'circle-help', 'circle-x', 'columns-3', 'copy', 'copy-check', 'external-link', 'eye', 'eye-off', 'file', 'filter', 'flame', 'folder', 'git-commit-horizontal', 'grip-vertical', 'info', 'layout-grid', 'loader-circle', 'magnet', 'maximize-2', 'minimize-2', 'minus', 'pentagon', 'picture-in-picture-2', 'play', 'plus', 'refresh-cw', 'scaling', 'scan', 'search', 'settings', 'sliders-horizontal', 'terminal', 'trash-2', 'triangle-alert', 'view-2d', 'view-back', 'view-front', 'x', 'zap']

The names in the dist's icons.json.

Icon

Icon(name: IconName | Bind, *, size: Prop[float] = None, color: Prop[str] = None, stroke_width: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

A lucide icon; an unknown name draws circle-help with a console warning.

Parameters:

  • name (IconName | Bind) –

    The lucide icon's name, or a binding to one.

  • size (Prop[float], default: None ) –

    The icon's width and height, in pixels.

  • color (Prop[str], default: None ) –

    The stroke colour; the text colour by default.

  • stroke_width (Prop[float], default: None ) –

    The stroke width, in pixels.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/icon.py
def __init__(self, name: IconName | react.Bind, *, size: Prop[float] = None, color: Prop[str] = None, stroke_width: Prop[float] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the icon; a prop left None keeps the component's default.

    Args:
        name: The lucide icon's name, or a binding to one.
        size: The icon's width and height, in pixels.
        color: The stroke colour; the text colour by default.
        stroke_width: The stroke width, in pixels.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-icon", locals(), None, **kwargs)

input

Text inputs: uncontrolled, committing to the state on blur and Enter, named after the state key they bind.

Classes:

  • Input –

    A text input seeded from model and writing it back on blur and Enter; a controlled value would drop keystrokes on the round trip.

  • Textarea –

    A multi-line input seeded from model and writing it back on blur.

  • InputGroup –

    An input with addons on its sides.

  • InputGroupAddon –

    An addon of an input group, aligned to one side.

  • InputGroupText –

    Text inside an input group addon.

  • InputGroupInput –

    The input of an input group, with the same commit rule as Input.

  • ColorInput –

    A native color picker writing its hex value to model on every change; controlled, since a pick sends whole values, not keystrokes.

Functions:

  • committing –

    A key handler writing the input text into the state variable on Enter.

Input

Input(*, model: str | None = None, default_value: Prop[str] = None, value: Prop[str] = None, placeholder: Prop[str] = None, type_: Prop[str] = None, name: str | None = None, disabled: Prop[bool] = None, read_only: Prop[bool] = None, min_: Prop[float] = None, max_: Prop[float] = None, step: Prop[float] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A text input seeded from model and writing it back on blur and Enter; a controlled value would drop keystrokes on the round trip.

Parameters:

  • model (str | None, default: None ) –

    A state variable that seeds the text and takes it back on blur and Enter; it also names the input.

  • default_value (Prop[str], default: None ) –

    The text at mount.

  • value (Prop[str], default: None ) –

    The text as a controlled value, for a read-only readout that follows its state.

  • placeholder (Prop[str], default: None ) –

    The text shown while the input is empty.

  • type_ (Prop[str], default: None ) –

    The HTML input type.

  • name (str | None, default: None ) –

    The form field name; model by default.

  • disabled (Prop[bool], default: None ) –

    Disables the input.

  • read_only (Prop[bool], default: None ) –

    Makes the text read-only.

  • min_ (Prop[float], default: None ) –

    The smallest value of a number input.

  • max_ (Prop[float], default: None ) –

    The largest value of a number input.

  • step (Prop[float], default: None ) –

    The step of a number input.

  • aria_label (Prop[str], default: None ) –

    The accessible name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(
    self,
    *,
    model: str | None = None,
    default_value: Prop[str] = None,
    value: Prop[str] = None,
    placeholder: Prop[str] = None,
    type_: Prop[str] = None,
    name: str | None = None,
    disabled: Prop[bool] = None,
    read_only: Prop[bool] = None,
    min_: Prop[float] = None,
    max_: Prop[float] = None,
    step: Prop[float] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the input; a prop left None keeps the component's default.

    Args:
        model: A state variable that seeds the text and takes it back on blur and Enter; it also names the input.
        default_value: The text at mount.
        value: The text as a controlled value, for a read-only readout that follows its state.
        placeholder: The text shown while the input is empty.
        type_: The HTML input type.
        name: The form field name; `model` by default.
        disabled: Disables the input.
        read_only: Makes the text read-only.
        min_: The smallest value of a number input.
        max_: The largest value of a number input.
        step: The step of a number input.
        aria_label: The accessible name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None:
        default_value = react.Bind(model)
        name = name or model
        kwargs.setdefault("on_blur", setter(model, COMMIT_VALUE))
        kwargs.setdefault("on_key_down", committing(model))

    super().__init__("ff-input", locals(), None, **kwargs)

Textarea

Textarea(*, model: str | None = None, default_value: Prop[str] = None, placeholder: Prop[str] = None, rows: Prop[int] = None, name: str | None = None, disabled: Prop[bool] = None, read_only: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A multi-line input seeded from model and writing it back on blur.

Parameters:

  • model (str | None, default: None ) –

    A state variable that seeds the text and takes it back on blur; it also names the textarea.

  • default_value (Prop[str], default: None ) –

    The text at mount.

  • placeholder (Prop[str], default: None ) –

    The text shown while the textarea is empty.

  • rows (Prop[int], default: None ) –

    The visible line count.

  • name (str | None, default: None ) –

    The form field name; model by default.

  • disabled (Prop[bool], default: None ) –

    Disables the textarea.

  • read_only (Prop[bool], default: None ) –

    Makes the text read-only.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(
    self,
    *,
    model: str | None = None,
    default_value: Prop[str] = None,
    placeholder: Prop[str] = None,
    rows: Prop[int] = None,
    name: str | None = None,
    disabled: Prop[bool] = None,
    read_only: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the textarea; a prop left None keeps the component's default.

    Args:
        model: A state variable that seeds the text and takes it back on blur; it also names the textarea.
        default_value: The text at mount.
        placeholder: The text shown while the textarea is empty.
        rows: The visible line count.
        name: The form field name; `model` by default.
        disabled: Disables the textarea.
        read_only: Makes the text read-only.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None:
        default_value = react.Bind(model)
        name = name or model
        kwargs.setdefault("on_blur", setter(model, COMMIT_VALUE))

    super().__init__("ff-textarea", locals(), None, **kwargs)

InputGroup

InputGroup(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

An input with addons on its sides.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the group around `children`."""
    super().__init__("ff-input-group", locals(), children, **kwargs)

InputGroupAddon

InputGroupAddon(children: object = None, *, align: Prop[AddonAlign] = None, **kwargs: Unpack[Shared])

Bases: Element

An addon of an input group, aligned to one side.

Parameters:

  • children (object, default: None ) –

    The addon's text, icon or button.

  • align (Prop[AddonAlign], default: None ) –

    The side of the input the addon sits on.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(self, children: object = None, *, align: Prop[AddonAlign] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the addon; a prop left None keeps the component's default.

    Args:
        children: The addon's text, icon or button.
        align: The side of the input the addon sits on.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-input-group-addon", locals(), children, **kwargs)

InputGroupText

InputGroupText(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

Text inside an input group addon.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the text from `children`."""
    super().__init__("ff-input-group-text", locals(), children, **kwargs)

InputGroupInput

InputGroupInput(*, model: str | None = None, default_value: Prop[str] = None, placeholder: Prop[str] = None, type_: Prop[str] = None, name: str | None = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The input of an input group, with the same commit rule as Input.

Parameters:

  • model (str | None, default: None ) –

    A state variable that seeds the text and takes it back on blur and Enter; it also names the input.

  • default_value (Prop[str], default: None ) –

    The text at mount.

  • placeholder (Prop[str], default: None ) –

    The text shown while the input is empty.

  • type_ (Prop[str], default: None ) –

    The HTML input type.

  • name (str | None, default: None ) –

    The form field name; model by default.

  • disabled (Prop[bool], default: None ) –

    Disables the input.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(
    self,
    *,
    model: str | None = None,
    default_value: Prop[str] = None,
    placeholder: Prop[str] = None,
    type_: Prop[str] = None,
    name: str | None = None,
    disabled: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the input; a prop left None keeps the component's default.

    Args:
        model: A state variable that seeds the text and takes it back on blur and Enter; it also names the input.
        default_value: The text at mount.
        placeholder: The text shown while the input is empty.
        type_: The HTML input type.
        name: The form field name; `model` by default.
        disabled: Disables the input.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None:
        default_value = react.Bind(model)
        name = name or model
        kwargs.setdefault("on_blur", setter(model, COMMIT_VALUE))
        kwargs.setdefault("on_key_down", committing(model))

    super().__init__("ff-input-group-input", locals(), None, **kwargs)

ColorInput

ColorInput(*, model: str | None = None, value: Prop[str] = None, disabled: Prop[bool] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A native color picker writing its hex value to model on every change; controlled, since a pick sends whole values, not keystrokes.

Parameters:

  • model (str | None, default: None ) –

    A state variable bound to the colour and written on every change.

  • value (Prop[str], default: None ) –

    The colour as #rrggbb.

  • disabled (Prop[bool], default: None ) –

    Disables the picker.

  • aria_label (Prop[str], default: None ) –

    The accessible name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def __init__(
    self,
    *,
    model: str | None = None,
    value: Prop[str] = None,
    disabled: Prop[bool] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the picker; a prop left None keeps the component's default.

    Args:
        model: A state variable bound to the colour and written on every change.
        value: The colour as `#rrggbb`.
        disabled: Disables the picker.
        aria_label: The accessible name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    type_ = "color"
    if model is not None:
        value = react.Bind(model)
        kwargs.setdefault("on_change", setter(model, COMMIT_VALUE))

    super().__init__("ff-input", locals(), None, **kwargs)

committing

committing(model: str) -> Callback

A key handler writing the input text into the state variable on Enter.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/input.py
def committing(model: str) -> react.Callback:
    """A key handler writing the input text into the state variable on Enter."""
    return react.Callback(f"{EVENT}.key === {json.dumps(ENTER)} && trame.state.set({json.dumps(model)}, {COMMIT_VALUE})")

label

The label.

Classes:

  • Label –

    A label for the control html_for names.

Label

Label(children: object = None, *, html_for: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A label for the control html_for names.

Parameters:

  • children (object, default: None ) –

    The label's text.

  • html_for (Prop[str], default: None ) –

    The id of the control the label names.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/label.py
def __init__(self, children: object = None, *, html_for: Prop[str] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the label; a prop left None keeps the component's default.

    Args:
        children: The label's text.
        html_for: The id of the control the label names.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-label", locals(), children, **kwargs)

module

The Ff client module: the built dist under serve/, its trame descriptor and the URLs of its files.

Classes:

Functions:

  • version –

    The dist's version.json: the source hash and the bundle and stylesheet names.

  • stale –

    The built and the source hash when a source checkout's dist is older than its sources; None for a current dist or a wheel.

  • asset_url –

    The URL of a file under the served directory.

  • served –

    The route-relative URL of a built file with the source hash as its cache buster.

  • assets –

    The absolute URLs of the bundle and the stylesheet as the page loads them.

  • descriptor –

    The trame module: the served directory, the bundle and stylesheet to load, and the global to install.

  • initialize –

    Enables the module before the first client connects.

Attributes:

  • PACKAGE_ROOT –

    The package directory holding js/ in a source checkout; an installed wheel has none.

  • LIBRARY –

    The window global whose install(registerTag) registers the tags.

PACKAGE_ROOT module-attribute

PACKAGE_ROOT = SERVE_DIR.parents[3]

The package directory holding js/ in a source checkout; an installed wheel has none.

LIBRARY module-attribute

LIBRARY = 'Ff'

The window global whose install(registerTag) registers the tags.

VersionKey

Bases: StrEnum

The fields of version.json.

version cached

version() -> dict[str, str]

The dist's version.json: the source hash and the bundle and stylesheet names.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
@cache
def version() -> dict[str, str]:
    """The dist's version.json: the source hash and the bundle and stylesheet names."""
    path = SERVE_DIR / VERSION_FILE
    if not path.exists():
        raise FileNotFoundError(f"{path} is missing: {BUILD_HINT}")

    return cast("dict[str, str]", json.loads(path.read_text(encoding="utf-8")))

stale

stale() -> tuple[str, str] | None

The built and the source hash when a source checkout's dist is older than its sources; None for a current dist or a wheel.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def stale() -> tuple[str, str] | None:
    """The built and the source hash when a source checkout's dist is older than its sources; None for a current dist or a wheel."""
    if not (PACKAGE_ROOT / "js" / "src").is_dir():
        return None

    built = version()[VersionKey.HASH]
    expected = source_hash(PACKAGE_ROOT)

    return None if built == expected else (built, expected)

asset_url

asset_url(name: str) -> str

The URL of a file under the served directory.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def asset_url(name: str) -> str:
    """The URL of a file under the served directory."""
    return f"/{ROUTE}/{name}"

served

served(name: str) -> str

The route-relative URL of a built file with the source hash as its cache buster.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def served(name: str) -> str:
    """The route-relative URL of a built file with the source hash as its cache buster."""
    return f"{ROUTE}/{name}?v={version()[VersionKey.HASH]}"

assets

assets() -> list[str]

The absolute URLs of the bundle and the stylesheet as the page loads them.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def assets() -> list[str]:
    """The absolute URLs of the bundle and the stylesheet as the page loads them."""
    return [f"/{served(version()[key])}" for key in (VersionKey.BUNDLE, VersionKey.CSS)]

descriptor cached

descriptor() -> dict[str, object]

The trame module: the served directory, the bundle and stylesheet to load, and the global to install.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
@cache
def descriptor() -> dict[str, object]:
    """The trame module: the served directory, the bundle and stylesheet to load, and the global to install."""
    info = version()

    return {
        "serve": {ROUTE: str(SERVE_DIR)},
        "scripts": [served(info[VersionKey.BUNDLE])],
        "styles": [served(info[VersionKey.CSS])],
        "react_use": [LIBRARY],
    }

initialize

initialize(server: Server) -> None

Enables the module before the first client connects.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/module.py
def initialize(server: Server) -> None:
    """Enables the module before the first client connects."""
    _ = server.enable_module(descriptor())

notify

The shell's one-shot messages to the user: a file to save and a toast.

Classes:

  • DownloadFile –

    A file for the browser to save: a sequence number that makes each one new, its name, media type and base64 bytes.

  • ToastMessage –

    A toast: a sequence number that makes each one new, and its text.

  • Download –

    Saves each new file it is handed to the browser's downloads; renders nothing.

  • Toast –

    A short message rising in the bottom-right corner for a few seconds.

DownloadFile

Bases: TypedDict

A file for the browser to save: a sequence number that makes each one new, its name, media type and base64 bytes.

ToastMessage

Bases: TypedDict

A toast: a sequence number that makes each one new, and its text.

Download

Download(*, file: Prop[DownloadFile | None] = None, on_done: Event = None, **kwargs: Unpack[Shared])

Bases: Element

Saves each new file it is handed to the browser's downloads; renders nothing.

Parameters:

  • file (Prop[DownloadFile | None], default: None ) –

    The file to save; a new seq saves again.

  • on_done (Event, default: None ) –

    Called once the browser has the file.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/notify.py
def __init__(self, *, file: Prop[DownloadFile | None] = None, on_done: Event = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the saver; a prop left None keeps the component's default.

    Args:
        file: The file to save; a new `seq` saves again.
        on_done: Called once the browser has the file.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-download", locals(), None, **kwargs)

Toast

Toast(*, message: Prop[ToastMessage | None] = None, **kwargs: Unpack[Shared])

Bases: Element

A short message rising in the bottom-right corner for a few seconds.

Parameters:

  • message (Prop[ToastMessage | None], default: None ) –

    The message to show; a new seq shows it again.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/notify.py
def __init__(self, *, message: Prop[ToastMessage | None] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the toast; a prop left None keeps the component's default.

    Args:
        message: The message to show; a new `seq` shows it again.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-toast", locals(), None, **kwargs)

plot

The plot: a plotly figure reporting restyle, relayout and click events.

Classes:

  • Plot –

    A figure whose figure holds data, layout and config; on_click (shared) carries the picked points.

Plot

Plot(*, figure: Prop[Mapping[str, object]] = None, on_restyle: Event = None, on_relayout: Event = None, **kwargs: Unpack[Shared])

Bases: Element

A figure whose figure holds data, layout and config; on_click (shared) carries the picked points.

Parameters:

  • figure (Prop[Mapping[str, object]], default: None ) –

    The plotly figure as JSON: data, layout and config.

  • on_restyle (Event, default: None ) –

    Receives [update, trace_indices] after a trace changed, as when the legend toggles one.

  • on_relayout (Event, default: None ) –

    Receives the changed layout keys after a zoom, a pan or a resize.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/plot.py
def __init__(self, *, figure: Prop[Mapping[str, object]] = None, on_restyle: Event = None, on_relayout: Event = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the plot; a prop left None keeps the component's default.

    Args:
        figure: The plotly figure as JSON: data, layout and config.
        on_restyle: Receives `[update, trace_indices]` after a trace changed, as when the legend toggles one.
        on_relayout: Receives the changed layout keys after a zoom, a pan or a resize.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-plot", locals(), None, **kwargs)

progress

The progress bar.

Classes:

  • Progress –

    A determinate bar filled to value out of max_.

Progress

Progress(*, value: Prop[float] = None, max_: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

A determinate bar filled to value out of max_.

Parameters:

  • value (Prop[float], default: None ) –

    How far the bar is filled.

  • max_ (Prop[float], default: None ) –

    The value of a full bar.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/progress.py
def __init__(self, *, value: Prop[float] = None, max_: Prop[float] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the bar; a prop left None keeps the component's default.

    Args:
        value: How far the bar is filled.
        max_: The value of a full bar.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-progress", locals(), None, **kwargs)

reveal

Controls that appear with the setting they depend on.

Classes:

  • Reveal –

    Expands its children into place while open_ holds and collapses them away when it ends; classes lay out the children.

Reveal

Reveal(children: object = None, *, open_: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

Expands its children into place while open_ holds and collapses them away when it ends; classes lay out the children.

Parameters:

  • children (object, default: None ) –

    The controls that depend on the setting.

  • open_ (Prop[bool], default: None ) –

    Whether the setting they depend on holds.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/reveal.py
def __init__(self, children: object = None, *, open_: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the reveal; a prop left None keeps the component's default.

    Args:
        children: The controls that depend on the setting.
        open_: Whether the setting they depend on holds.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-reveal", locals(), children, **kwargs)

scene

The scene widgets: the browser-side companion of a mirrored view.

Classes:

  • SceneSync –

    Turns the mirror's triad with its camera in the browser, glides the camera to each move, supersamples the canvas when asked and reports its size in render pixels through on_resize.

SceneSync

SceneSync(*, view_ref: Prop[str] = None, camera_id: Prop[int] = None, matrix_id: Prop[int] = None, renderer_id: Prop[int] = None, move: Prop[Mapping[str, object]] = None, highlights: Prop[Mapping[str, int]] = None, highlighted: Prop[str] = None, supersample: Prop[float] = None, on_resize: Event = None, **kwargs: Unpack[Shared])

Bases: Element

Turns the mirror's triad with its camera in the browser, glides the camera to each move, supersamples the canvas when asked and reports its size in render pixels through on_resize.

Parameters:

  • view_ref (Prop[str], default: None ) –

    The trame ref of the mirrored view whose camera turns the triad and whose canvas is measured.

  • camera_id (Prop[int], default: None ) –

    The wasm id of the main renderer's camera.

  • matrix_id (Prop[int], default: None ) –

    The wasm id of the matrix the triad's actor carries.

  • renderer_id (Prop[int], default: None ) –

    The wasm id of the main renderer, whose clipping range follows a glide.

  • move (Prop[Mapping[str, object]], default: None ) –

    The camera to glide to: seq, position, focal_point, view_up and parallel_scale; a new seq starts a glide.

  • highlights (Prop[Mapping[str, int]], default: None ) –

    The wasm id of the hidden outline actor of each entity id.

  • highlighted (Prop[str], default: None ) –

    The entity id whose outline shows; empty shows none.

  • supersample (Prop[float], default: None ) –

    Render pixels per device pixel along each side; above one the canvas renders larger and the browser averages it down.

  • on_resize (Event, default: None ) –

    Receives the canvas's width, height and pixel ratio in render pixels whenever they change.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/scene.py
def __init__(
    self,
    *,
    view_ref: Prop[str] = None,
    camera_id: Prop[int] = None,
    matrix_id: Prop[int] = None,
    renderer_id: Prop[int] = None,
    move: Prop[Mapping[str, object]] = None,
    highlights: Prop[Mapping[str, int]] = None,
    highlighted: Prop[str] = None,
    supersample: Prop[float] = None,
    on_resize: Event = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the companion; a prop left None keeps the component's default.

    Args:
        view_ref: The trame ref of the mirrored view whose camera turns the triad and whose canvas is measured.
        camera_id: The wasm id of the main renderer's camera.
        matrix_id: The wasm id of the matrix the triad's actor carries.
        renderer_id: The wasm id of the main renderer, whose clipping range follows a glide.
        move: The camera to glide to: `seq`, `position`, `focal_point`, `view_up` and `parallel_scale`; a new `seq` starts a glide.
        highlights: The wasm id of the hidden outline actor of each entity id.
        highlighted: The entity id whose outline shows; empty shows none.
        supersample: Render pixels per device pixel along each side; above one the canvas renders larger and the browser averages it down.
        on_resize: Receives the canvas's width, height and pixel ratio in render pixels whenever they change.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-scene-sync", locals(), None, **kwargs)

scroll_area

Scroll areas: a viewport with styled scrollbars.

Classes:

  • ScrollArea –

    A scrolling viewport; type_ says when its bars show.

  • ScrollBar –

    A scrollbar of the area along orientation.

ScrollArea

ScrollArea(children: object = None, *, type_: Prop[ScrollAreaType] = None, scroll_hide_delay: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

A scrolling viewport; type_ says when its bars show.

Parameters:

  • children (object, default: None ) –

    The scrolled content.

  • type_ (Prop[ScrollAreaType], default: None ) –

    When the scrollbars show.

  • scroll_hide_delay (Prop[float], default: None ) –

    How long the scrollbars stay after scrolling stops, in milliseconds.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/scroll_area.py
def __init__(self, children: object = None, *, type_: Prop[ScrollAreaType] = None, scroll_hide_delay: Prop[float] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the scroll area; a prop left None keeps the component's default.

    Args:
        children: The scrolled content.
        type_: When the scrollbars show.
        scroll_hide_delay: How long the scrollbars stay after scrolling stops, in milliseconds.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-scroll-area", locals(), children, **kwargs)

ScrollBar

ScrollBar(*, orientation: Prop[Orientation] = None, force_mount: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A scrollbar of the area along orientation.

Parameters:

  • orientation (Prop[Orientation], default: None ) –

    The direction the bar scrolls.

  • force_mount (Prop[bool], default: None ) –

    Keeps the bar mounted while it is hidden.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/scroll_area.py
def __init__(self, *, orientation: Prop[Orientation] = None, force_mount: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the scrollbar; a prop left None keeps the component's default.

    Args:
        orientation: The direction the bar scrolls.
        force_mount: Keeps the bar mounted while it is hidden.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-scroll-bar", locals(), None, **kwargs)

select

Selects: a Radix select and its trigger, value, content and items.

Classes:

Select

Select(children: object = None, *, model: str | None = None, value: Prop[str] = None, default_value: Prop[str] = None, on_value_change: Event = None, open_: Prop[bool] = None, default_open: Prop[bool] = None, on_open_change: Event = None, disabled: Prop[bool] = None, required: Prop[bool] = None, name: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A single-choice select; model binds its value to a state variable.

Parameters:

  • children (object, default: None ) –

    The select's trigger and content.

  • model (str | None, default: None ) –

    A state variable to bind the value to, unless on_value_change is given.

  • value (Prop[str], default: None ) –

    The chosen item's value.

  • default_value (Prop[str], default: None ) –

    The value at mount while value is unset.

  • on_value_change (Event, default: None ) –

    Receives the chosen value.

  • open_ (Prop[bool], default: None ) –

    Whether the dropdown is open.

  • default_open (Prop[bool], default: None ) –

    Whether the dropdown opens at mount while open_ is unset.

  • on_open_change (Event, default: None ) –

    Receives the new open state.

  • disabled (Prop[bool], default: None ) –

    Disables the select.

  • required (Prop[bool], default: None ) –

    Marks the select as required in a form.

  • name (Prop[str], default: None ) –

    The form field name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(
    self,
    children: object = None,
    *,
    model: str | None = None,
    value: Prop[str] = None,
    default_value: Prop[str] = None,
    on_value_change: Event = None,
    open_: Prop[bool] = None,
    default_open: Prop[bool] = None,
    on_open_change: Event = None,
    disabled: Prop[bool] = None,
    required: Prop[bool] = None,
    name: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the select; a prop left None keeps the component's default.

    Args:
        children: The select's trigger and content.
        model: A state variable to bind the value to, unless `on_value_change` is given.
        value: The chosen item's value.
        default_value: The value at mount while `value` is unset.
        on_value_change: Receives the chosen value.
        open_: Whether the dropdown is open.
        default_open: Whether the dropdown opens at mount while `open_` is unset.
        on_open_change: Receives the new open state.
        disabled: Disables the select.
        required: Marks the select as required in a form.
        name: The form field name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-select", locals(), children, **kwargs)

SelectTrigger

SelectTrigger(children: object = None, *, size: Prop[SelectTriggerSize] = None, disabled: Prop[bool] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

The button showing the chosen value.

Parameters:

  • children (object, default: None ) –

    The trigger's content, usually a SelectValue.

  • size (Prop[SelectTriggerSize], default: None ) –

    The trigger's height.

  • disabled (Prop[bool], default: None ) –

    Disables the trigger.

  • aria_label (Prop[str], default: None ) –

    The trigger's accessible name, for a select whose caption is not its label element.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(
    self,
    children: object = None,
    *,
    size: Prop[SelectTriggerSize] = None,
    disabled: Prop[bool] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the trigger; a prop left None keeps the component's default.

    Args:
        children: The trigger's content, usually a SelectValue.
        size: The trigger's height.
        disabled: Disables the trigger.
        aria_label: The trigger's accessible name, for a select whose caption is not its label element.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-select-trigger", locals(), children, **kwargs)

SelectValue

SelectValue(*, placeholder: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

The chosen value inside the trigger, or placeholder while none is.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(self, *, placeholder: Prop[str] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the value, showing `placeholder` while nothing is chosen."""
    super().__init__("ff-select-value", locals(), None, **kwargs)

SelectContent

SelectContent(children: object = None, *, position: Prop[SelectPosition] = None, side: Prop[Side] = None, align: Prop[Align] = None, side_offset: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

The dropdown holding the items.

Parameters:

  • children (object, default: None ) –

    The select's items.

  • position (Prop[SelectPosition], default: None ) –

    Whether the list sits over the chosen item or floats beside the trigger.

  • side (Prop[Side], default: None ) –

    The side of the trigger the list opens on, in popper position.

  • align (Prop[Align], default: None ) –

    How the list aligns against the trigger, in popper position.

  • side_offset (Prop[float], default: None ) –

    The gap between the trigger and the list in pixels, in popper position.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(
    self,
    children: object = None,
    *,
    position: Prop[SelectPosition] = None,
    side: Prop[Side] = None,
    align: Prop[Align] = None,
    side_offset: Prop[float] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the dropdown; a prop left None keeps the component's default.

    Args:
        children: The select's items.
        position: Whether the list sits over the chosen item or floats beside the trigger.
        side: The side of the trigger the list opens on, in popper position.
        align: How the list aligns against the trigger, in popper position.
        side_offset: The gap between the trigger and the list in pixels, in popper position.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-select-content", locals(), children, **kwargs)

SelectItem

SelectItem(children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, text_value: Prop[str] = None, flag: Prop[str] = None, detail: Prop[list[str]] = None, **kwargs: Unpack[Shared])

Bases: Element

One option; children is its label.

Parameters:

  • children (object, default: None ) –

    The option's label.

  • value (Prop[str], default: None ) –

    The value the option chooses.

  • disabled (Prop[bool], default: None ) –

    Disables the option.

  • text_value (Prop[str], default: None ) –

    The text typeahead matches, for a label that is not plain text.

  • flag (Prop[str], default: None ) –

    A state word after the label, such as Solving, set apart from the muted detail.

  • detail (Prop[list[str]], default: None ) –

    Muted parts after the label, never copied into the trigger nor matched on typeahead.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(
    self,
    children: object = None,
    *,
    value: Prop[str] = None,
    disabled: Prop[bool] = None,
    text_value: Prop[str] = None,
    flag: Prop[str] = None,
    detail: Prop[list[str]] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the option; a prop left None keeps the component's default.

    Args:
        children: The option's label.
        value: The value the option chooses.
        disabled: Disables the option.
        text_value: The text typeahead matches, for a label that is not plain text.
        flag: A state word after the label, such as Solving, set apart from the muted detail.
        detail: Muted parts after the label, never copied into the trigger nor matched on typeahead.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-select-item", locals(), children, **kwargs)

SelectGroup

SelectGroup(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

Items under one label.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the group around `children`."""
    super().__init__("ff-select-group", locals(), children, **kwargs)

SelectLabel

SelectLabel(children: object = None, **kwargs: Unpack[Shared])

Bases: Element

The label of a group.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(self, children: object = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the label from `children`."""
    super().__init__("ff-select-label", locals(), children, **kwargs)

SelectSeparator

SelectSeparator(**kwargs: Unpack[Shared])

Bases: Element

A rule between items.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/select.py
def __init__(self, **kwargs: Unpack[Shared]) -> None:
    """Creates the rule."""
    super().__init__("ff-select-separator", locals(), None, **kwargs)

separator

The separator.

Classes:

Separator

Separator(*, orientation: Prop[Orientation] = None, decorative: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A rule between content.

Parameters:

  • orientation (Prop[Orientation], default: None ) –

    The direction the rule runs.

  • decorative (Prop[bool], default: None ) –

    Hides the rule from assistive technology.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/separator.py
def __init__(self, *, orientation: Prop[Orientation] = None, decorative: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the rule; a prop left None keeps the component's default.

    Args:
        orientation: The direction the rule runs.
        decorative: Hides the rule from assistive technology.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-separator", locals(), None, **kwargs)

slider

The slider.

Classes:

  • Slider –

    A one- or two-thumb slider over a list of values, its thumbs named after aria_label; model binds the values to a state variable.

Slider

Slider(*, model: str | None = None, value: Prop[Sequence[float]] = None, default_value: Prop[Sequence[float]] = None, on_value_change: Event = None, on_value_commit: Event = None, min_: Prop[float] = None, max_: Prop[float] = None, step: Prop[float] = None, min_steps_between_thumbs: Prop[int] = None, orientation: Prop[Orientation] = None, inverted: Prop[bool] = None, disabled: Prop[bool] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

A one- or two-thumb slider over a list of values, its thumbs named after aria_label; model binds the values to a state variable.

Parameters:

  • model (str | None, default: None ) –

    A state variable to bind the values to, unless on_value_change is given.

  • value (Prop[Sequence[float]], default: None ) –

    The thumb values, one per thumb.

  • default_value (Prop[Sequence[float]], default: None ) –

    The thumb values at mount while value is unset.

  • on_value_change (Event, default: None ) –

    Receives the thumb values while a thumb moves.

  • on_value_commit (Event, default: None ) –

    Receives the thumb values when a thumb is released.

  • min_ (Prop[float], default: None ) –

    The low end of the range.

  • max_ (Prop[float], default: None ) –

    The high end of the range.

  • step (Prop[float], default: None ) –

    The step between values.

  • min_steps_between_thumbs (Prop[int], default: None ) –

    The fewest steps two thumbs keep between them.

  • orientation (Prop[Orientation], default: None ) –

    The direction the slider runs.

  • inverted (Prop[bool], default: None ) –

    Runs the range from high to low.

  • disabled (Prop[bool], default: None ) –

    Disables the slider.

  • aria_label (Prop[str], default: None ) –

    The accessible name the thumbs are named after.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/slider.py
def __init__(
    self,
    *,
    model: str | None = None,
    value: Prop[Sequence[float]] = None,
    default_value: Prop[Sequence[float]] = None,
    on_value_change: Event = None,
    on_value_commit: Event = None,
    min_: Prop[float] = None,
    max_: Prop[float] = None,
    step: Prop[float] = None,
    min_steps_between_thumbs: Prop[int] = None,
    orientation: Prop[Orientation] = None,
    inverted: Prop[bool] = None,
    disabled: Prop[bool] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the slider; a prop left None keeps the component's default.

    Args:
        model: A state variable to bind the values to, unless `on_value_change` is given.
        value: The thumb values, one per thumb.
        default_value: The thumb values at mount while `value` is unset.
        on_value_change: Receives the thumb values while a thumb moves.
        on_value_commit: Receives the thumb values when a thumb is released.
        min_: The low end of the range.
        max_: The high end of the range.
        step: The step between values.
        min_steps_between_thumbs: The fewest steps two thumbs keep between them.
        orientation: The direction the slider runs.
        inverted: Runs the range from high to low.
        disabled: Disables the slider.
        aria_label: The accessible name the thumbs are named after.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-slider", locals(), None, **kwargs)

switch

The switch.

Classes:

  • Switch –

    An on/off switch; model binds its checked state to a state variable.

Switch

Switch(*, model: str | None = None, checked: Prop[bool] = None, default_checked: Prop[bool] = None, on_checked_change: Event = None, size: Prop[SwitchSize] = None, disabled: Prop[bool] = None, aria_disabled: Prop[bool] = None, name: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

An on/off switch; model binds its checked state to a state variable.

Parameters:

  • model (str | None, default: None ) –

    A state variable to bind the checked state to, unless on_checked_change is given.

  • checked (Prop[bool], default: None ) –

    Whether the switch is on.

  • default_checked (Prop[bool], default: None ) –

    Whether the switch is on at mount while checked is unset.

  • on_checked_change (Event, default: None ) –

    Receives the new checked state.

  • size (Prop[SwitchSize], default: None ) –

    The switch's size.

  • disabled (Prop[bool], default: None ) –

    Disables the switch.

  • aria_disabled (Prop[bool], default: None ) –

    Tells assistive technology the switch is disabled.

  • name (Prop[str], default: None ) –

    The form field name.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/switch.py
def __init__(
    self,
    *,
    model: str | None = None,
    checked: Prop[bool] = None,
    default_checked: Prop[bool] = None,
    on_checked_change: Event = None,
    size: Prop[SwitchSize] = None,
    disabled: Prop[bool] = None,
    aria_disabled: Prop[bool] = None,
    name: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the switch; a prop left None keeps the component's default.

    Args:
        model: A state variable to bind the checked state to, unless `on_checked_change` is given.
        checked: Whether the switch is on.
        default_checked: Whether the switch is on at mount while `checked` is unset.
        on_checked_change: Receives the new checked state.
        size: The switch's size.
        disabled: Disables the switch.
        aria_disabled: Tells assistive technology the switch is disabled.
        name: The form field name.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_checked_change is None:
        checked = react.Bind(model)
        on_checked_change = setter(model)

    super().__init__("ff-switch", locals(), None, **kwargs)

table

The table: a TanStack table over columns, rows and options, reporting its layout, row clicks and the selection.

Type Aliases:

  • Selectable –

    Whether the user selects no rows, one or several.

Classes:

  • ColumnSpec –

    One column: its row field, header title, whether it sorts and filters as a number, how its header facets, and its width.

  • LayoutDefaults –

    The authored layout a missing document and Reset fall back to; the keys are the document's.

  • TableOptions –

    The table options; the keys are the React prop's fields.

  • Table –

    Columns over rows; options carries the persisted layout, the authored defaults and the switches.

Selectable

Selectable = Literal['multiple', 'none', 'single']

Whether the user selects no rows, one or several.

ColumnSpec

Bases: TypedDict

One column: its row field, header title, whether it sorts and filters as a number, how its header facets, and its width.

LayoutDefaults

Bases: TypedDict

The authored layout a missing document and Reset fall back to; the keys are the document's.

TableOptions

Bases: TypedDict

The table options; the keys are the React prop's fields.

Table

Table(*, columns: Prop[Sequence[ColumnSpec]] = None, rows: Prop[Sequence[Row]] = None, options: Prop[TableOptions] = None, on_layout_change: Event = None, on_row_click: Event = None, on_selection_change: Event = None, **kwargs: Unpack[Shared])

Bases: Element

Columns over rows; options carries the persisted layout, the authored defaults and the switches.

Parameters:

  • columns (Prop[Sequence[ColumnSpec]], default: None ) –

    The column specs, in the order sent.

  • rows (Prop[Sequence[Row]], default: None ) –

    The data rows.

  • options (Prop[TableOptions], default: None ) –

    The persisted layout, the authored defaults and the switches.

  • on_layout_change (Event, default: None ) –

    Receives the layout document once a burst of the user's changes settles.

  • on_row_click (Event, default: None ) –

    Receives a clicked data row.

  • on_selection_change (Event, default: None ) –

    Receives the selection, its rows under rows.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Methods:

  • restore –

    Applies a layout document, or the authored defaults for None.

  • reset_layout –

    Returns to the authored defaults.

  • scroll_to_end –

    Scrolls to the last row.

  • scroll_to_row –

    Scrolls a row of the shown row model into view.

  • open_config –

    Shows, or hides, the column configuration panel.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/table.py
def __init__(
    self,
    *,
    columns: Prop[Sequence[ColumnSpec]] = None,
    rows: Prop[Sequence[Row]] = None,
    options: Prop[TableOptions] = None,
    on_layout_change: Event = None,
    on_row_click: Event = None,
    on_selection_change: Event = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the table; a prop left None keeps the component's default.

    Args:
        columns: The column specs, in the order sent.
        rows: The data rows.
        options: The persisted layout, the authored defaults and the switches.
        on_layout_change: Receives the layout document once a burst of the user's changes settles.
        on_row_click: Receives a clicked data row.
        on_selection_change: Receives the selection, its rows under `rows`.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    kwargs.setdefault("ref", next_ref(KIND))
    super().__init__("ff-table", locals(), None, **kwargs)
restore
restore(layout: Layout | None) -> None

Applies a layout document, or the authored defaults for None.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/table.py
def restore(self, layout: Layout | None) -> None:
    """Applies a layout document, or the authored defaults for None."""
    self.call("restore", dict(layout) if layout is not None else None)
reset_layout
reset_layout() -> None

Returns to the authored defaults.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/table.py
def reset_layout(self) -> None:
    """Returns to the authored defaults."""
    self.call("resetLayout")
scroll_to_end
scroll_to_end() -> None

Scrolls to the last row.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/table.py
def scroll_to_end(self) -> None:
    """Scrolls to the last row."""
    self.call("scrollToEnd")
scroll_to_row
scroll_to_row(index: int) -> None

Scrolls a row of the shown row model into view.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/table.py
def scroll_to_row(self, index: int) -> None:
    """Scrolls a row of the shown row model into view."""
    self.call("scrollToRow", index)
open_config
open_config(open: bool = True) -> None

Shows, or hides, the column configuration panel.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/table.py
def open_config(self, open: bool = True) -> None:
    """Shows, or hides, the column configuration panel."""
    self.call("openConfig", open)

tabs

Tabs: a tab list and the content panes it switches.

Classes:

  • Tabs –

    Tabbed panes; model binds the active tab to a state variable.

  • TabsList –

    The row of tab triggers.

  • TabsTrigger –

    The tab selecting value.

  • TabsContent –

    The pane shown while value is the active tab.

Tabs

Tabs(children: object = None, *, model: str | None = None, value: Prop[str] = None, default_value: Prop[str] = None, on_value_change: Event = None, orientation: Prop[Orientation] = None, activation_mode: Prop[ActivationMode] = None, **kwargs: Unpack[Shared])

Bases: Element

Tabbed panes; model binds the active tab to a state variable.

Parameters:

  • children (object, default: None ) –

    The tab list and the panes.

  • model (str | None, default: None ) –

    A state variable to bind the active tab to, unless on_value_change is given.

  • value (Prop[str], default: None ) –

    The active tab's value.

  • default_value (Prop[str], default: None ) –

    The active tab at mount while value is unset.

  • on_value_change (Event, default: None ) –

    Receives the newly active tab's value.

  • orientation (Prop[Orientation], default: None ) –

    The direction the tab list runs.

  • activation_mode (Prop[ActivationMode], default: None ) –

    Whether an arrow key activates a tab or only focuses it.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tabs.py
def __init__(
    self,
    children: object = None,
    *,
    model: str | None = None,
    value: Prop[str] = None,
    default_value: Prop[str] = None,
    on_value_change: Event = None,
    orientation: Prop[Orientation] = None,
    activation_mode: Prop[ActivationMode] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the tabs; a prop left None keeps the component's default.

    Args:
        children: The tab list and the panes.
        model: A state variable to bind the active tab to, unless `on_value_change` is given.
        value: The active tab's value.
        default_value: The active tab at mount while `value` is unset.
        on_value_change: Receives the newly active tab's value.
        orientation: The direction the tab list runs.
        activation_mode: Whether an arrow key activates a tab or only focuses it.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-tabs", locals(), children, **kwargs)

TabsList

TabsList(children: object = None, *, variant: Prop[TabsListVariant] = None, loop: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The row of tab triggers.

Parameters:

  • children (object, default: None ) –

    The tab triggers.

  • variant (Prop[TabsListVariant], default: None ) –

    The list's style.

  • loop (Prop[bool], default: None ) –

    Whether keyboard navigation wraps from the last tab to the first.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tabs.py
def __init__(self, children: object = None, *, variant: Prop[TabsListVariant] = None, loop: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the tab list; a prop left None keeps the component's default.

    Args:
        children: The tab triggers.
        variant: The list's style.
        loop: Whether keyboard navigation wraps from the last tab to the first.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tabs-list", locals(), children, **kwargs)

TabsTrigger

TabsTrigger(children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The tab selecting value.

Parameters:

  • children (object, default: None ) –

    The tab's label.

  • value (Prop[str], default: None ) –

    The value the tab activates.

  • disabled (Prop[bool], default: None ) –

    Disables the tab.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tabs.py
def __init__(self, children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the tab; a prop left None keeps the component's default.

    Args:
        children: The tab's label.
        value: The value the tab activates.
        disabled: Disables the tab.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tabs-trigger", locals(), children, **kwargs)

TabsContent

TabsContent(children: object = None, *, value: Prop[str] = None, force_mount: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The pane shown while value is the active tab.

Parameters:

  • children (object, default: None ) –

    The pane's content.

  • value (Prop[str], default: None ) –

    The tab value the pane shows for.

  • force_mount (Prop[bool], default: None ) –

    Keeps the pane mounted while another tab is active.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tabs.py
def __init__(self, children: object = None, *, value: Prop[str] = None, force_mount: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the pane; a prop left None keeps the component's default.

    Args:
        children: The pane's content.
        value: The tab value the pane shows for.
        force_mount: Keeps the pane mounted while another tab is active.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tabs-content", locals(), children, **kwargs)

term

The terminal: an xterm fed from the server.

Classes:

  • Term –

    An xterm whose options are read at mount; on_data carries typed text, on_resize the new size.

Term

Term(*, options: Prop[Mapping[str, object]] = None, on_data: Event = None, on_resize: Event = None, **kwargs: Unpack[Shared])

Bases: Element

An xterm whose options are read at mount; on_data carries typed text, on_resize the new size.

Parameters:

  • options (Prop[Mapping[str, object]], default: None ) –

    xterm options, read once at mount.

  • on_data (Event, default: None ) –

    Receives the text the user types.

  • on_resize (Event, default: None ) –

    Receives the terminal's new size in columns and rows.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Methods:

  • write –

    Writes text to the terminal.

  • clear –

    Clears the terminal.

  • fit –

    Fits the grid to the host's size.

  • scroll_to_bottom –

    Scrolls to the newest line.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/term.py
def __init__(self, *, options: Prop[Mapping[str, object]] = None, on_data: Event = None, on_resize: Event = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the terminal; a prop left None keeps the component's default.

    Args:
        options: xterm options, read once at mount.
        on_data: Receives the text the user types.
        on_resize: Receives the terminal's new size in columns and rows.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    kwargs.setdefault("ref", next_ref(KIND))
    super().__init__("ff-term", locals(), None, **kwargs)
write
write(text: str) -> None

Writes text to the terminal.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/term.py
def write(self, text: str) -> None:
    """Writes `text` to the terminal."""
    self.call("write", text)
clear
clear() -> None

Clears the terminal.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/term.py
def clear(self) -> None:
    """Clears the terminal."""
    self.call("clear")
fit
fit() -> None

Fits the grid to the host's size.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/term.py
def fit(self) -> None:
    """Fits the grid to the host's size."""
    self.call("fit")
scroll_to_bottom
scroll_to_bottom() -> None

Scrolls to the newest line.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/term.py
def scroll_to_bottom(self) -> None:
    """Scrolls to the newest line."""
    self.call("scrollToBottom")

tip

The tooltip a single child carries.

Classes:

  • Tip –

    Gives its one child a tooltip that opens on hover and on keyboard focus; empty content renders the child alone.

Tip

Tip(children: object = None, *, content: Prop[str] = None, side: Prop[Side] = None, definition: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

Gives its one child a tooltip that opens on hover and on keyboard focus; empty content renders the child alone.

Parameters:

  • children (object, default: None ) –

    The one element the tooltip describes.

  • content (Prop[str], default: None ) –

    The tooltip's text: what the element does or what the screen does not show.

  • side (Prop[Side], default: None ) –

    The side of the element the tooltip opens on.

  • definition (Prop[bool], default: None ) –

    Whether the content explains a value, which marks it with the accent edge, rather than naming what a control does.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tip.py
def __init__(self, children: object = None, *, content: Prop[str] = None, side: Prop[Side] = None, definition: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the tooltip; a prop left None keeps the component's default.

    Args:
        children: The one element the tooltip describes.
        content: The tooltip's text: what the element does or what the screen does not show.
        side: The side of the element the tooltip opens on.
        definition: Whether the content explains a value, which marks it with the accent edge, rather than naming what a control does.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tip", locals(), children, **kwargs)

toggle

Toggles: a pressed button and a group of them choosing one or many values.

Classes:

  • Toggle –

    A button that stays pressed; model binds the pressed state to a state variable.

  • ToggleGroup –

    Toggle items choosing one value (type_ single) or a list of them; model binds the choice to a state variable.

  • ToggleGroupItem –

    One item of a toggle group.

Toggle

Toggle(children: object = None, *, model: str | None = None, pressed: Prop[bool] = None, default_pressed: Prop[bool] = None, on_pressed_change: Event = None, variant: Prop[ToggleVariant] = None, size: Prop[ToggleSize] = None, disabled: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A button that stays pressed; model binds the pressed state to a state variable.

Parameters:

  • children (object, default: None ) –

    The toggle's label or icon.

  • model (str | None, default: None ) –

    A state variable to bind the pressed state to, unless on_pressed_change is given.

  • pressed (Prop[bool], default: None ) –

    Whether the toggle is pressed.

  • default_pressed (Prop[bool], default: None ) –

    Whether the toggle is pressed at mount while pressed is unset.

  • on_pressed_change (Event, default: None ) –

    Receives the new pressed state.

  • variant (Prop[ToggleVariant], default: None ) –

    The toggle's style.

  • size (Prop[ToggleSize], default: None ) –

    The toggle's size.

  • disabled (Prop[bool], default: None ) –

    Disables the toggle.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/toggle.py
def __init__(
    self,
    children: object = None,
    *,
    model: str | None = None,
    pressed: Prop[bool] = None,
    default_pressed: Prop[bool] = None,
    on_pressed_change: Event = None,
    variant: Prop[ToggleVariant] = None,
    size: Prop[ToggleSize] = None,
    disabled: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the toggle; a prop left None keeps the component's default.

    Args:
        children: The toggle's label or icon.
        model: A state variable to bind the pressed state to, unless `on_pressed_change` is given.
        pressed: Whether the toggle is pressed.
        default_pressed: Whether the toggle is pressed at mount while `pressed` is unset.
        on_pressed_change: Receives the new pressed state.
        variant: The toggle's style.
        size: The toggle's size.
        disabled: Disables the toggle.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_pressed_change is None:
        pressed = react.Bind(model)
        on_pressed_change = setter(model)

    super().__init__("ff-toggle", locals(), children, **kwargs)

ToggleGroup

ToggleGroup(children: object = None, *, model: str | None = None, type_: Prop[ToggleType] = None, value: Prop[str | Sequence[str]] = None, default_value: Prop[str | Sequence[str]] = None, on_value_change: Event = None, variant: Prop[ToggleVariant] = None, size: Prop[ToggleSize] = None, orientation: Prop[Orientation] = None, disabled: Prop[bool] = None, spacing: Prop[float] = None, aria_label: Prop[str] = None, **kwargs: Unpack[Shared])

Bases: Element

Toggle items choosing one value (type_ single) or a list of them; model binds the choice to a state variable.

Parameters:

  • children (object, default: None ) –

    The group's items.

  • model (str | None, default: None ) –

    A state variable to bind the choice to, unless on_value_change is given.

  • type_ (Prop[ToggleType], default: None ) –

    Whether one item or several can be pressed.

  • value (Prop[str | Sequence[str]], default: None ) –

    The pressed item's value, or the values of a multiple group.

  • default_value (Prop[str | Sequence[str]], default: None ) –

    The choice at mount while value is unset.

  • on_value_change (Event, default: None ) –

    Receives the new choice.

  • variant (Prop[ToggleVariant], default: None ) –

    The items' style.

  • size (Prop[ToggleSize], default: None ) –

    The items' size.

  • orientation (Prop[Orientation], default: None ) –

    The direction the items run.

  • disabled (Prop[bool], default: None ) –

    Disables every item.

  • spacing (Prop[float], default: None ) –

    The gap between items in Tailwind spacing units; 0 joins them.

  • aria_label (Prop[str], default: None ) –

    The accessible name of the group.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/toggle.py
def __init__(
    self,
    children: object = None,
    *,
    model: str | None = None,
    type_: Prop[ToggleType] = None,
    value: Prop[str | Sequence[str]] = None,
    default_value: Prop[str | Sequence[str]] = None,
    on_value_change: Event = None,
    variant: Prop[ToggleVariant] = None,
    size: Prop[ToggleSize] = None,
    orientation: Prop[Orientation] = None,
    disabled: Prop[bool] = None,
    spacing: Prop[float] = None,
    aria_label: Prop[str] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the group; a prop left None keeps the component's default.

    Args:
        children: The group's items.
        model: A state variable to bind the choice to, unless `on_value_change` is given.
        type_: Whether one item or several can be pressed.
        value: The pressed item's value, or the values of a multiple group.
        default_value: The choice at mount while `value` is unset.
        on_value_change: Receives the new choice.
        variant: The items' style.
        size: The items' size.
        orientation: The direction the items run.
        disabled: Disables every item.
        spacing: The gap between items in Tailwind spacing units; 0 joins them.
        aria_label: The accessible name of the group.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-toggle-group", locals(), children, **kwargs)

ToggleGroupItem

ToggleGroupItem(children: object = None, *, value: Prop[str] = None, disabled: Prop[bool] = None, variant: Prop[ToggleVariant] = None, size: Prop[ToggleSize] = None, **kwargs: Unpack[Shared])

Bases: Element

One item of a toggle group.

Parameters:

  • children (object, default: None ) –

    The item's label or icon.

  • value (Prop[str], default: None ) –

    The value the item stands for.

  • disabled (Prop[bool], default: None ) –

    Disables the item.

  • variant (Prop[ToggleVariant], default: None ) –

    The item's style, over the group's.

  • size (Prop[ToggleSize], default: None ) –

    The item's size, over the group's.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/toggle.py
def __init__(
    self,
    children: object = None,
    *,
    value: Prop[str] = None,
    disabled: Prop[bool] = None,
    variant: Prop[ToggleVariant] = None,
    size: Prop[ToggleSize] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the item; a prop left None keeps the component's default.

    Args:
        children: The item's label or icon.
        value: The value the item stands for.
        disabled: Disables the item.
        variant: The item's style, over the group's.
        size: The item's size, over the group's.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-toggle-group-item", locals(), children, **kwargs)

tooltip

Tooltips: a provider, a tooltip and its trigger and content.

Classes:

  • TooltipProvider –

    Shares the open delay across the tooltips inside it.

  • Tooltip –

    A tooltip around its trigger.

  • TooltipTrigger –

    The element the tooltip describes; as_child renders the child element itself.

  • TooltipContent –

    The tooltip's bubble.

TooltipProvider

TooltipProvider(children: object = None, *, delay_duration: Prop[float] = None, skip_delay_duration: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

Shares the open delay across the tooltips inside it.

Parameters:

  • children (object, default: None ) –

    The tooltips that share the delay.

  • delay_duration (Prop[float], default: None ) –

    How long the pointer rests on a trigger before its tooltip opens, in milliseconds.

  • skip_delay_duration (Prop[float], default: None ) –

    How soon after a tooltip closes another opens without the delay, in milliseconds.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tooltip.py
def __init__(self, children: object = None, *, delay_duration: Prop[float] = None, skip_delay_duration: Prop[float] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the provider; a prop left None keeps the component's default.

    Args:
        children: The tooltips that share the delay.
        delay_duration: How long the pointer rests on a trigger before its tooltip opens, in milliseconds.
        skip_delay_duration: How soon after a tooltip closes another opens without the delay, in milliseconds.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tooltip-provider", locals(), children, **kwargs)

Tooltip

Tooltip(children: object = None, *, open_: Prop[bool] = None, default_open: Prop[bool] = None, on_open_change: Event = None, delay_duration: Prop[float] = None, disable_hoverable_content: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

A tooltip around its trigger.

Parameters:

  • children (object, default: None ) –

    The trigger and the content.

  • open_ (Prop[bool], default: None ) –

    Whether the tooltip is open.

  • default_open (Prop[bool], default: None ) –

    Whether the tooltip opens at mount while open_ is unset.

  • on_open_change (Event, default: None ) –

    Receives the new open state.

  • delay_duration (Prop[float], default: None ) –

    The open delay in milliseconds, over the provider's.

  • disable_hoverable_content (Prop[bool], default: None ) –

    Closes the tooltip once the pointer leaves the trigger, even for the content.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tooltip.py
def __init__(
    self,
    children: object = None,
    *,
    open_: Prop[bool] = None,
    default_open: Prop[bool] = None,
    on_open_change: Event = None,
    delay_duration: Prop[float] = None,
    disable_hoverable_content: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the tooltip; a prop left None keeps the component's default.

    Args:
        children: The trigger and the content.
        open_: Whether the tooltip is open.
        default_open: Whether the tooltip opens at mount while `open_` is unset.
        on_open_change: Receives the new open state.
        delay_duration: The open delay in milliseconds, over the provider's.
        disable_hoverable_content: Closes the tooltip once the pointer leaves the trigger, even for the content.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tooltip", locals(), children, **kwargs)

TooltipTrigger

TooltipTrigger(children: object = None, *, as_child: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

The element the tooltip describes; as_child renders the child element itself.

Parameters:

  • children (object, default: None ) –

    The element the tooltip describes.

  • as_child (Prop[bool], default: None ) –

    Renders the child element itself as the trigger.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tooltip.py
def __init__(self, children: object = None, *, as_child: Prop[bool] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the trigger; a prop left None keeps the component's default.

    Args:
        children: The element the tooltip describes.
        as_child: Renders the child element itself as the trigger.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tooltip-trigger", locals(), children, **kwargs)

TooltipContent

TooltipContent(children: object = None, *, side: Prop[Side] = None, align: Prop[Align] = None, side_offset: Prop[float] = None, **kwargs: Unpack[Shared])

Bases: Element

The tooltip's bubble.

Parameters:

  • children (object, default: None ) –

    The tooltip's text.

  • side (Prop[Side], default: None ) –

    The side of the trigger the bubble opens on.

  • align (Prop[Align], default: None ) –

    How the bubble aligns against the trigger.

  • side_offset (Prop[float], default: None ) –

    The gap between the trigger and the bubble, in pixels.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tooltip.py
def __init__(self, children: object = None, *, side: Prop[Side] = None, align: Prop[Align] = None, side_offset: Prop[float] = None, **kwargs: Unpack[Shared]) -> None:
    """Creates the bubble; a prop left None keeps the component's default.

    Args:
        children: The tooltip's text.
        side: The side of the trigger the bubble opens on.
        align: How the bubble aligns against the trigger.
        side_offset: The gap between the trigger and the bubble, in pixels.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    super().__init__("ff-tooltip-content", locals(), children, **kwargs)

tour

The guided tour: a spotlight and a card stepping over elements of the live app.

Classes:

  • TourStep –

    One stop: the CSS selector of the element to highlight, the card's title and body, and its preferred side.

  • Tour –

    A guided tour: a spotlight and a card over each step's target; model binds the open flag to a state variable.

TourStep

Bases: TypedDict

One stop: the CSS selector of the element to highlight, the card's title and body, and its preferred side.

Tour

Tour(children: object = None, *, model: str | None = None, steps: Prop[Sequence[TourStep]] = None, open_: Prop[bool] = None, on_open_change: Event = None, step: Prop[int] = None, on_step_change: Event = None, on_finish: Event = None, **kwargs: Unpack[Shared])

Bases: Element

A guided tour: a spotlight and a card over each step's target; model binds the open flag to a state variable.

Parameters:

  • children (object, default: None ) –

    Unused; the tour renders only its spotlight and card.

  • model (str | None, default: None ) –

    A state variable to bind the open flag to, unless on_open_change is given.

  • steps (Prop[Sequence[TourStep]], default: None ) –

    The stops in order; a stop whose target is not mounted is skipped.

  • open_ (Prop[bool], default: None ) –

    Whether the tour is showing.

  • on_open_change (Event, default: None ) –

    Receives False when the tour closes itself.

  • step (Prop[int], default: None ) –

    The current stop's index among the mounted ones; the tour keeps its own while unset.

  • on_step_change (Event, default: None ) –

    Receives the new stop index.

  • on_finish (Event, default: None ) –

    Receives "done" from the last stop's Done, or "skipped" from Skip Tour and Escape.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tour.py
def __init__(
    self,
    children: object = None,
    *,
    model: str | None = None,
    steps: Prop[Sequence[TourStep]] = None,
    open_: Prop[bool] = None,
    on_open_change: Event = None,
    step: Prop[int] = None,
    on_step_change: Event = None,
    on_finish: Event = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the tour; a prop left None keeps the component's default.

    Args:
        children: Unused; the tour renders only its spotlight and card.
        model: A state variable to bind the open flag to, unless `on_open_change` is given.
        steps: The stops in order; a stop whose target is not mounted is skipped.
        open_: Whether the tour is showing.
        on_open_change: Receives False when the tour closes itself.
        step: The current stop's index among the mounted ones; the tour keeps its own while unset.
        on_step_change: Receives the new stop index.
        on_finish: Receives `"done"` from the last stop's Done, or `"skipped"` from Skip Tour and Escape.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_open_change is None:
        open_ = react.Bind(model)
        on_open_change = setter(model)

    super().__init__("ff-tour", locals(), children, **kwargs)

tree

The tree: collapsible items with leaf checkboxes.

Classes:

  • TreeItem –

    One node: its id, title and children.

  • Tree –

    Nested items whose leaves can be checked; model binds the checked ids to a state variable.

TreeItem

Bases: TypedDict

One node: its id, title and children.

Tree

Tree(*, model: str | None = None, items: Prop[Sequence[TreeItem]] = None, value: Prop[Sequence[str]] = None, on_value_change: Event = None, selectable: Prop[TreeSelectable] = None, open_all: Prop[bool] = None, **kwargs: Unpack[Shared])

Bases: Element

Nested items whose leaves can be checked; model binds the checked ids to a state variable.

Parameters:

  • model (str | None, default: None ) –

    A state variable to bind the checked ids to, unless on_value_change is given.

  • items (Prop[Sequence[TreeItem]], default: None ) –

    The root nodes.

  • value (Prop[Sequence[str]], default: None ) –

    The ids of the checked leaves.

  • on_value_change (Event, default: None ) –

    Receives the checked ids.

  • selectable (Prop[TreeSelectable], default: None ) –

    Whether the leaves carry checkboxes.

  • open_all (Prop[bool], default: None ) –

    Opens every node at mount.

  • kwargs (Unpack[Shared], default: {} ) –

    Shared trame props and events, such as classes, style and on_click.

Source code in packages/femforge-workbench/src/femforge_workbench/widgets/tree.py
def __init__(
    self,
    *,
    model: str | None = None,
    items: Prop[Sequence[TreeItem]] = None,
    value: Prop[Sequence[str]] = None,
    on_value_change: Event = None,
    selectable: Prop[TreeSelectable] = None,
    open_all: Prop[bool] = None,
    **kwargs: Unpack[Shared],
) -> None:
    """Creates the tree; a prop left None keeps the component's default.

    Args:
        model: A state variable to bind the checked ids to, unless `on_value_change` is given.
        items: The root nodes.
        value: The ids of the checked leaves.
        on_value_change: Receives the checked ids.
        selectable: Whether the leaves carry checkboxes.
        open_all: Opens every node at mount.
        kwargs: Shared trame props and events, such as `classes`, `style` and `on_click`.
    """
    if model is not None and on_value_change is None:
        value = react.Bind(model)
        on_value_change = setter(model)

    super().__init__("ff-tree", locals(), None, **kwargs)