-
Notifications
You must be signed in to change notification settings - Fork 2.4k
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
Added documentation concerning forms #16566
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have some very minor comments, other than that it looks fine 👍 I asked @cbliard to take a look as well, as he is currently implementing a settings page. So he might have additional ideas about what should be written down.
|
||
## Grouping and hierarchy | ||
|
||
Form elements are related need to be grouped together. For this, use a form group. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Form elements are related need to be grouped together. For this, use a form group. | |
Form elements that are related need to be grouped together. For this, use a [form group](https://primer-lookbook.github.com/view-components/lookbook/pages/forms/groups_layouts). |
|
||
Form elements are related need to be grouped together. For this, use a form group. | ||
|
||
If a form is particularly long, split it into different form groups and use a `Subhead` at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If a form is particularly long, split it into different form groups and use a `Subhead` at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction). | |
If a form is particularly long, split it into different form groups and use a [`Subhead`](https://primer-lookbook.github.com/view-components/lookbook/inspect/primer/beta/subhead/default) at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction). |
- <strong>:auto</strong> => width: auto | ||
- <strong>:small</strong> => max-width: min(256px, 100vw - 2rem) | ||
- <strong>:medium</strong> => max-width: min(320px, 100vw - 2rem) | ||
- <strong>:large</strong> => max-width: min(480px, 100vw - 2rem) | ||
- <strong>:xlarge</strong> => max-width: min(640px, 100vw - 2rem) | ||
- <strong>:xxlarge</strong> => max-width: min(960px, 100vw - 2rem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
A screenshot would be worth a thousand words.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also knowing that multiple width are available does not help making a choice. If there is a rule, here would be a good place to make it explicit.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for providing this. Overall I think it could benefit from having more screenshots illustrating the mentionned cases. That's something I appreciate in original Primer documentation, and I'm sure that's something I would appreciate in our docs as well.
|
||
Form elements are related need to be grouped together. For this, use a form group. | ||
|
||
If a form is particularly long, split it into different form groups and use a `Subhead` at the start of each to give it a title. When using Subheads, we recommend implementing individual Save buttons for each section (using the <em>Secondary</em> style). If a section only contains `Toggle switch` elements, a separate Save button is not necessarily (since the Toggle sends its own server request on interaction). |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Screenshots of a short form and a long form would be helpful, or links to our lookbook to such forms.
- <strong>:auto</strong> => width: auto | ||
- <strong>:small</strong> => max-width: min(256px, 100vw - 2rem) | ||
- <strong>:medium</strong> => max-width: min(320px, 100vw - 2rem) | ||
- <strong>:large</strong> => max-width: min(480px, 100vw - 2rem) | ||
- <strong>:xlarge</strong> => max-width: min(640px, 100vw - 2rem) | ||
- <strong>:xxlarge</strong> => max-width: min(960px, 100vw - 2rem) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Also knowing that multiple width are available does not help making a choice. If there is a rule, here would be a good place to make it explicit.
ba2287f
to
83daf48
Compare
I forgot about this PR. I also added a forms page in another PR. A bit more technical. Once both PR are merged, we should issue a PR to merge the content of both pages into one coherent and cohesive page. The other PR is #16550. |
Seen with Henriette: once this PR is merged, I'll file my content in the page under a |
Ticket
https://community.openproject.org/projects/openproject/work_packages/57580/activity
What are you trying to accomplish?
Add documentation to Lookbook concerning the implementation of forms and form elements in Primer.
What approach did you choose and why?
The approach was discussed and agreed upon in the frontend daily on 30 August 2024.
Merge checklist