Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: give examples for component_vue #844

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions solara/components/component_vue.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,29 @@ def component_vue(vue_path: str, vuetify=True) -> Callable[[Callable[P, None]],

See the [Vue component example](/documentation/examples/general/vue_component) for an example of how to use this decorator.


## Examples

A component that takes a `foo` argument and an `on_foo` callback that gets called when `foo` changes (from the frontend).

```python
import solara

@solara.component_vue("my_foo_component.vue")
def MyFooComponent(foo: int, on_foo: Callable[[int], None]):
pass
```

The following component only takes in a month argument and an event_date_clicked callback that gets called from
the vue template using `this.date_clicked({'extra-data': 42, 'day': this.day})`.
```python
import solara

@solara.component_vue("my_date_component.vue")
def MyDateComponent(month: int, event_date_clicked: Callable):
pass
```

## Arguments

* `vue_path`: The path to the Vue template file.
Expand Down
Loading