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

Adding documentation to details component #644

Merged
merged 4 commits into from
Jun 6, 2024
Merged
Show file tree
Hide file tree
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
35 changes: 35 additions & 0 deletions solara/components/details.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,41 @@

@solara.component
def Details(summary="Summary", children=[], expand=False):
"""Creates an expandable/collapsible section with a summary and additional children content

```solara
import solara

mikegiann01 marked this conversation as resolved.
Show resolved Hide resolved

show_message = solara.reactive(True)
disable = solara.reactive(False)


@solara.component
def Page():
summary_text = "Click to expand for more details"
additional_content = [
"Additional detail 1",
"Additional detail 2",
"Additional detail 3"
]

solara.Details(
summary=summary_text,
children=additional_content,
expand=False
)

```


## Arguments:

* summary: String showing the summary text for the expandable section: Defaults "Summary"
* children: List showing the children content of the expandable section: Defaults to an Empty list
* expand: Boolean showing if the section is expanded or collapsed: Defaults to False
"""

expand, set_expand = solara.use_state_or_update(expand)

def on_v_model(v_model):
Expand Down
13 changes: 13 additions & 0 deletions solara/website/pages/documentation/components/layout/details.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
"""
# Details
"""

import solara
from solara.website.components import NoPage
from solara.website.utils import apidoc

title = "Details"

Page = NoPage

__doc__ += apidoc(solara.Details.f) # type: ignore
Loading