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

Support for mobile layout #1000

Open
fongsean opened this issue Sep 9, 2024 · 2 comments
Open

Support for mobile layout #1000

fongsean opened this issue Sep 9, 2024 · 2 comments

Comments

@fongsean
Copy link
Collaborator

fongsean commented Sep 9, 2024

The renderer doesn't really support viewing on mobile devices at the moment.

Might be a good idea to dynamic adjust form fields to overflow to the next line when a screen width threshold is reached.

Complex items like grids, group tables might take more effort to address.

@brendan-cheong
Copy link

Hi @fongsean, our user experience team loves this idea. They are very keen for the form field labels to appear above the form field inputs at a screen width of 768 pixels.

@fongsean
Copy link
Collaborator Author

Hi @brendan-cheong,

I'm working on a set of library APIs to tweak rendering behaviours that SDC doesn't provide extensions for. I've added a itemLabelGridBreakpoints and itemFieldGridBreakpoints to allow the user to specify breakpoints where the item label and item field will "break" to separate lines.

itemLabelGridBreakpoints and itemFieldGridBreakpoints uses the below interface:

export interface ItemGridBreakpoints { xs?: number, sm?: number, md?: number, lg?: number, xl?: number }

Each (xs, sm, etc) of these values should total to 12 if you want the label and the field on the same line.
If you want them on separate lines, setting both to 12 should do the trick.
The defaults are:

itemLabelGridBreakpoints: { xs: 12, md: 4 },
itemFieldGridBreakpoints: { xs: 12, md: 8 },

By default, screen width above md will have a 1:2 ratio for labels and their fields on the same row. Below md, they will form two rows.

Note: the breakpoints are based on the screen width, not the renderer width. It does require more refinement if we want it to be based on the renderer width.


These new library APIs are currently in the alpha release of the library, but I imagine there could be breaking changes between different alpha versions (not yet so far), so proceed with caution. itemLabelFontWeight seems like one that will be removed eventually. There are also no documentation on how to use these APIs yet.

See: https://github.com/aehrc/smart-forms/blob/alpha/packages/smart-forms-renderer/src/stores/rendererStylingStore.ts

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

No branches or pull requests

2 participants