Skip to content
Open
Show file tree
Hide file tree
Changes from 28 commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
4557cfb
Initial plan
Copilot Nov 18, 2025
578234a
Add FloatingPanel component for Svelte and React with skeleton-common…
Copilot Nov 18, 2025
ca08cf1
Rewrite React FloatingPanel components to follow skeleton-react conve…
Copilot Nov 18, 2025
27b320d
Add tests for FloatingPanel component and remove Portal dependency fr…
Copilot Nov 18, 2025
7517e73
Add documentation and examples for FloatingPanel component
Copilot Nov 18, 2025
aaa4163
Fix TypeScript errors and formatting issues, add stability beta to docs
Copilot Nov 18, 2025
56ca820
Use ApiReference component, remove defaultOpen from examples, add age…
Copilot Nov 18, 2025
6e8cd3f
Remove agent instructions file
Copilot Nov 18, 2025
03bffaa
Remove provider pattern examples from documentation
Copilot Nov 18, 2025
9f07942
Add restore button, default styles, and fix overflow issues
Copilot Nov 18, 2025
604e0fc
reset styles
Hugos68 Nov 19, 2025
ea6e74f
changeset
Hugos68 Nov 19, 2025
b0dd519
styling and example stuff
Hugos68 Nov 19, 2025
87dea56
fixed anatomy
Hugos68 Nov 19, 2025
8f8c247
remove unused styles
Hugos68 Nov 19, 2025
73cb4da
Style improvements
endigo9740 Nov 19, 2025
5988f9c
add examples
Hugos68 Nov 20, 2025
ce16470
Merge branch 'main' into copilot/featurefloating-panel
Hugos68 Nov 20, 2025
b9d3c5c
Add controlled, anchor position, disable dragging, and direction exam…
Copilot Nov 20, 2025
8b7a16f
Use English text instead of Arabic in direction example
Copilot Nov 20, 2025
f85f502
Use getAnchorPosition instead of defaultPosition with refs in anchor …
Copilot Nov 20, 2025
3ef7147
Remove trigger from controlled example and add disable resizing example
Copilot Nov 20, 2025
fd13633
resize triggers, getAnchorPoint fix
Hugos68 Nov 20, 2025
8b417c4
remove hardcoded size
Hugos68 Nov 20, 2025
ab79bad
label text
Hugos68 Nov 20, 2025
e8f72b6
Adjust header padding
endigo9740 Nov 20, 2025
83b006f
Merge branch 'main' into copilot/featurefloating-panel
Hugos68 Nov 20, 2025
ab8c3da
fix conflict
Hugos68 Nov 20, 2025
c0f9379
Merge branch 'main' into copilot/featurefloating-panel
Hugos68 Nov 20, 2025
174f176
fix order
Hugos68 Nov 20, 2025
91c5892
fix controlled styles
Hugos68 Nov 20, 2025
0cf8ced
cleanup
Hugos68 Nov 20, 2025
fc86d3c
Update size constraints message and improve controlled example layout
Copilot Nov 20, 2025
977769e
format
Hugos68 Nov 20, 2025
b0adac4
fix
Hugos68 Nov 20, 2025
bc5bae1
fix
Hugos68 Nov 20, 2025
604eef4
add styles for data axis
Hugos68 Nov 20, 2025
0823939
simplify
Hugos68 Nov 20, 2025
f8381b3
simplify
Hugos68 Nov 20, 2025
d6f72b3
fix
Hugos68 Nov 20, 2025
efe5da9
order changes
Hugos68 Nov 20, 2025
9d96207
added axis visualizers
Hugos68 Nov 20, 2025
378cdfc
add todo
Hugos68 Nov 20, 2025
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
8 changes: 8 additions & 0 deletions .changeset/plenty-birds-bet.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
---
"@skeletonlabs/skeleton-common": minor
"@skeletonlabs/skeleton-svelte": minor
"@skeletonlabs/skeleton-react": minor
---

feature: `Floating Panel` component

15 changes: 15 additions & 0 deletions packages/skeleton-common/src/classes/floating-panel.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { defineSkeletonClasses } from '../internal/define-skeleton-classes.js' with { type: 'macro' };

export const classesFloatingPanel = defineSkeletonClasses({
trigger: '',
positioner: '',
content: 'card overflow-hidden shadow-lg border border-surface-300-700',
dragTrigger: '',
header: 'px-4 py-2 grid grid-cols-[1fr_auto] gap-2 items-center bg-surface-200-800 overflow-y-hidden',
title: 'flex justify-start items-center gap-2 whitespace-nowrap',
control: 'flex gap-1',
stageTrigger: 'btn-icon hover:preset-tonal',
closeTrigger: 'btn-icon hover:preset-tonal',
resizeTrigger: '',
body: 'h-full bg-surface-100-900 p-4 overflow-y-auto',
});
1 change: 1 addition & 0 deletions packages/skeleton-common/src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export * from './classes/combobox.js';
export * from './classes/date-picker.js';
export * from './classes/dialog.js';
export * from './classes/file-upload.js';
export * from './classes/floating-panel.js';
export * from './classes/listbox.js';
export * from './classes/menu.js';
export * from './classes/navigation.js';
Expand Down
1 change: 1 addition & 0 deletions packages/skeleton-react/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@
"@zag-js/date-picker": "catalog:",
"@zag-js/dialog": "catalog:",
"@zag-js/file-upload": "catalog:",
"@zag-js/floating-panel": "catalog:",
"@zag-js/listbox": "catalog:",
"@zag-js/menu": "catalog:",
"@zag-js/pagination": "catalog:",
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelBodyProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function Body(props: FloatingPanelBodyProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getBodyProps(),
{
className: classesFloatingPanel.body,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelCloseTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {}

export default function CloseTrigger(props: FloatingPanelCloseTriggerProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getCloseTriggerProps(),
{
className: classesFloatingPanel.closeTrigger,
},
rest,
);

return element ? element(attributes) : <button {...attributes}>{children}</button>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelContentProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function Content(props: FloatingPanelContentProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getContentProps(),
{
className: classesFloatingPanel.content,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelControlProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function Control(props: FloatingPanelControlProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getControlProps(),
{
className: classesFloatingPanel.control,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelDragTriggerProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function DragTrigger(props: FloatingPanelDragTriggerProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getDragTriggerProps(),
{
className: classesFloatingPanel.dragTrigger,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelHeaderProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function Header(props: FloatingPanelHeaderProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getHeaderProps(),
{
className: classesFloatingPanel.header,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelPositionerProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function Positioner(props: FloatingPanelPositionerProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getPositionerProps(),
{
className: classesFloatingPanel.positioner,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { splitResizeTriggerProps, type ResizeTriggerProps } from '@zag-js/floating-panel';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelResizeTriggerProps extends ResizeTriggerProps, PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function ResizeTrigger(props: FloatingPanelResizeTriggerProps) {
const floatingPanel = use(RootContext);

const [resizeTriggerProps, componentProps] = splitResizeTriggerProps(props);
const { element, children, ...rest } = componentProps;

const attributes = mergeProps(
floatingPanel.getResizeTriggerProps(resizeTriggerProps as ResizeTriggerProps),
{
className: classesFloatingPanel.resizeTrigger,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import type { useFloatingPanel } from '../modules/provider.js';
import { RootContext as RootContext_ } from '../modules/root-context.js';
import { type ReactNode, use } from 'react';

export interface FloatingPanelRootContextProps {
children: (floatingPanel: ReturnType<typeof useFloatingPanel>) => ReactNode;
}

export default function RootContext(props: FloatingPanelRootContextProps) {
const floatingPanel = use(RootContext_);

const { children } = props;

return children(floatingPanel);
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
import type { useFloatingPanel } from '../modules/provider.js';
import { RootContext } from '../modules/root-context.js';
import { type PropsWithChildren } from 'react';

export interface FloatingPanelRootProviderProps extends PropsWithChildren {
value: ReturnType<typeof useFloatingPanel>;
}

export default function RootProvider(props: FloatingPanelRootProviderProps) {
const { children, value: floatingPanel } = props;

return <RootContext.Provider value={floatingPanel}>{children}</RootContext.Provider>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
import { useFloatingPanel } from '../modules/provider.js';
import { RootContext } from '../modules/root-context.js';
import { type Props, splitProps } from '@zag-js/floating-panel';
import { type PropsWithChildren } from 'react';

export interface FloatingPanelRootProps extends PropsWithChildren, Omit<Props, 'id'> {}

export default function Root(props: FloatingPanelRootProps) {
const [floatingPanelProps, componentProps] = splitProps(props);
const { children } = componentProps;

const floatingPanel = useFloatingPanel(floatingPanelProps);

return <RootContext.Provider value={floatingPanel}>{children}</RootContext.Provider>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { type StageTriggerProps } from '@zag-js/floating-panel';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelStageTriggerProps extends StageTriggerProps, PropsWithElement<'button'>, HTMLAttributes<'button'> {}

export default function StageTrigger(props: FloatingPanelStageTriggerProps) {
const floatingPanel = use(RootContext);

const { element, children, stage, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getStageTriggerProps({ stage }),
{
className: classesFloatingPanel.stageTrigger,
},
rest,
);

return element ? element(attributes) : <button {...attributes}>{children}</button>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelTitleProps extends PropsWithElement<'div'>, HTMLAttributes<'div'> {}

export default function Title(props: FloatingPanelTitleProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getTitleProps(),
{
className: classesFloatingPanel.title,
},
rest,
);

return element ? element(attributes) : <div {...attributes}>{children}</div>;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
import { RootContext } from '../modules/root-context.js';
import type { HTMLAttributes } from '@/internal/html-attributes.js';
import type { PropsWithElement } from '@/internal/props-with-element.js';
import { classesFloatingPanel } from '@skeletonlabs/skeleton-common';
import { mergeProps } from '@zag-js/react';
import { use } from 'react';

export interface FloatingPanelTriggerProps extends PropsWithElement<'button'>, HTMLAttributes<'button'> {}

export default function Trigger(props: FloatingPanelTriggerProps) {
const floatingPanel = use(RootContext);

const { element, children, ...rest } = props;

const attributes = mergeProps(
floatingPanel.getTriggerProps(),
{
className: classesFloatingPanel.trigger,
},
rest,
);

return element ? element(attributes) : <button {...attributes}>{children}</button>;
}
16 changes: 16 additions & 0 deletions packages/skeleton-react/src/components/floating-panel/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
export type { FloatingPanelBodyProps } from './anatomy/body.jsx';
export type { FloatingPanelCloseTriggerProps } from './anatomy/close-trigger.jsx';
export type { FloatingPanelContentProps } from './anatomy/content.jsx';
export type { FloatingPanelControlProps } from './anatomy/control.jsx';
export type { FloatingPanelDragTriggerProps } from './anatomy/drag-trigger.jsx';
export type { FloatingPanelHeaderProps } from './anatomy/header.jsx';
export type { FloatingPanelPositionerProps } from './anatomy/positioner.jsx';
export type { FloatingPanelResizeTriggerProps } from './anatomy/resize-trigger.jsx';
export type { FloatingPanelRootProps } from './anatomy/root.jsx';
export type { FloatingPanelRootContextProps } from './anatomy/root-context.jsx';
export type { FloatingPanelRootProviderProps } from './anatomy/root-provider.jsx';
export type { FloatingPanelStageTriggerProps } from './anatomy/stage-trigger.jsx';
export type { FloatingPanelTitleProps } from './anatomy/title.jsx';
export type { FloatingPanelTriggerProps } from './anatomy/trigger.jsx';
export { FloatingPanel } from './modules/anatomy.js';
export { useFloatingPanel } from './modules/provider.js';
Loading