You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
* | [{@link BoxProps}, Array<LayoutElement>] | Creates a Box and nest all the child LayoutElements inside. | `layout: [[{width: 1/2}, ['name', 'surname']]]` |
31
-
* | Array<LayoutElement> | For grouping LayoutElements inside a wrapper | `layout: [['name', {mt: 'xl'}], ['surname', , {ml: 'xl'}]]` |
32
-
* | [@ComponentName, PropsWithChildren<ComponentProps>] | if you precede first item with "@" it will create component of this name | `layout: [['@Header', {children: 'User Data'}]]` |
33
-
*
34
-
* ### Examples
35
-
*
36
-
* Let say you have following properties in your database: `companyName`, `email`, `address` and `companySize`
37
-
*
38
-
* 1. The simplest horizontal layout:
39
-
*
40
-
* ```
41
-
* const layout = [
42
-
* 'companyName',
43
-
* 'email',
44
-
* 'address',
45
-
* 'companySize',
46
-
* ]
47
-
* ```
48
-
*
49
-
* generates:
50
-
*
51
-
* <img src='./docs/layout1.png'>
52
-
*
53
-
* 2. Now Wrap everything with a {@link Box} of `2/3` max width and horizontal margin (mx)
54
-
* set to auto. This will center all inputs
55
-
*
56
-
* ```
57
-
* const layout = [
58
-
* [{ width: 2 / 3, mx: 'auto' }, [
59
-
* 'companyName',
60
-
* 'email',
61
-
* 'address',
62
-
* 'companySize',
63
-
* ]],
64
-
* ]
65
-
* ```
66
-
*
67
-
* > Hint: you can also pass an array to define how it will behave in a different responsive breakpoints.
68
-
*
69
-
* generates:
70
-
*
71
-
* <img src='./docs/layout2.png'>
72
-
*
73
-
* 3. Add headers between sections
74
-
*
75
-
* ```
76
-
* const layout = [
77
-
* [{ width: 2 / 3, mx: 'auto' }, [
78
-
* ['@H3', { children: 'Company data' }],
79
-
* 'companyName',
80
-
* 'companySize',
81
-
* ['@H3', { children: 'Contact Info' }],
82
-
* 'email',
83
-
* 'address',
84
-
* ]],
85
-
* ]
86
-
* ```
87
-
*
88
-
* > To inject content inside the given Component pass children props to it.
89
-
*
90
-
* generates:
91
-
*
92
-
* <img src='./docs/layout3.png'>
93
-
*
94
-
* 4. Make email and address 50% width
95
-
*
96
-
* > We will wrap them with a Box (default component) which is a flex. Then we will have to wrap also each of them
97
-
* with extra box to define paddings.
98
-
*
99
-
* I will also align to left top section that by removing `{ mx: auto }` and changing width to `1 / 2`.
100
-
*
101
-
* const layout = [{ width: 1 / 2 }, [
102
-
* ['@H3', { children: 'Company data' }],
103
-
* 'companyName',
104
-
* 'companySize',
105
-
* ]],
106
-
* [
107
-
* ['@H3', { children: 'Contact Info' }],
108
-
* [{ flexDirection: 'row', flex: true }, [
109
-
* ['email', { pr: 'default', flexGrow: 1 }],
110
-
* ['address', { flexGrow: 1 }],
111
-
* ]],
112
-
* ],
113
-
* ]
114
-
*
115
-
* generates:
116
-
*
117
-
* <img src='./docs/layout4.png'>
118
-
*
119
-
* 5. Lastly, take a look at the example with a function instead of {@link LayoutElement}.
* | [@ComponentName, PropsWithChildren<ComponentProps>] | if you precede first item with "@" it will create component of this name | `layout: [['@Header', {children: 'User Data'}]]` |
167
+
*
168
+
* ### Examples
169
+
*
170
+
* Let say you have following properties in your database: `companyName`, `email`, `address` and `companySize`
0 commit comments