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

Custom css class support #63

Closed
gnom7 opened this issue May 17, 2018 · 4 comments
Closed

Custom css class support #63

gnom7 opened this issue May 17, 2018 · 4 comments

Comments

@gnom7
Copy link

gnom7 commented May 17, 2018

According to the README I can specify my own CSS styles, but I cannot find the way to specify CSS classes for elements in json schema.

If you want to specify your own styles with CSS, you can use barebones, which includes almost no classes or inline styles.

Can we add something similar to

"style": {
      "add": "btn-success"
    }

to element meta information in json schema?
Also see jdorn/json-editor#158 (comment)

@loganvolkers loganvolkers changed the title Custom css form styling support Custom css class support May 17, 2018
@pmk65
Copy link
Collaborator

pmk65 commented Oct 1, 2018

You don't need to apply classes in order to restyle the form. You can use the "data-schemapath" attribute to select the various parts. Example (Look at the bottom of the CSS): https://codepen.io/pmk/pen/KxbNMo
Another option is to create a custom theme. That way you have control over most of the output.

@pmk65
Copy link
Collaborator

pmk65 commented Oct 23, 2018

Info added to wiki

@pmk65 pmk65 closed this as completed Oct 23, 2018
@osmanraifgunes
Copy link

"data-schemapath" will not work for arrays. For example I have five elements under array, and schemepath will be dynamic :

data-schemapath="root.0"
data-schemapath="root.1"
.
.
.
data-schemapath="root.n"

@germanbisurgi
Copy link
Collaborator

Set a background color on all elements that have a attribute data-schemapath value that begins with "root.":

[data-schemapath^="root."] {
  background: #ffff00;
}

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

No branches or pull requests

5 participants