question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

"description" of a property won't show when using theme antd

See original GitHub issue

Description

Example When using theme @rjsf/antd, description of a property won’t show.

The problem will be resolved if I uncomment this line. Is that commented out for some other reason?

Steps to Reproduce

  1. Add description for any property at rjsf-jsonschema-form playground, like:
 "properties": {
    "firstName": {
      "type": "string",
      "title": "First name",
 +++     "description": "This is the same as the simple form, but it is rendered as a bootstrap grid. Try shrinking the browser window to see it in action."
    },
  1. Switch the theme, and see the result.

default image

antd image

Expected behavior

description should be shown as what default theme did.

Issue Analytics

  • State:closed
  • Created 3 years ago
  • Reactions:1
  • Comments:5 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
epicfaacecommented, Sep 5, 2021

@delyanr do you remember why the “extra” line was commented out? Should we add it back?

1reaction
momesanacommented, Apr 29, 2021

@Littly, We are facing the same issue and it would be nice if the @rjsf antd theme supported it out of the box but there is still a simple workaround. Looking at the code you will notice that the extra prop (which is how antd would normally display a description pertaining to the input field in question) is listed as a prop in FieldTemplate.js but commented out for some reason: https://github.com/rjsf-team/react-jsonschema-form/blob/7c0d6c2785f170444d806847328b3d060085bb5a/packages/antd/src/templates/FieldTemplate/index.js#L67.

Morover @rjsf allows you to override the template by providing it as a property to the Form component. Therefore you can easily

  1. clone the mentioned file (don’t forget to include the Apache2 license since this constitutes a derivative work),
  2. enable the extra field by removing the comments
  3. and pass the resulting custom FieldTemplate component to your Form like this:
import FieldTemplate from './FieldTemplate';

...
<Form FieldTemplate={FieldTemplate} {...yourOtherProps}>
   ...
</Form>
Read more comments on GitHub >

github_iconTop Results From Across the Web

Customize Theme - Ant Design
Used to represent the operation information of the Token sequence, such as Alert, Tag, Progress, and other components use these map tokens. string,...
Read more >
There is a problem that Customize Ant Design Theme is not ...
I am customizing the theme of antd while using next.js. After Googling the related information, I found a good example and completed the ......
Read more >
Apply themes - Microsoft Support
Apply a theme to quickly format an entire document and give it a modern, professional look. Select Design > Themes. Options for themes...
Read more >
Using CSS custom properties (variables) - MDN Web Docs
Custom properties are subject to the cascade and inherit their value from their parent. Basic usage. Declaring a custom property is done using...
Read more >
Module and theme fields - HubSpot Developers
Below, learn about all of the fields available for modules and themes, along with their available properties. For more information about ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found