useDetailMeta
Resolves the title, description, and detail component for the Detail view. Use this inside a component rendered within <Detail> to consume fully-resolved metadata without manually wiring schema values, translations, and settings.
import { useDetailMeta } from '@strato-admin/core';
const MyDetailHeader = ({ title, description }) => {
const { title: resolvedTitle } = useDetailMeta({ title, description });
return <Header>{resolvedTitle}</Header>;
};
Signature
function useDetailMeta(props?: UseDetailMetaProps): {
title: ReactNode;
description: ReactNode | undefined;
component: ComponentType<any> | undefined;
};
interface UseDetailMetaProps {
title?: ReactNode | ((record: any) => ReactNode);
description?: ReactNode | ((record: any) => ReactNode);
}
Resolution order
For title and description, the hook resolves the first defined value in this priority:
- The prop passed directly to the hook (
props.title/props.description) - The schema value from
<ResourceSchema>(detailTitle/detailDescription) - A constructed default title of the form
"Detail {ResourceLabel}"(title only)
String values are passed through useTranslate, so they can be translation keys. Function values are called with the current record and their return value is used. While the record is loading, title returns '' and description returns undefined.
Parameters
| Name | Type | Description |
|---|---|---|
props.title | ReactNode | ((record) => ReactNode) | Overrides the schema and default title. |
props.description | ReactNode | ((record) => ReactNode) | Overrides the schema description. No default. |
Return value
| Field | Type | Description |
|---|---|---|
title | ReactNode | Fully resolved title. Empty string while loading. |
description | ReactNode | undefined | Fully resolved description, or undefined. |
component | ComponentType | undefined | Custom detail component from schema, or undefined. |
Context requirements
Must be called inside a <Detail> (or <ShowBase>) tree and inside a <ResourceSchemaProvider>.
See also
<Detail>— the component that wraps the detail context<DetailHub>— the default detail layout componentuseListMeta,useEditMeta,useCreateMeta— equivalent hooks for other views