diff --git a/.changeset/hot-elephants-beam.md b/.changeset/hot-elephants-beam.md
new file mode 100644
index 0000000..7eefffd
--- /dev/null
+++ b/.changeset/hot-elephants-beam.md
@@ -0,0 +1,5 @@
+---
+"@zenml-io/react-component-library": patch
+---
+
+add option to keep sidebar open
diff --git a/.storybook/assets/Appshell.tsx b/.storybook/assets/Appshell.tsx
index 37ff9cf..97b39d5 100644
--- a/.storybook/assets/Appshell.tsx
+++ b/.storybook/assets/Appshell.tsx
@@ -2,7 +2,7 @@ import React, { ReactNode } from "react";
export function AppShell({ children }: { children: ReactNode }) {
return (
-
+
diff --git a/src/components/Sidebar/Sidebar.stories.tsx b/src/components/Sidebar/Sidebar.stories.tsx
index 938e505..9fe0aab 100644
--- a/src/components/Sidebar/Sidebar.stories.tsx
+++ b/src/components/Sidebar/Sidebar.stories.tsx
@@ -10,9 +10,11 @@ import {
SidebarHeaderTitle,
SidebarList
} from "./index";
+import { Button } from "../Button";
import { CPU, CloseButton } from "../../../.storybook/assets/icons";
import { StoryObj } from "@storybook/react";
import { AppShell } from "../../../.storybook/assets/Appshell";
+import { SidebarProvider, useSidebarContext } from "./SidebarContext";
const meta = {
title: "UI/Sidebar",
@@ -22,9 +24,11 @@ const meta = {
},
decorators: [
(Story) => (
-
-
-
+
+
+
+
+
)
],
tags: ["autodocs"]
@@ -39,7 +43,14 @@ export const defaultStory: Story = {
args: {
children: (
<>
-
} title="ZenML Tenant">
+
+
+
+ }
+ title="ZenML Tenant"
+ >
@@ -81,3 +92,16 @@ export const defaultStory: Story = {
)
}
};
+
+function SidebarButton() {
+ const { setIsOpen, isOpen } = useSidebarContext();
+ return (
+
+ );
+}
diff --git a/src/components/Sidebar/Sidebar.tsx b/src/components/Sidebar/Sidebar.tsx
index 158e7d5..b7de5db 100644
--- a/src/components/Sidebar/Sidebar.tsx
+++ b/src/components/Sidebar/Sidebar.tsx
@@ -10,14 +10,17 @@ import React, {
} from "react";
import { Slot } from "@radix-ui/react-slot";
import { cn } from "../../utilities/index";
+import { useSidebarContext } from "./SidebarContext";
export const Sidebar = forwardRef
>(
({ className, children, ...rest }, ref) => {
+ const { isOpen } = useSidebarContext();
+
return (