diff --git a/.changeset/early-points-study.md b/.changeset/early-points-study.md new file mode 100644 index 000000000..38a79506f --- /dev/null +++ b/.changeset/early-points-study.md @@ -0,0 +1,5 @@ +--- +"bits-ui": patch +--- + +feat: export and document `Portal` utility component diff --git a/packages/bits-ui/package.json b/packages/bits-ui/package.json index 9f511cecc..048a3702e 100644 --- a/packages/bits-ui/package.json +++ b/packages/bits-ui/package.json @@ -60,10 +60,7 @@ "@internationalized/date": "^3.5.4", "clsx": "^2.1.1", "esm-env": "^1.0.0", - "nanoid": "^5.0.7", "runed": "^0.15.2", - "scule": "^1.3.0", - "style-object-to-css-string": "^1.1.3", "style-to-object": "^1.0.6", "svelte-toolbelt": "^0.3.1" }, diff --git a/packages/bits-ui/src/lib/bits/index.ts b/packages/bits-ui/src/lib/bits/index.ts index c078f6475..0fb808049 100644 --- a/packages/bits-ui/src/lib/bits/index.ts +++ b/packages/bits-ui/src/lib/bits/index.ts @@ -36,3 +36,4 @@ export * as Toggle from "./toggle/index.js"; export * as ToggleGroup from "./toggle-group/index.js"; export * as Toolbar from "./toolbar/index.js"; export * as Tooltip from "./tooltip/index.js"; +export { default as Portal } from "./utilities/portal/portal.svelte"; diff --git a/packages/bits-ui/src/lib/bits/utilities/portal/portal.svelte b/packages/bits-ui/src/lib/bits/utilities/portal/portal.svelte index 840771663..d10d5cefc 100644 --- a/packages/bits-ui/src/lib/bits/utilities/portal/portal.svelte +++ b/packages/bits-ui/src/lib/bits/utilities/portal/portal.svelte @@ -1,5 +1,6 @@ + + +
This content will be portalled to the body
+
+``` + +### Custom target + +You can use the `to` prop to specify a custom target element or selector to render the content to. + +```svelte + + +
+ +
+ +
This content will be portalled to the #custom-target element
+
+
+``` + +### Disable + +You can use the `disabled` prop to disable the portal behavior. + +```svelte + + + +
This content will not be portalled
+
+```