diff --git a/packages/docs/src/routes/(inner)/api/floating-arrow/data.ts b/packages/docs/src/routes/(inner)/api/floating-arrow/data.ts
new file mode 100644
index 00000000..a3f4ade1
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/floating-arrow/data.ts
@@ -0,0 +1,67 @@
+// Component: FloatingArrow
+
+import type { TableData } from '$lib/types.js';
+
+// Props
+export const tableProps: TableData[] = [
+ {
+ property: `ref*`,
+ description: `Bound element reference.`,
+ type: `HTMLElement | null`,
+ default: `-`,
+ },
+ {
+ property: `context*`,
+ description: `The context object returned from useFloating().`,
+ type: `FloatingContext`,
+ default: `-`,
+ },
+ {
+ property: `width`,
+ description: `The width of the arrow.`,
+ type: `number`,
+ default: `14`,
+ },
+ {
+ property: `height`,
+ description: `The height of the arrow.`,
+ type: `number`,
+ default: `7`,
+ },
+ {
+ property: `tipRadius`,
+ description: `The radius (rounding) of the arrow tip.`,
+ type: `number`,
+ default: `0 (sharp)`,
+ },
+ {
+ property: `staticOffset`,
+ description: `A static offset override of the arrow from the floating element edge. Often desirable if the floating element is smaller than the reference element along the relevant axis and has an edge alignment (start/end).`,
+ type: `string | number | null`,
+ default: `undefined (use dynamic path)`,
+ },
+ {
+ property: `d`,
+ description: `A custom path for the arrow. Useful if you want fancy rounding. The path should be inside a square SVG and placed at the bottom of it. The path is designed for the 'bottom' placement, which will be rotated for other placements.`,
+ type: `string`,
+ default: `"black" (browser default)`,
+ },
+ {
+ property: `fill`,
+ description: `The color of the arrow.`,
+ type: `string`,
+ default: `xxx`,
+ },
+ {
+ property: `stroke`,
+ description: `The stroke (border) color of the arrow. This must match (or be less than) the floating element’s border width.`,
+ type: `string`,
+ default: `"none"`,
+ },
+ {
+ property: `strokeWidth`,
+ description: `The stroke (border) width of the arrow.`,
+ type: `number`,
+ default: `0`,
+ },
+];
diff --git a/packages/docs/src/routes/(inner)/api/use-click/+page.svelte b/packages/docs/src/routes/(inner)/api/use-click/+page.svelte
new file mode 100644
index 00000000..c5ab613f
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-click/+page.svelte
@@ -0,0 +1,33 @@
+
+
+
+
+
+
useClick
+
Opens or closes the floating element when clicking the reference element.
diff --git a/packages/docs/src/routes/(inner)/api/use-click/data.ts b/packages/docs/src/routes/(inner)/api/use-click/data.ts
new file mode 100644
index 00000000..330a807e
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-click/data.ts
@@ -0,0 +1,38 @@
+import type { TableData } from '$lib/types.js';
+
+// Options
+export const tableOptions: TableData[] = [
+ {
+ property: 'enabled',
+ description: 'Whether the Hook is enabled, including all internal Effects and event handlers.',
+ type: 'boolean',
+ default: 'true',
+ },
+ {
+ property: 'event',
+ description:
+ 'The type of event to use to determine a "click" with mouse input. Keyboard clicks work as normal.',
+ type: '"click" | "mousedown"',
+ default: "'click'",
+ },
+ {
+ property: 'toggle',
+ description: 'Whether to toggle the open state with repeated clicks.',
+ type: 'boolean',
+ default: 'true',
+ },
+ {
+ property: 'ignoreMouse',
+ description:
+ 'Whether to ignore the logic for mouse input (for example, if `useHover()` is also being used). When `useHover()` and `useClick()` are used together, clicking the reference element after hovering it will keep the floating element open even once the cursor leaves. This may not be desirable in some cases.',
+ type: 'boolean',
+ default: 'false',
+ },
+ {
+ property: 'keyboardHandlers',
+ description:
+ 'Whether to add keyboard handlers (Enter and Space key functionality) for non-button elements (to open/close the floating element via keyboard "click").',
+ type: 'boolean',
+ default: 'true',
+ },
+];
diff --git a/packages/docs/src/routes/(inner)/api/use-dismiss/+page.svelte b/packages/docs/src/routes/(inner)/api/use-dismiss/+page.svelte
new file mode 100644
index 00000000..2c100f44
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-dismiss/+page.svelte
@@ -0,0 +1,67 @@
+
+
+
+
+
+
useDismiss
+
+ Closes the floating element when a dismissal is requested — by default, when the user presses
+ the escape key or outside of the floating element with their pointer.
+
+
+
+
+
+
Usage
+
+
+
+
+
Options
+
+
+
+
+
Reacting to dismissal
+
+ To react to the dismissal event, you can check for the reason string in
+ the onOpenChange callback:
+
diff --git a/packages/docs/src/routes/(inner)/api/use-dismiss/data.ts b/packages/docs/src/routes/(inner)/api/use-dismiss/data.ts
new file mode 100644
index 00000000..3baf2a1b
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-dismiss/data.ts
@@ -0,0 +1,61 @@
+// Hook: useDismiss
+
+import type { TableData } from '$lib/types.js';
+
+// Options
+export const tableOptions: TableData[] = [
+ {
+ property: `enabled`,
+ description: `Whether the Hook is enabled, including all internal Effects and event handlers.`,
+ type: `boolean`,
+ default: `true`,
+ },
+ {
+ property: `escapeKey`,
+ description: `Whether to dismiss the floating element upon pressing the \`esc\` key.`,
+ type: `boolean`,
+ default: `true`,
+ },
+ {
+ property: `referencePress`,
+ description: `Whether to dismiss the floating element upon pressing the reference element. You likely want to ensure the \`move\` option in the \`useHover()\` Hook has been disabled when this is in use.`,
+ type: `boolean`,
+ default: `false`,
+ },
+ {
+ property: `referencePressEvent`,
+ description: `The type of event to use to determine a “press”.`,
+ type: `'pointerdown' | 'mousedown' | 'click'`,
+ default: `'pointerdown'`,
+ },
+ {
+ property: `outsidePress`,
+ description: `Whether to dismiss the floating element upon pressing outside of the floating element.`,
+ type: `boolean | ((event: MouseEvent) => boolean)`,
+ default: `true`,
+ },
+ {
+ property: `outsidePressEvent`,
+ description: `The type of event to use to determine an outside “press”.`,
+ type: `'pointerdown' | 'mousedown' | 'click'`,
+ default: `'pointerdown'`,
+ },
+ {
+ property: `ancestorScroll`,
+ description: `Whether to dismiss the floating element upon scrolling an overflow ancestor.`,
+ type: `boolean`,
+ default: `false`,
+ },
+ {
+ property: `bubbles`,
+ description: `Determines whether event listeners bubble upwards through a tree of floating elements.`,
+ type: `boolean | { escapeKey?: boolean; outsidePress?: boolean }`,
+ default: `undefined`,
+ },
+ {
+ property: `capture`,
+ description: `Determines whether to use capture phase event listeners.`,
+ type: `boolean | { escapeKey?: boolean; outsidePress?: boolean }`,
+ default: `undefined`,
+ },
+];
diff --git a/packages/docs/src/routes/(inner)/api/use-floating/+page.svelte b/packages/docs/src/routes/(inner)/api/use-floating/+page.svelte
new file mode 100644
index 00000000..f2531daf
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-floating/+page.svelte
@@ -0,0 +1,67 @@
+
+
+
+
+
+
useFloating
+
+ The main Hook of the library that acts as a controller for all other Hooks and components.
+
+
+
+
+
+
Usage
+
+ The useFloating Svelte hook acts as a controller for all other Floating
+ UI Svelte features. It handles positioning your floating elements (tooltips, popovers, etc.) relative
+ to an anchored element. Automatically calculates the best placement and updates it as needed, providing
+ access to properties for position and style.
+
+
+
+\n
+
+
+ Floating
+
+ `}
+ />
+
+
+
+
Note
+
Destructured variables are not supported as this would break reactivity.
diff --git a/packages/docs/src/routes/(inner)/api/use-floating/data.ts b/packages/docs/src/routes/(inner)/api/use-floating/data.ts
new file mode 100644
index 00000000..f95c2a49
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-floating/data.ts
@@ -0,0 +1,107 @@
+// Hook: useFloating
+
+import type { TableData } from '$lib/types.js';
+
+// Options
+export const tableOptions: TableData[] = [
+ {
+ property: `open`,
+ description: `Represents the open/close state of the floating element.`,
+ type: `boolean`,
+ default: `true`,
+ },
+ {
+ property: `onOpenChange`,
+ description: `Event handler that can be invoked whenever the open state changes.`,
+ type: `(open: boolean, event?: Event, reason?: OpenChangeReason) => void`,
+ default: ``,
+ },
+ {
+ property: `placement`,
+ description: `Where to place the floating element relative to its reference element.`,
+ type: `Placement`,
+ default: `'bottom'`,
+ },
+ {
+ property: `strategy`,
+ description: `The type of CSS position property to use.`,
+ type: `Strategy`,
+ default: `'absolute'`,
+ },
+ {
+ property: `middleware`,
+ description: `Supports all Floating UI middleware`,
+ type: `Array`,
+ default: `undefined`,
+ },
+ {
+ property: `transform`,
+ description: `Whether to use transform instead of top and left styles to position the floating element.`,
+ type: `boolean`,
+ default: `true`,
+ },
+ {
+ property: `elements`,
+ description: `The reference and floating elements.`,
+ type: `FloatingElements`,
+ default: `{}`,
+ },
+ {
+ property: `whileElementsMounted`,
+ description: `Callback to handle mounting/unmounting of the elements.`,
+ type: `((reference: ReferenceElement, floating: FloatingElement, update: () => void) => () => void) | undefined`,
+ default: `undefined`,
+ },
+ {
+ property: 'nodeId',
+ description: 'A unique node ID for the floating element when using a `FloatingTree`.',
+ type: 'string | undefined',
+ default: 'undefined',
+ },
+];
+
+// Returns
+export const tableReturns: TableData[] = [
+ { property: `x`, description: `The x-coord of the floating element.`, type: `number` },
+ { property: `y`, description: `The y-coord of the floating element.`, type: `number` },
+ {
+ property: `placement`,
+ description: `The stateful placement, which can be different from the initial placement passed as options.`,
+ type: `Placement`,
+ },
+ {
+ property: `strategy`,
+ description: `The stateful strategy, which can be different from the initial strategy passed as options.`,
+ type: `Strategy`,
+ },
+ {
+ property: `middlewareData`,
+ description: `Additional data from middleware.`,
+ type: `MiddlewareData`,
+ },
+ {
+ property: `isPositioned`,
+ description: `The boolean that let you know if the floating element has been positioned.`,
+ type: `boolean`,
+ },
+ {
+ property: `floatingStyles`,
+ description: `CSS styles to apply to the floating element to position it.`,
+ type: `string`,
+ },
+ {
+ property: `elements`,
+ description: `The reference and floating elements.`,
+ type: `FloatingElements`,
+ },
+ {
+ property: `update`,
+ description: `The function to update floating position manually.`,
+ type: `() => void`,
+ },
+ {
+ property: `context`,
+ description: `Context object containing internal logic to alter the behavior of the floating element.`,
+ type: `FloatingContext`,
+ },
+];
diff --git a/packages/docs/src/routes/(inner)/api/use-focus/+page.svelte b/packages/docs/src/routes/(inner)/api/use-focus/+page.svelte
new file mode 100644
index 00000000..f547eb89
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-focus/+page.svelte
@@ -0,0 +1,44 @@
+
+
+
+
+
+
useFocus
+
+ Opens the floating element while the reference element has focus, like CSS
+ :focus.
+
+
+
+
+
+
+
+
Usage
+
+ This Hook returns event handler props. To use it, pass it the context object returned from useFloating(), and then feed its result into the useInteractions() array. The returned
+ prop getters are then spread onto the elements for rendering.
+
diff --git a/packages/docs/src/routes/(inner)/api/use-hover/data.ts b/packages/docs/src/routes/(inner)/api/use-hover/data.ts
new file mode 100644
index 00000000..18f3808b
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-hover/data.ts
@@ -0,0 +1,43 @@
+// Hook: useHover
+
+import type { TableData } from '$lib/types.js';
+
+// Options
+export const tableOptions: TableData[] = [
+ {
+ property: `enabled`,
+ description: `Enables the hook.`,
+ type: `boolean`,
+ default: `true`,
+ },
+ {
+ property: `mouseOnly`,
+ description: `Only allow pointers of type mouse to trigger the hover (thus excluding pens and touchscreens).`,
+ type: `boolean`,
+ default: `false`,
+ },
+ {
+ property: `delay`,
+ description: `Time in ms that will delay the change of the open state. Also accepts an object with open and close properties for finer grained control.`,
+ type: `number`,
+ default: `0`,
+ },
+ {
+ property: `restMs`,
+ description: `Time in ms that the pointer must rest on the reference element before the open state is set to true.`,
+ type: `number`,
+ default: `0`,
+ },
+ {
+ property: `move`,
+ description: `Whether moving the pointer over the floating element will open it, without a regular hover event required.`,
+ type: `boolean`,
+ default: `true`,
+ },
+ {
+ property: `handleClose`,
+ description: `Callback to handle the closing of the floating element.`,
+ type: `HandleCloseFn`,
+ default: `null`,
+ },
+];
diff --git a/packages/docs/src/routes/(inner)/api/use-interactions/+page.svelte b/packages/docs/src/routes/(inner)/api/use-interactions/+page.svelte
new file mode 100644
index 00000000..87b7ed3c
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-interactions/+page.svelte
@@ -0,0 +1,83 @@
+
+
+
+
+
+
useInteractions
+
A hook to merge or compose interaction event handlers together.
+
+
+
+
+
Usage
+
+ The useInteractions Svelte hook allows you to consume multiple interactions.
+ It ensures that event listeners from different hooks are properly registered instead of being overruled
+ by one another.
+
+
+
+
+ Reference
+
+
+
+
+ Floating
+
+ `}
+ />
+
+ When you want to apply an event handler to an element that uses a props getter, make sure to
+ pass it through the getter instead of applying it directly:
+
+
+
Reference
+
+
+
Reference
+ `}
+ />
+
+ This will ensure all event handlers will be registered rather being overruled by each-other.
+
diff --git a/packages/docs/src/routes/(inner)/api/use-interactions/data.ts b/packages/docs/src/routes/(inner)/api/use-interactions/data.ts
new file mode 100644
index 00000000..ceeacf44
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-interactions/data.ts
@@ -0,0 +1,22 @@
+// Hook: useInteractions
+
+import type { TableData } from '$lib/types.js';
+
+// Returns
+export const tableReturns: TableData[] = [
+ {
+ property: `getReferenceProps`,
+ description: `The merged attributes for the reference element.`,
+ type: `(userProps?: HTMLAttributes) => Record`,
+ },
+ {
+ property: `getFloatingProps`,
+ description: `The merged attributes for the floating element.`,
+ type: `(userProps?: HTMLAttributes) => Record`,
+ },
+ {
+ property: `getItemProps`,
+ description: `The merged attributes for when dealing with a list inside the floating element.`,
+ type: `(userProps?: HTMLAttributes & ExtendedUserProps) => Record`,
+ },
+];
diff --git a/packages/docs/src/routes/(inner)/api/use-role/+page.svelte b/packages/docs/src/routes/(inner)/api/use-role/+page.svelte
new file mode 100644
index 00000000..b29fc2d3
--- /dev/null
+++ b/packages/docs/src/routes/(inner)/api/use-role/+page.svelte
@@ -0,0 +1,70 @@
+
+
+
+
+
+
useRole
+
+ Adds base screen reader props to the reference and floating elements for a given
+ role.
+
+
+
+ This is useful to automatically apply ARIA props to the reference and floating elements to
+ ensure they’re accessible to assistive technology, including item elements if narrowly
+ specified.
+
+ Install Floating UI Svelte using your package manager of choice.
+
+
+
+
+
+
Usage
+
Floating UI Features
+
+
+ Floating UI Svelte exposes all Floating UI middleware, types, etc. You do not need to install @floating-ui/dom seperately.
+
+
+
Making elements "float"
+
+ At minimum, the following styles must be applied to ensure floating elements do not disrupt
+ the flow of the document. This can be handled using a single reusable CSS class.
+
+
+ Some floating element.
`} />
+
Z-Index Stacking
+
+ Please be aware that Floating UI does not take an opinionated stance on z-index stacking.
+
+
+
+
+
Caveats
+
Server-Side Rendering (SSR)
+
+ When SSR is enabled and the floating element is visible upon page load it will first be
+ positioned in the top left of your screen. It will remain until the position is calculated. To
+ prevent this, you may utilize the isPositioned
+ prop returned from the
+ useFloating hook:
+
+ open determines whether or not the popover is currently open on the screen.
+ It is used for conditional rendering.
+
+
+
Basic Popover
+
+
+
useFloating Hook
+
+ The useFloating hook provides positioning and context
+ for our popover. We need to pass it some information:
+
+
+
+
+ open: The open state from our useState()
+ Hook above.
+
+
+ onOpenChange: A callback function that will be called when the
+ popover is opened or closed. We’ll use this to update our open state.
+
+
+ middleware: Import and pass middleware to the array that ensure
+ the popover remains on the screen, no matter where it ends up being positioned.
+
+
+ whileElementsMounted: Ensure the popover remains anchored to the
+ reference element by updating the position when necessary, only while both the reference and
+ floating elements are mounted for performance.
+
+
+
+
+
+
Interaction Hooks
+
+ The useInteractions hooks returns an object
+ containing keys of props that enable the popover to be opened, closed, or accessible to screen
+ readers. Using the
+ context that was returned from the Hook, call the interaction Hooks.
+
+
+
+
+ useClick(): adds the ability to toggle the popover open or closed
+ when the reference element is clicked.
+
+
+ useDismiss(): adds the ability to dismiss the popover when the
+ user presses the esc key or presses outside of the popover.
+
+
+ useRole(): adds the correct ARIA attributes for a
+ dialog to the popover and reference elements.
+
+
+
+ Finally, useInteractions() merges all of their props into prop getters
+ which can be used for rendering.
+
+
+
+
+
Rendering
+
Now we have all the variables and Hooks set up, we can render out our elements.
+
+\n
+
+{#if open}
+
+
+ You can press the esc key or click outside to
+ *dismiss* this floating element.
+
+
+
+{/if}
+ `}
+ />
+
+
+ {`{...getReferenceProps()}`} /
+ {`{...getFloatingProps()}`}
+ spreads the props from the interaction Hooks onto the relevant elements. They contain props like
+ onClick, aria-expanded, etc.
+
+
+
+ COMING SOON: {``} is a component that manages
+ focus of the popover for non-modal or modal behavior. It should directly wrap the floating element
+ and only be rendered when the popover is also rendered.
+
+ A tooltip is a floating element that displays information related to a button or anchor
+ element when it receives keyboard focus or the mouse hovers over it.
+
+
+
+
+
Essentials
+
An accessible tooltip component has the following qualities:
+
+
+ Dynamic anchor positioning: The tooltip is positioned next to
+ its reference element, and remains anchored to it while avoiding collisions.
+
+
+ Events: When the mouse hovers over the reference element, or
+ when the reference element receives keyboard focus, the tooltip opens. When the mouse
+ leaves, or the reference is blurred, the tooltip closes.
+
+
+ Dismissal: When the user presses the
+ esc key while the tooltip is open, it closes.
+
+
+ Role: The elements are given relevant role and ARIA
+ attributes to be accessible to screen readers.
+
+ open determines whether or not the tooltip is currently open on the screen.
+ It is used for conditional rendering.
+
+
+
+
+
useFloating Hook
+
+ The useFloating hook provides positioning and context
+ for our tooltip. We need to pass it some information:
+
+
+
+
+ open: The open state from our useState()
+ Hook above.
+
+
+ onOpenChange: A callback function that will be called when the
+ tooltip is opened or closed. We’ll use this to update our open state.
+
+
+ middleware: Import and pass middleware to the array that ensure
+ the tooltip remains on the screen, no matter where it ends up being positioned.
+
+
+ whileElementsMounted: Ensure the tooltip remains anchored to the
+ reference element by updating the position when necessary, only while both the reference and
+ floating elements are mounted for performance.
+
+
+
+
+
+
Interaction Hooks
+
+ The useInteractions hooks returns an object
+ containing keys of props that enable the tooltip to be opened, closed, or accessible to screen
+ readers. Using the
+ context that was returned from the Hook, call the interaction Hooks.
+
+
+
+
+ useRole(): adds the correct ARIA attributes for a
+ tooltip to the tooltip and reference elements.
+
+
+ useHover(): adds the ability to toggle the tooltip open or closed
+ when the reference element is hovered over. The move option is set
+ to false so that
+ mousemove events are ignored.
+
+
+ useDismiss(): adds the ability to dismiss the tooltip when the
+ user presses the esc key.
+
+
+
+ COMING SOON: useFocus(): adds the ability to toggle the tooltip
+ open or closed when the reference element is focused.
+
+
+
+
+
+
Rendering
+
Now we have all the variables and Hooks set up, we can render out our elements.
+
+
+
+
+{#if open}
+
+
+ A floating element is one that floats on top of the UI without disrupting the
+ flow, like this one!
+
+
+
+{/if}
+ `}
+ />
+
+ {`{...getReferenceProps()}`} and
+ {`{...getFloatingProps()}`} spreads the props from the interaction
+ Hooks onto the relevant elements. They contain props like
+ onMouseEnter, aria-describedby, etc.
+