To add some space before the <FwTabs> component, you can simply add a margin-top style to the wrapping div or a spacer element before the tabs. Here's an updated snippet showing adding marginTop to the div wrapping the tabs:
I added marginTop: 20 to the outer div that contains the tabs, which will create space above the tabs. Adjust the 20 value as needed to get the desired spacing.
Alternatively, if you want a spacer element explicitly, you could add:
<FwPopover sameWidth="false" placement="bottom-start">
<FwButton slot="popover-trigger" color="secondary" showCaretIcon>
<FwIcon slot="before-label" name={ruleViewFilter.graphicsProps.name}></FwIcon>
<span>{ruleViewFilter.text}</span>
</FwButton>
<div slot="popover-content" style={{ width: 220 }}>
<span
style={{ fontStyle: "italic" }}
className="row fw-flex fw-type-xs fw-p-4 fw-type-semibold"
>
Select Rule View
</span>
<hr style={{ margin: "0px" }} />
<FwListOptions
onFwChange={(event) => {
const selected = event.detail?.meta?.selectedOptions[0];
if (selected) {
setRuleViewFilter(selected);
// Reset pagination to first page when filter changes
setCurrentPage((prev) => ({ ...prev, [activeTab]: 1 }));
if (selected.value === "all_rules") {
// Clear duplicate groups so all are visible
setTicketCreationRuleGroups([]);
setTicketUpdateRuleGroups([]);
setHourlyRuleGroups([]);
} else if (selected.value === "duplicate_rules") {
// Call handleFilterApiClick to group duplicates and update groups
handleFilterApiClick();
}
}
}}
selectedOptions={[ruleViewFilter]}
options={ruleViewOptions}
variant="icon"
/>
</div>
</FwPopover>
</div>
);
To achieve the layout where the "All Rules" button is aligned to the left, and the search (your searchInputs) is centered within the container above or near the tabs, you can do the following:
Create a new container div above the tabs that holds two visible elements:
On the left: the All Rules button.
Centered horizontally: the searchInputs.
Use CSS flexbox with appropriate alignments:
The container is display: flex; justify-content: space-between; align-items: center;
But since you want the search centered (not pushed to the right) and the button left-aligned, a common pattern is using an extra flex spacer to push the search input to absolute center.
Here's a step-by-step approach:
1. Create a new container wrapping the button and searchInputs:
jsx
<div
style={{
display: "flex",
alignItems: "center",
marginBottom: 10,
marginLeft: 20,
marginRight: 20,
width: "100%",
gap: "20px",
position: "relative",
}}
>
{/* Left: All Rules Button */}
<FwButton
color="secondary"
onFwClick={() => {
setRuleViewFilter({ value: "all_rules", text: "All Rules", graphicsProps: { name: "file-tray-full" } });
// Reset pagination or other related states here if needed
setCurrentPage((prev) => ({ ...prev, [activeTab]: 1 }));
// Clear groups since showing all rules
setTicketCreationRuleGroups([]);
setTicketUpdateRuleGroups([]);
setHourlyRuleGroups([]);
}}
>
All Rules
</FwButton>
{/* Centered Search Inputs wrapper */}
<div
style={{
position: "absolute",
left: "50%",
transform: "translateX(-50%)",
minWidth: "300px", // optionally, min width for search bar
maxWidth: "60%", // max width constraint
}}
>
{searchInputs}
</div>
</div>
2. Remove marginLeft etc from your searchInputs styles:
Modify the searchInputs styles to not have marginLeft or margin that breaks centering, e.g.:
jsx
const searchInputs = (
<div
style={{
display: "flex",
justifyContent: "space-between",
marginBottom: 0, // remove extra margin since container already has margin
// remove marginLeft and marginTop here or set to 0 if necessary
maxWidth: "100%",
gap: "20px",
alignItems: "center",
// maybe add width 100% so it fills the container div
width: "100%",
}}
>
<AnimatedSearchInput />
<FwPopover /*... your existing popover code*/ />
</div>
);
3. Use this new combined container above the tabs like so:
The outer flex container holds two elements: the button and a div that absolutely centers the search inputs.
The button stays at the left due to normal flex flow.
The search inputs container is absolutely positioned at 50% from the left and translated back by half its width to be exactly centered over the container.
Since the container position: relative, the absolute positioning is relative to this container, making centering precise without pushing other elements.
This pattern keeps the layout clean and flexible.
If you want the All Rules button and the search input to be on the same horizontal line above the tabs, this will work well.
Let me know if you want the All Rules button somewhere else or have other layout considerations!