Skip to main content

EditShell and CreateShell

A form screen: the React Admin <Edit> / <Create> controller, the FormShell around the inputs, and the ViewContent frame around that.

The two are the same shell with a different controller — EditShell waits for the record to load, a create has nothing to wait for.

Example​

import {EditShell, PropertyFormLayout, TextInput, NumberInput} from 'habarico';

<EditShell
title="Edit product"
controllerProps={{resource: 'eshop/product', id: productId, mutationMode: 'pessimistic'}}
onPostSubmit={() => notify('Saved')}
>
<PropertyFormLayout>
<TextInput source="name" />
<NumberInput source="price" />
</PropertyFormLayout>
</EditShell>

Props​

Both shells take the same props; only the type of controllerProps differs.

NameTypeDefaultDescription
childrenReactNode—The inputs
controllerPropsOmit<EditProps | CreateProps, 'children'>—Plain React Admin controller props — id, resource, transform, mutationMode, mutationOptions, …
titleReactNode—Portaled to the layout header
subtitleReactNode—Rendered under the title
breadcrumbsReactNode—Injected into the layout's breadcrumb slot
toolbarActionsReactNode—Portaled next to the title
formActionsReactNodea submit buttonThe save / delete bar at the bottom of the form
onSubmitSubmitHandler<FieldValues>save from the controllerTakes over submitting entirely
onPostSubmit() => void—Runs after a successful save
defaultValuesRecord<string, unknown>—Values pre-filled into the form
caution

onSubmit replaces the save — nothing is persisted unless your handler does it. To only react to a save, use onPostSubmit.

The action bar is FormShell's own toolbar, not ViewContent's bottomActions — it has to stay inside the React Admin form subtree for submit to stay wired. That is why these shells expose formActions and not bottomActions.

See also​