Skip to content

Commit 450635d

Browse files
committed
Add story to demonstrate SimpmleFormIterator theming support
1 parent c047222 commit 450635d

File tree

1 file changed

+38
-0
lines changed

1 file changed

+38
-0
lines changed

packages/ra-ui-materialui/src/input/ArrayInput/SimpleFormIterator.stories.tsx

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ import { ArrayInput } from './ArrayInput';
77
import { SimpleFormIterator } from './SimpleFormIterator';
88
import { TextInput } from '../TextInput';
99
import { AdminContext } from '../../AdminContext';
10+
import { defaultTheme } from '../../defaultTheme';
1011

1112
export default { title: 'ra-ui-materialui/input/SimpleFormIterator' };
1213

@@ -192,3 +193,40 @@ export const Sx = () => (
192193
</Edit>
193194
</AdminContext>
194195
);
196+
197+
export const Theming = () => (
198+
<AdminContext
199+
dataProvider={dataProvider}
200+
theme={{
201+
...defaultTheme,
202+
components: {
203+
...defaultTheme.components,
204+
RaSimpleFormIterator: {
205+
styleOverrides: {
206+
root: {
207+
border: 'solid lightgrey 1px',
208+
borderRadius: 2,
209+
marginTop: 24,
210+
padding: 8,
211+
'& .RaSimpleFormIterator-form': {
212+
flexDirection: 'row',
213+
gap: '1em',
214+
},
215+
},
216+
},
217+
},
218+
},
219+
}}
220+
>
221+
<Edit resource="books" id="1">
222+
<SimpleForm>
223+
<ArrayInput source="authors">
224+
<SimpleFormIterator>
225+
<TextInput source="name" />
226+
<TextInput source="role" />
227+
</SimpleFormIterator>
228+
</ArrayInput>
229+
</SimpleForm>
230+
</Edit>
231+
</AdminContext>
232+
);

0 commit comments

Comments
 (0)