Skip to content

Commit

Permalink
Add "gap" property to FlexBox (#6354)
Browse files Browse the repository at this point in the history
  • Loading branch information
OSuwaidi authored Feb 18, 2024
1 parent 313530f commit 0980fa4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 1 deletion.
3 changes: 3 additions & 0 deletions panel/layout/flex.py
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,9 @@ class FlexBox(ListLike, ReactiveHTML):
'space-evenly', 'start', 'end', 'left', 'right'], doc="""
Defines the alignment along the main axis.""")

gap = param.String(default='', doc="""
Defines the spacing between flex items, supporting various units (px, em, rem, %, vw/vh).""")

_template = (Path(__file__).parent / 'flexbox.html').read_text('utf-8')

def __init__(self, *objects, **params):
Expand Down
2 changes: 1 addition & 1 deletion panel/layout/flexbox.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<div id="flexbox" style="display: flex; flex-wrap: ${flex_wrap}; justify-content: ${justify_content}; flex-direction: ${flex_direction}; align-content: ${align_content}; align-items: ${align_items}; height: 100%;">
<div id="flexbox" style="display: flex; flex-wrap: ${flex_wrap}; justify-content: ${justify_content}; flex-direction: ${flex_direction}; align-content: ${align_content}; align-items: ${align_items}; gap: ${gap}; height: 100%;">
{% for obj in objects %}
<div id="flex-item-{{ loop.index0 }}" style="display: contents;">
${objects[{{ loop.index0 }}]}
Expand Down

0 comments on commit 0980fa4

Please sign in to comment.