Skip to content

Conversation

@fenech
Copy link
Collaborator

@fenech fenech commented Aug 1, 2025

This example shows how custom schema extensions can be matched and used to render a custom control. For the sake of example, a builtin "MaterialBooleanControl" is rendered, but in practice this would be our own custom control component, which would have access to the custom schema passed via props.

To test: npm run dev and navigate to this URL

http://localhost:3000/?schema=N4KABGBEAOBOD20CmsAuBLJBnSAuMoEEkAtgJ4C0JAhtBQGaYA2AJngeEcamcu5FlSx0AOwDmkADScukevFgksAOhEAjMsvgikAegDGAV0HwSFfdqHwm7QlyKQeffAIAW1FkhYVUieACssbSkZe0c-QOD8O3sHIMNYfSQAYW0dfQwoqAsRdMyRChFqEiQKAHd0VFdRcyZ4Q29aOhEcUK4AX2lY4hZqVGpbNrD4xJS0pAz0LMgcvKmCopLyyuqC-TqGiibC1u6wdqGDjs4D9qA&uiSchema=N4KABBYEQC4J4AcCmUBc0BqSBOMCWAxgIYA2AMkXAPYCuMUANOJFEiUgLZIB2MAzmjABtZpEigxklvGSCoAYSq9sVEo1FSWfAlVnooAYgD0CFclx4kfIxzgBaDkQR2AZpZIATdZslRd%2BJQF0YABfDTEwsQBdEBCgA

or equivalently, use the following values.schema.json:

{
  "properties": {
    "my-map-field": {
      "type": "string",
      "forms.nby.one/custom-control": {
        "type": "shaded-topojson",
        "topojson": {
          "sourceConnection": "connection-name-within-cloud-app-ns"
        },
        "data": {
          "sourceConnection": "connection-name-within-cloud-app-ns"
        }
      }
    }
  }
}

and any UI Schema referencing "my-map-field", e.g.

{
    "type": "VerticalLayout",
    "elements": [
        {
            "type": "Control",
            "scope": "#/properties/my-map-field",
            "options": {}
        }
    ]
}

This example shows how custom schema extensions can be matched and
used to render a custom control. For the sake of example, a builtin
"MaterialBooleanControl" is rendered, but in practice this would be
our own custom control component, which would have access to the
custom `schema` passed via props.

To test: `npm run dev` and navigate to this URL

http://localhost:3000/?schema=N4KABGBEAOBOD20CmsAuBLJBnSAuMoEEkAtgJ4C0JAhtBQGaYA2AJngeEcamcu5FlSx0AOwDmkADScukevFgksAOhEAjMsvgikAegDGAV0HwSFfdqHwm7QlyKQeffAIAW1FkhYVUieACssbSkZe0c-QOD8O3sHIMNYfSQAYW0dfQwoqAsRdMyRChFqEiQKAHd0VFdRcyZ4Q29aOhEcUK4AX2lY4hZqVGpbNrD4xJS0pAz0LMgcvKmCopLyyuqC-TqGiibC1u6wdqGDjs4D9qA&uiSchema=N4KABBYEQC4J4AcCmUBc0BqSBOMCWAxgIYA2AMkXAPYCuMUANOJFEiUgLZIB2MAzmjABtZpEigxklvGSCoAYSq9sVEo1FSWfAlVnooAYgD0CFclx4kfIxzgBaDkQR2AZpZIATdZslRd%2BJQF0YABfDTEwsQBdEBCgA
@fenech fenech marked this pull request as draft August 1, 2025 12:10
@netlify
Copy link

netlify bot commented Aug 1, 2025

Deploy Preview for luxury-tanuki-cf16dc ready!

Name Link
🔨 Latest commit 7b879f9
🔍 Latest deploy log https://app.netlify.com/projects/luxury-tanuki-cf16dc/deploys/68921ccef7e13a0008486056
😎 Deploy Preview https://deploy-preview-1--luxury-tanuki-cf16dc.netlify.app
📱 Preview on mobile
Toggle QR Code...

QR Code

Use your smartphone camera to open QR code link.

To edit notification comments on pull requests, go to your Netlify project configuration.

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.

2 participants