Minor Changes
-
#4313
28fe67047a0
Thanks @abdellah711! - feat: dynamic window titleThis feature enables users to generate document titles for each page. To activate it, users need to include the
DocumentTitleHandler
component within the<Refine>
component. By default, theDocumentTitleHandler
will generate titles using thegenerateDefaultDocumentTitle
exported from@refinedev/core
.The
DocumentTitleHandler
component accepts an optional prop calledhandler
, which is a callback function. This function is triggered whenever thepathname
changes and receives an object with the following parameters:{ resource, // 'posts' action, // 'create' params, // {id: 1} pathname, // '/posts/create' autoGeneratedTitle; // 'Create new Post | refine' }
The
handler
callback should return the new title based on the provided parameters.
To update the title in a child component, the user can use theuseDocumentTitle
hook. It accepts either a string representing the new title or an object with the propertyi18nKey
if the app supports multiple languages.useDocumentTitle({ i18nKey: "documentTitle.default" });