Skip to content

The fastest, litest AI Gateway. Rust core with Python SDK. Call 100+ LLM APIs in OpenAI (or native) format with cost tracking, guardrails, load balancing, and logging [Bedrock, Azure, OpenAI, Anthropic, OpenAI, VertexAI, vLLM, Nvidia NIM]

feat(ui): left-anchor the Create Key and Create Team CTAs (#33248)

yuneng-jiang2166608eb862
diff --git a/ui/litellm-dashboard/src/components/Teams.test.tsx b/ui/litellm-dashboard/src/components/Teams.test.tsx
index f885b582dd2..7065b1a5fb6 100644
--- a/ui/litellm-dashboard/src/components/Teams.test.tsx
+++ b/ui/litellm-dashboard/src/components/Teams.test.tsx
@@ -436,6 +436,33 @@ describe("Teams - premium props", () => {
});
});
+describe("Teams - Create Team CTA is grouped with the tabs on the left", () => {
+ beforeEach(() => {
+ vi.clearAllMocks();
+ mockUseOrganizations.mockReturnValue({ data: [] });
+ });
+
+ it("renders the Create Team button inside the tab bar, ahead of the tabs", () => {
+ const { container } = renderWithQueryClient(<Teams accessToken="test-token" userID="user-123" userRole="Admin" />);
+
+ const createButton = screen.getByTestId("create-team-button");
+ const tabNav = container.querySelector(".ant-tabs-nav");
+
+ // The CTA lives in the tab bar's left slot, not the standalone page header.
+ expect(tabNav).not.toBeNull();
+ expect(tabNav!.contains(createButton)).toBe(true);
+
+ // It reads as the left end of the cluster: it precedes the first tab in DOM order.
+ const firstTab = screen.getByRole("tab", { name: "Your Teams" });
+ expect(createButton.compareDocumentPosition(firstTab) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ });
+
+ it("omits the Create Team CTA for a role that cannot manage teams", () => {
+ renderWithQueryClient(<Teams accessToken="test-token" userID="user-123" userRole="Admin Viewer" />);
+ expect(screen.queryByTestId("create-team-button")).not.toBeInTheDocument();
+ });
+});
+
describe("Teams - Default Team Settings tab visibility", () => {
beforeEach(() => {
vi.clearAllMocks();
diff --git a/ui/litellm-dashboard/src/components/Teams.tsx b/ui/litellm-dashboard/src/components/Teams.tsx
index 57a5e1cbff0..2627f2c1d7f 100644
--- a/ui/litellm-dashboard/src/components/Teams.tsx
+++ b/ui/litellm-dashboard/src/components/Teams.tsx
@@ -564,18 +564,23 @@ const Teams: React.FC<TeamProps> = ({ accessToken, userID, userRole, premiumUser
icon={<Users className="size-5" />}
title="Teams"
subtitle="Manage teams, members, and their access to models and budgets"
- actions={
- canCreateOrManageTeams(userRole, userID, organizations) ? (
+ />
+ </div>
+
+ <Tabs
+ items={tabItems}
+ tabBarExtraContent={{
+ left: canCreateOrManageTeams(userRole, userID, organizations) ? (
+ <div className="flex items-center gap-4 pr-4">
<UIButton onClick={() => setIsTeamModalVisible(true)} data-testid="create-team-button">
<Plus className="size-4" />
Create Team
</UIButton>
- ) : undefined
- }
- />
- </div>
-
- <Tabs items={tabItems} />
+ <div className="h-6 w-px bg-gray-200" />
+ </div>
+ ) : undefined,
+ }}
+ />
</>
)}
diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx
index dd08fe00656..513054aae7a 100644
--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx
+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.test.tsx
@@ -174,10 +174,19 @@ it("should render VirtualKeysTable component", () => {
expect(screen.getByText("Test Key Alias")).toBeInTheDocument();
});
-it("renders the page header with the create-key action slot", () => {
+it("left-anchors the create-key CTA below the title, between the header and the table toolbar", () => {
renderWithProviders(<VirtualKeysTable headerActions={<button>Create New Key</button>} />);
- expect(screen.getByRole("heading", { name: "Virtual Keys" })).toBeInTheDocument();
- expect(screen.getByRole("button", { name: "Create New Key" })).toBeInTheDocument();
+
+ const heading = screen.getByRole("heading", { name: "Virtual Keys" });
+ const ctas = screen.getAllByRole("button", { name: "Create New Key" });
+ expect(ctas).toHaveLength(1);
+ const cta = ctas[0];
+ const search = screen.getByPlaceholderText(/Search by key alias/);
+
+ // The CTA follows the title row...
+ expect(heading.compareDocumentPosition(cta) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
+ // ...and precedes the table's search toolbar, so it sits in its own row above the table.
+ expect(cta.compareDocumentPosition(search) & Node.DOCUMENT_POSITION_FOLLOWING).toBeTruthy();
});
it("should display key information correctly", async () => {
diff --git a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx
index 112b6cbcba4..fe929dc0179 100644
--- a/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx
+++ b/ui/litellm-dashboard/src/components/VirtualKeysPage/VirtualKeysTable.tsx
@@ -162,8 +162,8 @@ export function VirtualKeysTable({ headerActions }: VirtualKeysTableProps) {
icon={<KeyRound className="size-5" />}
title="Virtual Keys"
subtitle="Every key that authenticates requests to the gateway."
- actions={headerActions}
/>
+ {headerActions}
<DataTable
data={keyList}
columns={columns}