-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathlayout-example.tsx
More file actions
39 lines (35 loc) · 1 KB
/
layout-example.tsx
File metadata and controls
39 lines (35 loc) · 1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
import { LayoutView, useReactlit } from '@reactlit/core';
import { TextInput } from './inputs/basic-text-input';
export default function LayoutExample() {
const Reactlit = useReactlit();
return (
<Reactlit>
{async ({ view }) => {
const [col1, col2, col3] = view(
'cols',
<div
style={{
display: 'grid',
gridTemplateColumns: '1fr 1fr 1fr',
gap: '1rem',
alignItems: 'end',
}}
/>,
// the second argument here wraps each slot in a div so that they show
// up as a single grid column in the layout
LayoutView(3, <div />)
);
col1.display('First Name');
const first = col1.view('first', TextInput);
col2.display('Last Name');
const last = col2.view('last', TextInput);
col3.display('Hello to');
col3.display(
<div>
{first} {last}
</div>
);
}}
</Reactlit>
);
}