Skip to content

Add Examples class #594

Description

@pplonski

Add a mr.Examples component for loading predefined widget values.

API

mr.Examples(
    examples={
        "Young customer": {
            "age": 25,
            "country": "Poland",
        },
        "Enterprise customer": {
            "age": 45,
            "country": "Germany",
        },
    }
)

Dictionary keys should match existing Mercury widget key or url_key.

Behavior

Show available examples in the app:

Examples

[ Young customer ]
[ Enterprise customer ]

When an example is clicked:

  1. Find widgets by key, then url_key.
  2. Set all provided widget values.
  3. Trigger notebook execution once after all values are updated.

Missing widget keys should produce a warning.

V1 scope

  • predefined examples only
  • explicit widget values
  • no automatic widget discovery
  • no saving/editing examples from the UI
  • no outputs or scenario management

Goal: let users quickly populate an app with meaningful example inputs.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions