Py.Cafe

maartenbreddels/

solara-scroll-target-example

Scroll to Target Example

DocsPricing
  • app.py
  • requirements.txt
app.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
# check out https://solara.dev/ for documentation
# or https://github.com/widgetti/solara/
# And check out https://py.cafe/maartenbreddels for more examples
import solara


@solara.component
def Page():
    solara.Markdown("""
# Scroll to target
Click on a link and you should scoll to the target element
    """)
    with solara.Row():
        for i in range(30):
            with solara.v.Html(tag="a", attributes={"href": f"#foo-{i}"}):
                solara.Text(f"link-{i}")
    for i in range(30):
        with solara.Column():
            with solara.v.Html(tag="a", attributes={"id": f"foo-{i}"}):
                solara.Success(f"Number {i}")