Skip to main content

SchemaResource

Declares one resource inside SchemaAdmin.

The component renders nothing itself — it is a descriptor. SchemaAdmin reads its props and builds the routes, views and overrides for that resource from them.

Example​

<SchemaAdmin {...providers} serviceConfigMap={SERVICES}>
<SchemaResource name="eshop/product" />

<SchemaResource
name="eshop/order"
fieldProvider={({source, props}) =>
source === 'total' ? <TotalWithVatField {...props} /> : undefined
}
show={<SchemaShow><OrderShowContent /></SchemaShow>}
/>
</SchemaAdmin>

Props​

On top of these it accepts React Admin's ResourceProps — name is required and takes the "service/resource" form.

NameTypeDefaultDescription
name (required)string—Resource name, e.g. "eshop/product"
fieldProviderResourceFieldProvider—Display overrides for this resource only
inputProviderResourceInputProvider—Input overrides for this resource only
buttonProviderResourceButtonProvider—Button overrides for this resource only
boxProviderResourceBoxProvider—Layout overrides for this resource only
listReactElementgeneratedReplaces the list view
createReactElementgeneratedReplaces the create view
editReactElementgeneratedReplaces the edit view
showReactElementgeneratedReplaces the show view

The resource-level providers are consulted before the admin-wide ones — see how an override is resolved.

tip

A resource that only needs the generated screens takes a single line. Reach for list / show / create / edit when a view needs content that no schema can express; for one field or one button, the providers are the smaller change.

caution

SchemaResource must be a direct child of SchemaAdmin. It returns an empty fragment, so rendering it anywhere else silently produces nothing.

See also​