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

Horizontally structured array items #21

Open
chinshr opened this issue Apr 22, 2016 · 3 comments
Open

Horizontally structured array items #21

chinshr opened this issue Apr 22, 2016 · 3 comments

Comments

@chinshr
Copy link

chinshr commented Apr 22, 2016

I would like to build forms layered horizontally within a form-group like "Primary Colors", "Secondary Colors", etc, see this:

screen shot 2016-04-22 at 1 48 06 pm

However, I don't get the horizontal layout to work. No matter what I do, e.g. subforms it will always rendered as stacked, like this:

screen shot 2016-04-22 at 1 43 45 pm

I would also like to customize the add/remove button, to be right after the color swatch (or on top). I was able to add a color picker control myself.

@stevehu
Copy link
Contributor

stevehu commented Apr 24, 2016

It is controlled by CSS during the array rendering. I am sure it can be customize to display horizontal and flow to the next line. Take a look at css flexbox. The button is the same, you need to align it to the right. All the elements support style so I don't think you need to update the code but only passing in the style variable.

@chinshr
Copy link
Author

chinshr commented Apr 25, 2016

@stevehu thanks for your reply. Can you point me to an example by any chance on how to pass in style? The form documentation is vague about custom styles and does not suggest css inline styles to work properly.

A reference to this and this suggested to do this, but it does not work:

                "htmlClass": "container foobar primaryColors",
                "fieldHtmlClass": "field foobar primaryColors",
                "labelHtmlClass": "label foobar primaryColors",

I was trying to style the section as you suggested without a lot of success, what am I doing wrong?:

...
          {
            "key": "styleGuide.colors",
            "style": { "selected": {"backgroundColor": "#00ff00"} },
            "items": [
              {
                "key": "styleGuide.colors.primaryColors",
                "add": "New",
                "style": {
                  "add": { "background-color": "#ff0000" },
                },
                "items": [
                  {
                    "key": "styleGuide.colors.primaryColors[].color",
                    "type": "color"
                  }
                ]
              }
            ]
          }
...

@stevehu
Copy link
Contributor

stevehu commented Nov 5, 2016

I will add this as an option in the feature when I have time. It would be great if somebody can help.

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

2 participants