Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How can I pass ui:widget hidden to oneOf/anyOf/allOf #4229

Closed
cgokey opened this issue Jun 25, 2024 · 3 comments
Closed

How can I pass ui:widget hidden to oneOf/anyOf/allOf #4229

cgokey opened this issue Jun 25, 2024 · 3 comments
Labels

Comments

@cgokey
Copy link

cgokey commented Jun 25, 2024

I'm including the following sandbox url as an illustration:

I tried this, but with no luck.

"anyOf": {
    "ui:widget": "hidden"
  }

Is there any way to hide the combo box?

The json schema is here:

{
  "title": "A registration form",
  "description": "A simple form example.",
  "type": "object",
  "anyOf": [
    {
      "required": [
        "firstName"
      ]
    },
    {
      "required": [
        "lastName"
      ]
    }
  ],
  "properties": {
    "firstName": {
      "type": "string",
      "title": "First name",
      "default": "Chuck"
    },
    "lastName": {
      "type": "string",
      "title": "Last name"
    },
    "age": {
      "type": "integer",
      "title": "Age"
    },
    "bio": {
      "type": "string",
      "title": "Bio"
    },
    "password": {
      "type": "string",
      "title": "Password",
      "minLength": 3
    },
    "telephone": {
      "type": "string",
      "title": "Telephone",
      "minLength": 10
    }
  }
}
@cgokey cgokey added needs triage Initial label given, to be assigned correct labels and assigned question labels Jun 25, 2024
@corbinschwartz
Copy link

corbinschwartz commented Jun 26, 2024

Facing this same issue.

@cgokey this won't hide the dropdown, but one thing you might want to do is add "type": "object", to your anyOf blocks (it hides the rjsf error complaining about undefined type)

I'm using tailwind, and adding className="[&_div.panel.panel-default.panel-body]:hidden" to the <Form> makes it hide the anyOf variant selector (shoutout to #3834 (comment) for the inspiration)

@heath-freenome heath-freenome removed the needs triage Initial label given, to be assigned correct labels and assigned label Jun 28, 2024
@heath-freenome
Copy link
Member

Closing this as a duplicate of #3834

@nickgros
Copy link
Contributor

Does this work? Playground link

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants