diff --git a/sites/docs/src/lib/content/api-reference/combobox.api.ts b/sites/docs/src/lib/content/api-reference/combobox.api.ts index 7de0374ce..a72d03911 100644 --- a/sites/docs/src/lib/content/api-reference/combobox.api.ts +++ b/sites/docs/src/lib/content/api-reference/combobox.api.ts @@ -21,6 +21,7 @@ import { } from "./extended-types/shared/index.js"; import { ComboboxScrollAlignmentProp } from "./extended-types/combobox/index.js"; import { ItemsProp } from "./extended-types/select/index.js"; +import { FloatingContentChildSnippetProps } from "./extended-types/floating/index.js"; import { arrowProps, childrenSnippet, @@ -152,7 +153,7 @@ export const content = createApiSchema({ ...withChildProps({ elType: "HTMLDivElement", childrenDef: OpenChildrenSnippetProps, - childDef: OpenChildSnippetProps, + childDef: FloatingContentChildSnippetProps, }), }, dataAttributes: [ diff --git a/sites/docs/src/lib/content/api-reference/context-menu.api.ts b/sites/docs/src/lib/content/api-reference/context-menu.api.ts index 7d6de2d31..e0d0b02b6 100644 --- a/sites/docs/src/lib/content/api-reference/context-menu.api.ts +++ b/sites/docs/src/lib/content/api-reference/context-menu.api.ts @@ -33,6 +33,7 @@ import { withChildProps, } from "./helpers.js"; import { menu } from "./menu.api.js"; +import { FloatingContentChildSnippetProps } from "./extended-types/floating/index.js"; import * as C from "$lib/content/constants.js"; import { omit } from "$lib/utils/omit.js"; @@ -75,7 +76,7 @@ export const content = createApiSchema({ description: "Whether or not the context menu should loop through items when reaching the end.", }), - ...withChildProps({ elType: "HTMLDivElement" }), + ...withChildProps({ elType: "HTMLDivElement", childDef: FloatingContentChildSnippetProps }), }, dataAttributes: menu.content.dataAttributes, cssVars: [ diff --git a/sites/docs/src/lib/content/api-reference/extended-types/floating/floating-content-child-snippet-props.md b/sites/docs/src/lib/content/api-reference/extended-types/floating/floating-content-child-snippet-props.md new file mode 100644 index 000000000..26a7a12a1 --- /dev/null +++ b/sites/docs/src/lib/content/api-reference/extended-types/floating/floating-content-child-snippet-props.md @@ -0,0 +1,17 @@ +```ts +type ChildSnippetProps = { + // Props for the positioning wrapper + // Do not style this element - + // styling should be applied to the content element + wrapperProps: Record; + + // Props for your content element + // Apply your custom styles here + props: Record; + + // Content visibility state + // Use this for conditional rendering with + // Svelte transitions + open: boolean; +}; +``` diff --git a/sites/docs/src/lib/content/api-reference/extended-types/floating/index.ts b/sites/docs/src/lib/content/api-reference/extended-types/floating/index.ts index bc61a8d33..1a220acc8 100644 --- a/sites/docs/src/lib/content/api-reference/extended-types/floating/index.ts +++ b/sites/docs/src/lib/content/api-reference/extended-types/floating/index.ts @@ -6,3 +6,4 @@ export { default as FloatingStickyProp } from "./sticky-prop.md"; export { default as FloatingStrategyProp } from "./strategy-prop.md"; export { default as FloatingUpdatePositionStrategyProp } from "./update-position-strategy-prop.md"; export { default as FloatingCustomAnchorProp } from "./custom-anchor-prop.md"; +export { default as FloatingContentChildSnippetProps } from "./floating-content-child-snippet-props.md"; diff --git a/sites/docs/src/lib/content/api-reference/menu.api.ts b/sites/docs/src/lib/content/api-reference/menu.api.ts index dfcef653f..f654efc2b 100644 --- a/sites/docs/src/lib/content/api-reference/menu.api.ts +++ b/sites/docs/src/lib/content/api-reference/menu.api.ts @@ -56,6 +56,7 @@ import { CheckboxRootOnCheckedChangeProp, CheckboxRootOnIndeterminateChangeProp, } from "./extended-types/checkbox/index.js"; +import { FloatingContentChildSnippetProps } from "./extended-types/floating/index.js"; import type { APISchema, DataAttrSchema, PropObj } from "$lib/types/index.js"; import * as C from "$lib/content/constants.js"; import { enums } from "$lib/content/api-reference/helpers.js"; @@ -121,7 +122,7 @@ const contentProps = { ...withChildProps({ elType: "HTMLDivElement", childrenDef: OpenChildrenSnippetProps, - childDef: OpenChildSnippetProps, + childDef: FloatingContentChildSnippetProps, }), } satisfies PropObj; diff --git a/sites/docs/src/lib/content/api-reference/popover.api.ts b/sites/docs/src/lib/content/api-reference/popover.api.ts index 2206057e1..9a72bb38d 100644 --- a/sites/docs/src/lib/content/api-reference/popover.api.ts +++ b/sites/docs/src/lib/content/api-reference/popover.api.ts @@ -7,6 +7,7 @@ import type { PopoverTriggerPropsWithoutHTML, } from "bits-ui"; import { OnOpenChangeProp, OpenClosedProp } from "./extended-types/shared/index.js"; +import { FloatingContentChildSnippetProps } from "./extended-types/floating/index.js"; import { arrowProps, childrenSnippet, @@ -81,7 +82,7 @@ export const content = createApiSchema({ }, forceMount: forceMountProp, dir: dirProp, - ...withChildProps({ elType: "HTMLDivElement" }), + ...withChildProps({ elType: "HTMLDivElement", childDef: FloatingContentChildSnippetProps }), }, dataAttributes: [ openClosedDataAttr, diff --git a/sites/docs/src/lib/content/api-reference/select.api.ts b/sites/docs/src/lib/content/api-reference/select.api.ts index cee9f727a..fa84aafb7 100644 --- a/sites/docs/src/lib/content/api-reference/select.api.ts +++ b/sites/docs/src/lib/content/api-reference/select.api.ts @@ -23,6 +23,7 @@ import { } from "./extended-types/shared/index.js"; import { ComboboxScrollAlignmentProp } from "./extended-types/combobox/index.js"; import { ItemsProp } from "./extended-types/select/index.js"; +import { FloatingContentChildSnippetProps } from "./extended-types/floating/index.js"; import { arrowProps, childrenSnippet, @@ -151,7 +152,7 @@ export const content = createApiSchema({ ...withChildProps({ elType: "HTMLDivElement", childrenDef: OpenChildrenSnippetProps, - childDef: OpenChildSnippetProps, + childDef: FloatingContentChildSnippetProps, }), }, dataAttributes: [ diff --git a/sites/docs/src/lib/content/api-reference/tooltip.api.ts b/sites/docs/src/lib/content/api-reference/tooltip.api.ts index 773e0cae2..8b7996221 100644 --- a/sites/docs/src/lib/content/api-reference/tooltip.api.ts +++ b/sites/docs/src/lib/content/api-reference/tooltip.api.ts @@ -11,6 +11,7 @@ import { OpenChildSnippetProps, OpenChildrenSnippetProps, } from "./extended-types/shared/index.js"; +import { FloatingContentChildSnippetProps } from "./extended-types/floating/index.js"; import { arrowProps, childrenSnippet, @@ -143,7 +144,7 @@ export const content = createApiSchema({ ...withChildProps({ elType: "HTMLDivElement", childrenDef: OpenChildrenSnippetProps, - childDef: OpenChildSnippetProps, + childDef: FloatingContentChildSnippetProps, }), }, dataAttributes: [