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

Allow a Stylekit "card" to be side-by-side with width=fit-content #1780

Open
1 of 6 tasks
arcanaxion opened this issue Sep 12, 2024 · 1 comment
Open
1 of 6 tasks
Labels
🖰 GUI Related to GUI 🆘 Help wanted Open to participation from the community 📈 Improvement Improvement of a feature. 🟨 Priority: Medium Not blocking but should be addressed

Comments

@arcanaxion
Copy link

Description

Cards can have their width match the size of its content with #468, which is great for displaying metrics (among other things).

I'd like to position cards side-by-side, without needing to use a layout and explicitly defining the width of each element there.

Currently, I can use a layout and define the width:

from taipy.gui import Gui, Markdown

page_md_target = Markdown(
"""
<|layout|columns=10em 10em|

<|card|part|width=fit-content|
Metric 1
|>

<|card|part|width=fit-content|
Metric 2
|>

|>
""")

if __name__ == "__main__":
    gui = Gui(page_md_target)
    gui.run(debug=True, run_browser=False, use_reloader=True, dark_mode=False)

Which produces:

image

I want to create this without defining a width anywhere.

Solution Proposed

Maybe allowing a layout column to "fit-content" ("fc") is a possible solution? I don't like the extra nesting especially if I'm only showing 2 cards, but it makes sense and I can also use layout.gap to add space between the cards.

page_md_layout = Markdown(
"""
<|layout|columns=fc fc|

<|card|part|width=fit-content|
Metric 1
|>

<|card|part|width=fit-content|
Metric 2
|>

|>
""")

Impact of Solution

Needs to work with taipy.gui.builder / tgb also.

Additional Context

No response

Acceptance Criteria

  • Ensure new code is unit tested, and check code coverage is at least 90%.
  • Create related issue in taipy-doc for documentation and Release Notes.
  • Check if a new demo could be provided based on this, or if legacy demos could be benefit from it.
  • Ensure any change is well documented.

Code of Conduct

  • I have checked the existing issues.
  • I am willing to work on this issue (optional)
@arcanaxion
Copy link
Author

@dinhlongviolin1 Opened a new feature request per #1725. Thanks for taking a look!

@jrobinAV jrobinAV added 📈 Improvement Improvement of a feature. 🖰 GUI Related to GUI 🟨 Priority: Medium Not blocking but should be addressed 🆘 Help wanted Open to participation from the community and removed ✨New feature labels Sep 13, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🖰 GUI Related to GUI 🆘 Help wanted Open to participation from the community 📈 Improvement Improvement of a feature. 🟨 Priority: Medium Not blocking but should be addressed
Projects
None yet
Development

No branches or pull requests

2 participants