Skip to content

Add ModalDialog component#19

Open
KirklandGee wants to merge 6 commits intoWebflow-Examples:mainfrom
KirklandGee:add/modal-dialog
Open

Add ModalDialog component#19
KirklandGee wants to merge 6 commits intoWebflow-Examples:mainfrom
KirklandGee:add/modal-dialog

Conversation

@KirklandGee
Copy link
Copy Markdown

Component: ModalDialog

Description

A modal dialog component that displays as a centered overlay with a semi-transparent backdrop. Features a title heading at the top, rich body content area, and a close button (X icon) positioned in the top-right corner. Opens with a smooth fade and scale animation, and closes when clicking the backdrop, pressing Escape, or clicking the close button. Focus is trapped within the modal when open, preventing interaction with underlying content. The modal is fully responsive and adapts to different screen sizes with configurable maximum width variants.

What's Included

  • React component with scoped CSS (no Tailwind, no shadcn)
  • Colors via CSS site variables: var(--background-primary, #ffffff), etc.
  • Typography via inheritance: font-family: inherit; color: inherit;
  • Full prop surface (ModalDialog.webflow.tsx) — 20+ props for developers/agencies
  • Simple prop surface (ModalDialogSimple.webflow.tsx) — core text/link props for clients
  • All CSS classes prefixed with wf-modal-dialog- for Shadow DOM safety

Testing

  • npm install && npm run dev runs locally
  • npx webflow library share imports successfully
  • Full and simple prop surfaces render in Webflow canvas
  • Site variables wire up correctly

Generated component following the Webflow code components scaffold pattern.
Includes full and simple prop surface variations.
@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 4, 2026

@socket-security
Copy link
Copy Markdown

socket-security Bot commented Mar 4, 2026

Caution

Review the following alerts detected in dependencies.

According to your organization's Security Policy, you must resolve all "Block" alerts before proceeding. It is recommended to resolve "Warn" alerts too. Learn more about Socket for GitHub.

Action Severity Alert  (click "▶" to expand/collapse)
Block Medium
Recently published: npm @dotenvx/dotenvx published 2 hours ago

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/@dotenvx/dotenvx@1.61.2

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/@dotenvx/dotenvx@1.61.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm axios published 2 hours ago

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/axios@1.15.2

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/axios@1.15.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm electron-to-chromium published 6 hours ago

Location: Package overview

From: ?npm/@vitejs/plugin-react@5.2.0npm/@webflow/webflow-cli@1.14.0npm/electron-to-chromium@1.5.341

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/electron-to-chromium@1.5.341. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm jsonfile published yesterday

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/jsonfile@6.2.1

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/jsonfile@6.2.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Block Medium
Recently published: npm tapable published 6 hours ago

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/tapable@2.3.3

ℹ Read more on: This package | This alert | What are recently published artifacts?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Packages should either be allowlisted to allow recently-published versions, or an older version should be used instead.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/tapable@2.3.3. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm caniuse-lite under CC-BY-4.0

Location: Package overview

From: ?npm/@vitejs/plugin-react@5.2.0npm/@webflow/webflow-cli@1.14.0npm/caniuse-lite@1.0.30001788

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/caniuse-lite@1.0.30001788. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm lodash under CC0-1.0 AND MIT

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/lodash@4.18.1

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/lodash@4.18.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm memfs under Unlicense

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/memfs@3.6.0

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/memfs@3.6.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn High
License policy violation: npm vite

Location: Package overview

From: modal-dialog/package.jsonnpm/vite@7.3.2

ℹ Read more on: This package | This alert | What is a license policy violation?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Find a package that does not violate your license policy or adjust your policy to allow this package's license.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/vite@7.3.2. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Dynamic code execution: npm async-generator-function

Eval Type: Function

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/async-generator-function@1.0.0

ℹ Read more on: This package | This alert | What is dynamic code execution?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Avoid packages that use dynamic code execution like eval(), since this could potentially execute any code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/async-generator-function@1.0.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Dynamic code execution: npm generator-function

Eval Type: Function

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/generator-function@2.0.1

ℹ Read more on: This package | This alert | What is dynamic code execution?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Avoid packages that use dynamic code execution like eval(), since this could potentially execute any code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/generator-function@2.0.1. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Dynamic code execution: npm glob-to-regex.js

Eval Type: Function

Location: Package overview

From: ?npm/@webflow/webflow-cli@1.14.0npm/glob-to-regex.js@1.2.0

ℹ Read more on: This package | This alert | What is dynamic code execution?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Avoid packages that use dynamic code execution like eval(), since this could potentially execute any code.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/glob-to-regex.js@1.2.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Deprecated by its maintainer: npm koa-compose

Reason: koa-compose@4.2.0 is a breaking version, please either use <= v4.1 or upgrade to v5.x once it is released

From: ?npm/@webflow/webflow-cli@1.14.0npm/koa-compose@4.2.0

ℹ Read more on: This package | This alert | What is a deprecated package?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/koa-compose@4.2.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

Warn Medium
Deprecated by its maintainer: npm memfs with reason "this will be v4"

Reason: this will be v4

From: ?npm/@webflow/webflow-cli@1.14.0npm/memfs@3.6.0

ℹ Read more on: This package | This alert | What is a deprecated package?

Next steps: Take a moment to review the security alert above. Review the linked package source code to understand the potential risk. Ensure the package is not malicious before proceeding. If you're unsure how to proceed, reach out to your security team or ask the Socket team for help at support@socket.dev.

Suggestion: Research the state of the package and determine if there are non-deprecated versions that can be used, or if it should be replaced with a new, supported solution.

Mark the package as acceptable risk. To ignore this alert only in this pull request, reply with the comment @SocketSecurity ignore npm/memfs@3.6.0. You can also ignore all packages with @SocketSecurity ignore-all. To ignore an alert for all future pull requests, use Socket's Dashboard to change the triage state of this alert.

View full report

@KirklandGee
Copy link
Copy Markdown
Author

Screenshots

Light Theme

!Light

Dark Theme

!Dark

Brand Theme

!Brand

@KirklandGee
Copy link
Copy Markdown
Author

Screenshots

Light Theme

!Light

Dark Theme

!Dark

Brand Theme

!Brand

KirklandGee and others added 4 commits March 4, 2026 15:56
Co-Authored-By: Claude Sonnet 4.6 (1M context) <noreply@anthropic.com>
bodyContent is declared as props.RichText, so at runtime Webflow hands
the component a React slot element, not a string. The React code typed
it as string and fed it to dangerouslySetInnerHTML, which expects
{__html: string} — passing a React element there produces nothing
readable, which is why the modal body was blank. Two changes:

- Type bodyContent (and modalTitle, also a Webflow-provided value) as
  React.ReactNode and render bodyContent with {bodyContent} directly.
  The contentSlot fallback branch is preserved for consumers who want
  to pass custom component children.
- Add a plain-text defaultValue to the bodyContent RichText prop so the
  modal has real copy when first dropped on a site (Webflow doesn't
  fall back to the React default because it always supplies a slot
  element, not undefined).

Also: add vite/client to tsconfig so *.css side-effect imports
type-check, and replace dead activeTheme === 'dark' ternaries inside
the main.tsx activeTheme === 'custom' branch so the build compiles
cleanly.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
The contentSlot branch was always winning because the runtime value is a
React slot element, which is truthy even when the designer's Content
Slot editor shows "Empty". That meant the bodyContent RichText (the
only field with a usable editor in the Properties panel) was never
rendered. Webflow doesn't currently expose a helpful editor for
props.Slot in this position either, so the slot was unusable in
practice.

Remove the contentSlot prop and always render bodyContent. Consumers
who need composable children can fork the component; the common case
is rich-text body copy.

Also dropped the matching contentSlot demo section from main.tsx.

Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant