Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
50 changes: 50 additions & 0 deletions packages/propel/src/separator/separator.stories.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
import type { Meta, StoryObj } from "@storybook/react-vite";
import { Separator } from "./separator";

const meta: Meta<typeof Separator> = {
title: "Components/Separator",
component: Separator,
parameters: {
layout: "centered",
},
tags: ["autodocs"],
};

export default meta;
type Story = StoryObj<typeof Separator>;

export const Default: Story = {
render: () => (
<div className="w-[300px] space-y-4">
<div>Content Above</div>
<Separator />
<div>Content Below</div>
</div>
),
};

export const Vertical: Story = {
render: () => (
<div className="flex h-[100px] items-center space-x-4">
<div>Left Content</div>
<Separator orientation="vertical" />
<div>Right Content</div>
</div>
),
};

export const WithinContainer: Story = {
render: () => (
<div className="w-[300px] rounded-lg border p-6 space-y-4">
<div className="space-y-2">
<h4 className="font-medium leading-none">Section 1</h4>
<p className="text-sm text-muted-foreground">Description for section 1</p>
</div>
<Separator />
<div className="space-y-2">
<h4 className="font-medium leading-none">Section 2</h4>
<p className="text-sm text-muted-foreground">Description for section 2</p>
</div>
</div>
),
};
29 changes: 29 additions & 0 deletions packages/propel/src/separator/separator.tsx
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import * as React from "react";
import { Separator as SeparatorPrimitive } from "@base-ui-components/react/separator";
import { cn } from "../utils";

interface SeparatorProps extends React.ComponentProps<typeof SeparatorPrimitive> {
/**
* The orientation of the separator
* @default "horizontal"
*/
orientation?: "horizontal" | "vertical";
}

const Separator = React.forwardRef<React.ElementRef<typeof SeparatorPrimitive>, SeparatorProps>(
({ orientation = "horizontal", ...props }, ref) => (
<SeparatorPrimitive
ref={ref}
orientation={orientation}
data-slot="separator"
data-orientation={orientation}
{...props}
className={cn("bg-custom-border-200", "shrink-0", orientation === "horizontal" ? "h-px w-full" : "h-full w-px")}
/>
)
);

Separator.displayName = "Separator";

export { Separator };
export type { SeparatorProps };
Loading